On Saturday 23 September 2006 17:49, Nicolas Sceaux wrote: > Hi, > > Using LilyPond from CVS, the following snippet causes a syntax error, > which 2.9.18 did not: > > /****************************** > testFunction = > #(define-music-function (parser location) () > ;; test-data.ly contains music variable definitions > (ly:parser-parse-string parser "\\include \"test-data.ly\"") > (make-music 'SequentialMusic 'void #t))
Hi, You should use ly:clone-parser to avoid this problem: #(define-music-function (parser location) () (ly:parser-parse-string (ly:clone-parser parser) "\\include \"test-data.ly\"") (make-music 'SequentialMusic 'void #t)) The same problem exists in previous versions, it happens whenever the lexer needs to read a lookahead token before applying a function: testFunction = #(define-music-function (parser location m) (ly:music?) (ly:parser-parse-string parser " \\notemode { c' } ") (make-music 'SequentialMusic 'void #t)) % lexer needs to read the { \testFunction c { c' } Han-Wen: It _might_ be possible to fix this issue by making parser::parse_string temporarily restore some variables while parsing the string, but I don't think it's worth it (IMHO we can ignore the problem). Do you agree? If so, we could perhaps make parse-string throw a warning if the parser seems to be parsing something else already. -- Erik _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel