bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with debugging apparent error in parser


From: Trevor Daniels
Subject: Re: Help with debugging apparent error in parser
Date: Fri, 8 Aug 2008 10:09:07 +0100

Carl

This isn't a problem specific to chordmode.  If you use
an identifier c you get a similar error about unexpected
notename_pitch whatever the input mode.  The problem is
the identifier m.

Because m is a valid chord modifier and the parser/lexer
is scanning for chordmodifiers or pitchnames it considers
the m to be a chord modifier rather than a variable name.

It seem the parser/lexer relies on finding a token which
is invalid in the current input mode to cause termination
of that mode.  So your first expression is ok because m
is invalid in notemode.

Such errors can be avoided by:

(a) placing all variable definitions before music
(b) not using single-character variable names.

Trevor

----- Original Message ----- From: "Carl D. Sorensen" <address@hidden>
To: "lily-devel" <address@hidden>; <address@hidden>
Sent: Friday, August 08, 2008 2:54 AM
Subject: Help with debugging apparent error in parser


Dear LilyPond team,

As I developed the transposable fretboards, I have apparently run into an
error in the parser.

When \chordmode is done, it apparently leaves the parser in a fragile state.

Let me show some code:

%%%%%%%  Begin code

myDisplayMusic =
#(define-music-function (parser location music)
 (ly:music?)
 (display-scheme-music music)
 (make-music 'SequentialMusic 'void #t))


%\myDisplayMusic <c e g>  % Expression 1 -- no problem
\myDisplayMusic \chordmode{c}  % Expression 2  -- causes error

m = \relative c' { c d e}

\context Staff {
 \m
}

%%%%%%%% End code

If Expression 1 in the above code is uncommented, and expression 2 is
commented, the code compiles normally.

If Expression 1 is commented, and Expression 2 is uncommented, there is a
parse error:

parseerror.ly:14:0: error: syntax error, unexpected CHORD_MODIFIER

m = \relative c' { c d e}
parseerror.ly:17:2: error: unknown escaped string: `\m'

 \m
parseerror.ly:17:2: error: syntax error, unexpected STRING

 \m
parseerror.ly:16:0: error: errors found, ignoring music expression

\context Staff {



Even if Expression 1 is uncommented and follows Expression 2, I get the same
error.  It appears that the parser somehow gets stuck using chordmode
parsing.

I have no idea how to debug this problem.  Any suggestions?  Or can anybody
fix this?

Thanks,

Carl



_______________________________________________
lilypond-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]