From 73d9385195d6ddcd355a89bf5ae6042d579c8333 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Wed, 26 Dec 2012 22:09:55 +0100 Subject: [PATCH] Issue 3049: Parser outputs Lyric events for illegal note names Well, after this patch this is what we still do (using void-music with duration and post events seems even worse of a followup reaction, silently dropping duration and post events not much better). But additionally, an error is flagged. The complaint is "have to be in Lyric mode for lyrics" which is accurate since in Lyric mode arbitrary strings and markups may be accepted. At the point the error is flagged, we don't necessarily have encountered an unquoted string, so "bad note name" might be even more misleading. Before this issue originated, the parser likely bombed out with "Unexpected STRING", and frankly that's not really better than "have to be in Lyric mode". --- lily/parser.yy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lily/parser.yy b/lily/parser.yy index 77075a2882..37d5fa4e77 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -3053,6 +3053,8 @@ lyric_element: lyric_element_music: lyric_element optional_notemode_duration post_events { + if (!parser->lexer_->is_lyric_state ()) + parser->parser_error (@1, _ ("have to be in Lyric mode for lyrics")); $$ = MAKE_SYNTAX ("lyric-event", @$, $1, $2); if (scm_is_pair ($3)) unsmob_music ($$)->set_property -- 2.39.5