[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with debugging apparent error in parser
From: |
Carl D. Sorensen |
Subject: |
Re: Help with debugging apparent error in parser |
Date: |
Fri, 8 Aug 2008 15:10:40 -0600 |
On 8/8/08 3:09 AM, "Trevor Daniels" <address@hidden> wrote:
> 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.
I would agree with this, except for the problem that I can do
\myDisplayMusic \chordmode{c}
\myDisplayMusic \notemode {c}
which should put the parser back in notemode, and I still get the error with
m as an identifier. However, if I write
\myDisplayMusic \notemode{c}
I do not get the error with m as an identifier. Thus, it appears to me that
once the parser enters chordmode, it sets something that it doesn't clean up
when it moves from chordmode to notemode.
>
> Such errors can be avoided by:
>
> (a) placing all variable definitions before music
There is some justification in the documentation for being able to use void
music functions to set parser behavior in multiple locations.
> (b) not using single-character variable names.
I agree. I don't use single-character variable names. This particular case
was identified in a regression test.
I could change the variable name in the regression test. However, there is
still a subtle bug that I have been observing that has to do with the parser
entering chordmode in a void music function that causes strange errors.
This experience causes me to believe that there is a bug in the parser
related to chordmode.
Thanks,
Carl