[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parser.yy / grammar
From: |
David Kastrup |
Subject: |
Re: parser.yy / grammar |
Date: |
Tue, 24 Apr 2018 13:46:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Knut Petersen <address@hidden> writes:
> Hi everybody!
>
> Is there a reason not to allow MUSIC_FUNCTIONs whenever
> MUSIC_IDENTIFIERs are allowed?
Yes.
> One example is \addlyrics. It only accepts grouped_music_lists and
> MUSIC_IDENTIFIERs ...
Intentionally so. \addlyrics is a mode-changing command and it has to
change back afterwards.
parser.yy is actually quite explicit here:
// We must not have lookahead tokens parsed in lyric mode. In order
// to save confusion, we take almost the same set as permitted with
// \lyricmode and/or \lyrics. However, music identifiers are also
// allowed, and they obviously do not require switching into lyrics
// mode for parsing.
lyric_mode_music:
{
parser->lexer_->push_lyric_state ();
} grouped_music_list
{
parser->lexer_->pop_state ();
$$ = $2;
}
| MUSIC_IDENTIFIER
;
It's not like LilyPond is overdocumented. When there is an explicit
comment, chances are that it's sort-of relevant.
--
David Kastrup
- parser.yy / grammar, Knut Petersen, 2018/04/24
- Re: parser.yy / grammar, Knut Petersen, 2018/04/24
- Re: parser.yy / grammar,
David Kastrup <=
- Re: parser.yy / grammar, Knut Petersen, 2018/04/24
- Re: parser.yy / grammar, David Kastrup, 2018/04/24
- Re: parser.yy / grammar, Knut Petersen, 2018/04/24
- Re: parser.yy / grammar, David Kastrup, 2018/04/24
- Re: parser.yy / grammar, Knut Petersen, 2018/04/24
- Re: parser.yy / grammar, David Kastrup, 2018/04/25