Menu

#5777 Let flex handle the input stack

Fixed
2020-03-01
2020-02-20
No

Let flex handle the input stack

This requires at least flex 2.5.29 released in 2003.

Prior cleanups:
1) Use Includable_lexer::new_input in Lily_lexer

Only Includable_lexer::new_input (const string &, Sources ) is virtual,
the method with type (const string &, const string &, Sources
) should
not be declared.

2) Deduplicate code from Includable_lexer::new_input

http://codereview.appspot.com/563560043

Discussion

  • David Kastrup

    David Kastrup - 2020-02-20

    As a hint: getting the input stack handling reasonably safe from tumbling into ly/init.ly for followup errors from parsing the main document was sort of a chore. There are comments around \maininput in that file reading like

    $(if (ly:get-option 'include-settings)
      (ly:parser-include-string
        (format #f "\\include \"~a\"" (ly:get-option 'include-settings))))
    
    \maininput
    %% there is a problem at the end of the input file
    
    %%
    %% Above and below comments compensate for the parser's look-ahead.
    %%
    

    and those comments were often in the error context when stuff bombed out like with a missing closing brace. So if you move the input stack processing, it would make sense to crash-test in particular what happens with main files that are incomplete and end in the middle of an expression or even token.

    Errors flagged outside of the user accessible files are just confusing.

     
    • Jonas Hahnfeld

      Jonas Hahnfeld - 2020-02-20

      I tested EOFs in comments, strings, commands and contexts and all got me the same "syntax error, unexpected end of input" plus some extra ones for comments and strings. But with none of that, I was either able to escape main input nor trigger the rule <maininput>{ANY_CHAR} as indicated in Rietveld...

       
  • Anonymous

    Anonymous - 2020-02-21
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2020-02-21

    Passes make, make check and a full make doc.

    (I used the './config.status --recheck && touch config.hh' method to stop the 'file is newer' problem after applying the patch and this seems to work, which is fine for me)

     
    • Jonas Hahnfeld

      Jonas Hahnfeld - 2020-02-21

      Great. You also run autogen.sh --noconf / autoconf after applying the patch, right? I don't think that's handled by config.status.

       

      Last edit: Jonas Hahnfeld 2020-02-21
  • Anonymous

    Anonymous - 2020-02-24

    No I didn't do the autogen.sh stuff.

    If that is not good enough for the patch review then can you confirm when I run this - i.e. do I still run config.status and touch and THEN this or do I just run autogen.sh/autoconf? Set the patch back to new so I spot it and then I can retest (and if it passes we can jump to countdown)

     
    • David Kastrup

      David Kastrup - 2020-02-24

      It just isn't enough when configuration changes are involved. I'll add --force to the autoconf flags in autogen.sh, maybe that will help.

       
      • Jonas Hahnfeld

        Jonas Hahnfeld - 2020-02-24

        Adding --force will not help if the process doesn't involve running it after applying the patch in the first place.

         
        • David Kastrup

          David Kastrup - 2020-02-24

          I am taking a look. This is just not cutting it.

           
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-02-25

    rebase and fix name of cache variable

    http://codereview.appspot.com/563560043

     
  • Anonymous

    Anonymous - 2020-02-26
    • Needs: -->
    • Patch: new --> review
    • Type: -->
     
  • Anonymous

    Anonymous - 2020-02-26

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2020-02-28
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2020-02-28

    Patch on countdown for 1st March.

     
  • Anonymous

    Anonymous - 2020-03-01
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2020-03-01

    Patch counted down - please push.

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-03-01
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-03-01

    pushed to staging as

    commit f8a937724ad8d1fb572bd9b4755430576458786f
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Thu Feb 20 15:07:13 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Sun Mar 1 12:32:04 2020 +0100
    
        Issue 5777/3: Let flex handle the input stack
    
        This requires at least flex 2.5.29 released in 2003.
    
    commit 41902893f40ee5fdfd38f900457a99b84647aa6d
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Thu Feb 20 13:15:31 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Sun Mar 1 12:32:00 2020 +0100
    
        Issue 5777/2: Deduplicate code from Includable_lexer::new_input
    
    commit 45683fe06b2d9013c486c04706be85d8d1951e4b
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Thu Feb 20 13:05:57 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Sun Mar 1 12:31:49 2020 +0100
    
        Issue 5777/1: Use Includable_lexer::new_input in Lily_lexer
    
        Only Includable_lexer::new_input (const string &, Sources *) is virtual,
        the method with type (const string &, const string &, Sources *) should
        not be declared.