X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparser.yy;h=9e257060ae3451dd02ea78de9c80b396e5f430ab;hb=2a984a02e2d85732e92eb1fd95cc0a73fc40c60d;hp=ab09f537b2a8693f413c4121d9dcb82e13916d12;hpb=792175df3301a04ba29f3f5b9d2d7f50c318b5e3;p=lilypond.git diff --git a/lily/parser.yy b/lily/parser.yy index ab09f537b2..9e257060ae 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -81,7 +81,7 @@ or %left ADDLYRICS %right ':' UNSIGNED REAL E_UNSIGNED EVENT_IDENTIFIER EVENT_FUNCTION '^' '_' - HYPHEN EXTENDER DURATION_IDENTIFIER + HYPHEN EXTENDER DURATION_IDENTIFIER '!' /* The above are needed for collecting tremoli and other items (that could otherwise be interpreted as belonging to the next function @@ -146,32 +146,36 @@ Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const str parser->parser_error (*i, s); } +// The following are somewhat precarious constructs as they may change +// the value of the lookahead token. That implies that the lookahead +// token must not yet have made an impact on the state stack other +// than causing the reduction of the current rule, or switching the +// lookahead token while Bison is mulling it over will cause trouble. + #define MYBACKUP(Token, Value, Location) \ -do \ - if (yychar == YYEMPTY) \ - { \ + do { \ + if (yychar != YYEMPTY) \ + parser->lexer_->push_extra_token \ + (yylloc, yychar, yylval); \ if (Token) \ - parser->lexer_->push_extra_token (Token, Value); \ - parser->lexer_->push_extra_token (BACKUP); \ - } else { \ - parser->parser_error \ - (Location, _("Too much lookahead")); \ - } \ -while (0) + parser->lexer_->push_extra_token \ + (Location, Token, Value); \ + parser->lexer_->push_extra_token (Location, BACKUP); \ + yychar = YYEMPTY; \ + } while (0) #define MYREPARSE(Location, Pred, Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - parser->lexer_->push_extra_token (Token, Value); \ - parser->lexer_->push_extra_token (REPARSE, \ - Pred); \ - } else { \ - parser->parser_error \ - (Location, _("Too much lookahead")); \ - } \ -while (0) + do { \ + if (yychar != YYEMPTY) \ + parser->lexer_->push_extra_token \ + (yylloc, yychar, yylval); \ + parser->lexer_->push_extra_token \ + (Location, Token, Value); \ + parser->lexer_->push_extra_token \ + (Location, REPARSE, Pred); \ + yychar = YYEMPTY; \ + } while (0) %} @@ -269,6 +273,7 @@ int yylex (YYSTYPE *s, YYLTYPE *loc, Lily_parser *parser); %token REST "\\rest" %token REVERT "\\revert" %token SCORE "\\score" +%token SCORELINES "\\score-lines" %token SEQUENTIAL "\\sequential" %token SET "\\set" %token SIMULTANEOUS "\\simultaneous" @@ -332,6 +337,7 @@ If we give names, Bison complains. %token CONTEXT_MOD_IDENTIFIER %token DRUM_PITCH %token PITCH_IDENTIFIER +%token PITCH_ARG %token DURATION_IDENTIFIER %token EVENT_IDENTIFIER %token EVENT_FUNCTION @@ -405,6 +411,13 @@ toplevel_expression: SCM proc = parser->lexer_->lookup_identifier ("toplevel-bookpart-handler"); scm_call_2 (proc, parser->self_scm (), $1); } + | BOOK_IDENTIFIER { + SCM proc = parser->lexer_->lookup_identifier + (unsmob_book($1)->paper_ + ? "toplevel-book-handler" + : "toplevel-bookpart-handler"); + scm_call_2 (proc, parser->self_scm (), $1); + } | score_block { SCM proc = parser->lexer_->lookup_identifier ("toplevel-score-handler"); scm_call_2 (proc, parser->self_scm (), $1); @@ -436,6 +449,10 @@ toplevel_expression: { SCM proc = parser->lexer_->lookup_identifier ("toplevel-text-handler"); scm_call_2 (proc, parser->self_scm (), out); + } else if (unsmob_score ($1)) + { + SCM proc = parser->lexer_->lookup_identifier ("toplevel-score-handler"); + scm_call_2 (proc, parser->self_scm (), $1); } else if (!scm_is_eq ($1, SCM_UNSPECIFIED)) parser->parser_error (@1, _("bad expression type")); } @@ -473,6 +490,7 @@ embedded_scm_bare_arg: { $$ = parser->lexer_->eval_scm_token ($1); } + | FRACTION | full_markup_list | context_modification | score_block @@ -511,6 +529,18 @@ scm_function_call: } ; +embedded_lilypond_number: + '-' embedded_lilypond_number + { + $$ = scm_difference ($2, SCM_UNDEFINED); + } + | bare_number_common + | UNSIGNED NUMBER_IDENTIFIER + { + $$ = scm_product ($1, $2); + } + ; + embedded_lilypond: /* empty */ { @@ -520,7 +550,31 @@ embedded_lilypond: // contains no source location. $$ = MAKE_SYNTAX ("void-music", @$); } - | identifier_init + | identifier_init_nonumber + | embedded_lilypond_number + | post_event post_events + { + $$ = scm_reverse_x ($2, SCM_EOL); + if (Music *m = unsmob_music ($1)) + { + if (m->is_mus_type ("post-event-wrapper")) + $$ = scm_append + (scm_list_2 (m->get_property ("elements"), + $$)); + else + $$ = scm_cons ($1, $$); + } + if (scm_is_pair ($$) + && scm_is_null (scm_cdr ($$))) + $$ = scm_car ($$); + else + { + Music * m = MY_MAKE_MUSIC ("PostEvents", @$); + m->set_property ("elements", $$); + $$ = m->unprotect (); + } + } + | multiplied_duration | music_embedded music_embedded music_list { $3 = scm_reverse_x ($3, SCM_EOL); if (unsmob_music ($2)) @@ -577,12 +631,8 @@ assignment: identifier_init: - score_block - | book_block - | bookpart_block - | output_def - | context_def_spec_block - | music_assign + identifier_init_nonumber + | number_expression | post_event_nofinger post_events { $$ = scm_reverse_x ($2, SCM_EOL); @@ -605,7 +655,15 @@ identifier_init: $$ = m->unprotect (); } } - | number_expression + ; + +identifier_init_nonumber: + score_block + | book_block + | bookpart_block + | output_def + | context_def_spec_block + | music_assign | FRACTION | string | embedded_scm @@ -746,6 +804,10 @@ book_body: { SCM proc = parser->lexer_->lookup_identifier ("book-text-handler"); scm_call_2 (proc, $1, out); + } else if (unsmob_score ($2)) + { + SCM proc = parser->lexer_->lookup_identifier ("book-score-handler"); + scm_call_2 (proc, $1, $2); } else if (!scm_is_eq ($2, SCM_UNSPECIFIED)) parser->parser_error (@2, _("bad expression type")); } @@ -812,6 +874,10 @@ bookpart_body: { SCM proc = parser->lexer_->lookup_identifier ("bookpart-text-handler"); scm_call_2 (proc, $1, out); + } else if (unsmob_score ($2)) + { + SCM proc = parser->lexer_->lookup_identifier ("bookpart-score-handler"); + scm_call_2 (proc, $1, $2); } else if (!scm_is_eq ($2, SCM_UNSPECIFIED)) parser->parser_error (@2, _("bad expression type")); } @@ -831,27 +897,69 @@ bookpart_body: score_block: SCORE '{' score_body '}' { + unsmob_score ($3)->origin ()->set_spot (@$); $$ = $3; } ; +score_headers: + /* empty */ + { + $$ = SCM_EOL; + } + | score_headers + { + if (!scm_is_pair ($1) + || !ly_is_module (scm_car ($1))) + $1 = scm_cons (ly_make_module (false), $1); + parser->lexer_->add_scope (scm_car ($1)); + } lilypond_header + { + $$ = $1; + } + | score_headers output_def + { + Output_def *od = unsmob_output_def ($2); + if (od->lookup_variable (ly_symbol2scm ("is-paper")) == SCM_BOOL_T) + { + parser->parser_error (@2, _("\\paper cannot be used in \\score, use \\layout instead")); + + } + else + { + if (scm_is_pair ($1) && ly_is_module (scm_car ($1))) + scm_set_cdr_x ($1, scm_cons ($2, scm_cdr ($1))); + else + $$ = scm_cons ($2, $1); + } + } + ; + + + score_body: - music { + score_headers music { SCM scorify = ly_lily_module_constant ("scorify-music"); - $$ = scm_call_2 (scorify, $1, parser->self_scm ()); + $$ = scm_call_2 (scorify, $2, parser->self_scm ()); - unsmob_score ($$)->origin ()->set_spot (@$); + if (scm_is_pair ($1) && ly_is_module (scm_car ($1))) + { + unsmob_score ($$)->set_header (scm_car ($1)); + $1 = scm_cdr ($1); + } + for (SCM p = scm_reverse_x ($1, SCM_EOL); + scm_is_pair (p); p = scm_cdr (p)) + { + unsmob_score ($$)-> + add_output_def (unsmob_output_def (scm_car (p))); + } } | embedded_scm_active { - Score *score; - if (unsmob_score ($1)) - score = new Score (*unsmob_score ($1)); - else { - score = new Score; + if (!unsmob_score ($1)) + { + $$ = (new Score)->unprotect (); parser->parser_error (@1, _("score expected")); } - unsmob_score ($$)->origin ()->set_spot (@$); - $$ = score->unprotect (); } | score_body { @@ -1040,6 +1148,18 @@ music_embedded: { $$ = $3; } + | multiplied_duration post_events + { + Music *n = MY_MAKE_MUSIC ("NoteEvent", @$); + + parser->default_duration_ = *unsmob_duration ($1); + n->set_property ("duration", $1); + + if (scm_is_pair ($2)) + n->set_property ("articulations", + scm_reverse_x ($2, SCM_EOL)); + $$ = n->unprotect (); + } ; music_embedded_backup: @@ -1281,11 +1401,7 @@ grouped_music_list: */ function_arglist_nonbackup_common: - EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup FRACTION - { - $$ = check_scheme_arg (parser, @4, $4, $3, $2); - } - | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup post_event_nofinger + EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup post_event_nofinger { $$ = check_scheme_arg (parser, @4, $4, $3, $2); } @@ -1490,13 +1606,14 @@ function_arglist_nonbackup_reparse: ; +// function_arglist_backup can't occur at the end of an argument +// list. It needs to be careful about avoiding lookahead only until +// it has made a decision whether or not to accept the parsed entity. +// At that point of time, music requiring lookahead to parse becomes +// fine. function_arglist_backup: - function_arglist_backup_common - | function_arglist_common - ; - -function_arglist_backup_common: - EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup embedded_scm_arg_closed + function_arglist_common + | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup embedded_scm_arg_closed { if (scm_is_true (scm_call_1 ($2, $4))) { @@ -1589,16 +1706,6 @@ function_arglist_backup_common: MYBACKUP (NUMBER_IDENTIFIER, $4, @4); } } - | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup FRACTION - { - if (scm_is_true (scm_call_1 ($2, $4))) - { - $$ = scm_cons ($4, $3); - } else { - $$ = scm_cons (loc_on_music (@3, $1), $3); - MYBACKUP (FRACTION, $4, @4); - } - } | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup '-' UNSIGNED { SCM n = scm_difference ($5, SCM_UNDEFINED); @@ -1614,7 +1721,7 @@ function_arglist_backup_common: else { $$ = scm_cons (loc_on_music (@3, $1), $3); MYBACKUP (UNSIGNED, $5, @5); - parser->lexer_->push_extra_token ('-'); + parser->lexer_->push_extra_token (@4, '-'); } } @@ -1642,9 +1749,15 @@ function_arglist_backup_common: } | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup PITCH_IDENTIFIER { - if (scm_is_true (scm_call_1 ($2, $4))) + SCM m = make_music_from_simple (parser, @4, $4); + if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m))) { - $$ = scm_cons ($4, $3); + MYREPARSE (@4, $2, PITCH_IDENTIFIER, $4); + $$ = $3; + } else if (scm_is_true (scm_call_1 ($2, $4))) + { + MYREPARSE (@4, $2, PITCH_ARG, $4); + $$ = $3; } else { $$ = scm_cons (loc_on_music (@3, $1), $3); MYBACKUP (PITCH_IDENTIFIER, $4, @4); @@ -1652,10 +1765,15 @@ function_arglist_backup_common: } | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup NOTENAME_PITCH { - if (scm_is_true (scm_call_1 ($2, $4))) + SCM m = make_music_from_simple (parser, @4, $4); + if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m))) { MYREPARSE (@4, $2, NOTENAME_PITCH, $4); $$ = $3; + } else if (scm_is_true (scm_call_1 ($2, $4))) + { + MYREPARSE (@4, $2, PITCH_ARG, $4); + $$ = $3; } else { $$ = scm_cons (loc_on_music (@3, $1), $3); MYBACKUP (NOTENAME_PITCH, $4, @4); @@ -1663,10 +1781,15 @@ function_arglist_backup_common: } | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup TONICNAME_PITCH { - if (scm_is_true (scm_call_1 ($2, $4))) + SCM m = make_music_from_simple (parser, @4, $4); + if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m))) { MYREPARSE (@4, $2, TONICNAME_PITCH, $4); $$ = $3; + } else if (scm_is_true (scm_call_1 ($2, $4))) + { + MYREPARSE (@4, $2, PITCH_ARG, $4); + $$ = $3; } else { $$ = scm_cons (loc_on_music (@3, $1), $3); MYBACKUP (TONICNAME_PITCH, $4, @4); @@ -1723,6 +1846,11 @@ function_arglist_backup_common: (parser, @3, $3), $1, $2); } + | function_arglist_backup REPARSE pitch_arg + { + $$ = check_scheme_arg (parser, @3, + $3, $1, $2); + } | function_arglist_backup REPARSE bare_number_common { $$ = check_scheme_arg (parser, @3, @@ -1774,11 +1902,6 @@ function_arglist_common: $$ = check_scheme_arg (parser, @3, $3, $2, $1); } - | EXPECT_SCM function_arglist_optional FRACTION - { - $$ = check_scheme_arg (parser, @3, - $3, $2, $1); - } | EXPECT_SCM function_arglist_optional post_event_nofinger { $$ = check_scheme_arg (parser, @3, @@ -1942,11 +2065,6 @@ function_arglist_closed_common: $$ = check_scheme_arg (parser, @3, $3, $2, $1); } - | EXPECT_SCM function_arglist_optional FRACTION - { - $$ = check_scheme_arg (parser, @3, - $3, $2, $1); - } | function_arglist_common_reparse REPARSE SCM_ARG { $$ = check_scheme_arg (parser, @3, @@ -2155,8 +2273,8 @@ re_rhythmed_music: ; context_change: - CHANGE STRING '=' STRING { - $$ = MAKE_SYNTAX ("context-change", @$, scm_string_to_symbol ($2), $4); + CHANGE symbol '=' simple_string { + $$ = MAKE_SYNTAX ("context-change", @$, $2, $4); } ; @@ -2402,10 +2520,10 @@ simple_revert_context: (scm_object_property (scm_car ($1), ly_symbol2scm ("is-grob?")))) { $$ = ly_symbol2scm ("Bottom"); - parser->lexer_->push_extra_token (SCM_IDENTIFIER, $1); + parser->lexer_->push_extra_token (@1, SCM_IDENTIFIER, $1); } else { $$ = scm_car ($1); - parser->lexer_->push_extra_token (SCM_IDENTIFIER, + parser->lexer_->push_extra_token (@1, SCM_IDENTIFIER, scm_cdr ($1)); } } @@ -2476,7 +2594,6 @@ scalar: { $$ = scm_difference ($2, SCM_UNDEFINED); } - | FRACTION | STRING | full_markup ; @@ -2497,13 +2614,19 @@ event_chord: } } %prec ':' | simple_chord_elements post_events { - SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL)); - - Input i; - /* why is this giving wrong start location? -ns - * i = @$; */ - i.set_location (@1, @2); - $$ = MAKE_SYNTAX ("event-chord", i, elts); + if (scm_is_pair ($2)) { + if (unsmob_pitch ($1)) + $1 = make_chord_elements (@1, + $1, + parser->default_duration_.smobbed_copy (), + SCM_EOL); + + SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL)); + + $$ = MAKE_SYNTAX ("event-chord", @1, elts); + } else if (!unsmob_pitch ($1)) + $$ = MAKE_SYNTAX ("event-chord", @1, $1); + // A mere pitch drops through. } %prec ':' | CHORD_REPETITION optional_notemode_duration post_events { Input i; @@ -2627,7 +2750,7 @@ music_function_call_closed: ; event_function_event: - EVENT_FUNCTION function_arglist_closed { + EVENT_FUNCTION function_arglist { $$ = MAKE_SYNTAX ("music-function", @$, $1, $2); } @@ -2674,7 +2797,7 @@ post_event_nofinger: direction_less_event { $$ = $1; } - | script_dir music_function_call_closed { + | script_dir music_function_call { $$ = $2; if (!unsmob_music ($2)->is_mus_type ("post-event")) { parser->parser_error (@2, _ ("post-event expected")); @@ -2756,11 +2879,21 @@ direction_reqd_event: } | script_abbreviation { SCM s = parser->lexer_->lookup_identifier ("dash" + ly_scm2string ($1)); - Music *a = MY_MAKE_MUSIC ("ArticulationEvent", @$); - if (scm_is_string (s)) + if (scm_is_string (s)) { + Music *a = MY_MAKE_MUSIC ("ArticulationEvent", @$); a->set_property ("articulation-type", s); - else parser->parser_error (@1, _ ("expecting string as script definition")); - $$ = a->unprotect (); + $$ = a->unprotect (); + } else { + Music *original = unsmob_music (s); + if (original && original->is_mus_type ("post-event")) { + Music *a = original->clone (); + a->set_spot (parser->lexer_->override_input (@$)); + $$ = a->unprotect (); + } else { + parser->parser_error (@1, _ ("expecting string or post-event as script definition")); + $$ = MY_MAKE_MUSIC ("PostEvents", @$)->unprotect (); + } + } } ; @@ -2824,7 +2957,25 @@ steno_tonic_pitch: pitch: steno_pitch - | PITCH_IDENTIFIER + | PITCH_IDENTIFIER quotes { + if (!scm_is_eq (SCM_INUM0, $2)) + { + Pitch p = *unsmob_pitch ($1); + p = p.transposed (Pitch (scm_to_int ($2),0,0)); + $$ = p.smobbed_copy (); + } + } + ; + +pitch_arg: + PITCH_ARG quotes { + if (!scm_is_eq (SCM_INUM0, $2)) + { + Pitch p = *unsmob_pitch ($1); + p = p.transposed (Pitch (scm_to_int ($2),0,0)); + $$ = p.smobbed_copy (); + } + } ; gen_text_def: @@ -3136,6 +3287,7 @@ simple_element: } ; +// Can return a single pitch rather than a list. simple_chord_elements: new_chord { if (!parser->lexer_->is_chord_state ()) @@ -3174,9 +3326,13 @@ lyric_element_music: } %prec ':' ; +// Can return a single pitch rather than a list. new_chord: - steno_tonic_pitch optional_notemode_duration { - $$ = make_chord_elements (@$, $1, $2, SCM_EOL); + steno_tonic_pitch maybe_notemode_duration { + if (SCM_UNBNDP ($2)) + $$ = $1; + else + $$ = make_chord_elements (@$, $1, $2, SCM_EOL); } | steno_tonic_pitch optional_notemode_duration chord_separator chord_items { SCM its = scm_reverse_x ($4, SCM_EOL); @@ -3240,10 +3396,10 @@ step_number: ; tempo_range: - UNSIGNED { + unsigned_number { $$ = $1; - } - | UNSIGNED '-' UNSIGNED { + } %prec ':' + | unsigned_number '-' unsigned_number { $$ = scm_cons ($1, $3); } ; @@ -3312,6 +3468,23 @@ bare_number_closed: unsigned_number: UNSIGNED | NUMBER_IDENTIFIER + { + if (!scm_is_integer ($1) + || scm_is_true (scm_negative_p ($1))) + { + parser->parser_error (@1, _("not an unsigned integer")); + $$ = SCM_INUM0; + } + } + | embedded_scm + { + if (!scm_is_integer ($1) + || scm_is_true (scm_negative_p ($1))) + { + parser->parser_error (@1, _("not an unsigned integer")); + $$ = SCM_INUM0; + } + } ; exclamations: @@ -3326,7 +3499,13 @@ exclamations: ; questions: - { $$ = SCM_UNDEFINED; } +// This precedence rule is rather weird. It triggers when '!' is +// encountered after a pitch, and is used for deciding whether to save +// this instead for a figure modification. This should not actually +// occur in practice as pitches and figures are generated in different +// modes. Using a greedy (%right) precedence makes sure that we don't +// get stuck in a wrong interpretation. + { $$ = SCM_UNDEFINED; } %prec ':' | questions '?' { if (SCM_UNBNDP ($1)) @@ -3355,7 +3534,7 @@ full_markup: ; markup_top: - simple_markup_list { + markup_list { $$ = scm_list_2 (ly_lily_module_constant ("line-markup"), $1); } | markup_head_1_list simple_markup @@ -3383,7 +3562,7 @@ markup_scm: ; -simple_markup_list: +markup_list: markup_composed_list { $$ = $1; } @@ -3401,22 +3580,12 @@ markup_uncomposed_list: { $$ = $2; } - ; - -markup_list: - simple_markup_list - | markup_score - { - $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $1)); - } - ; - -markup_score: - SCORE { + | SCORELINES { SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); parser->lexer_->push_note_state (nn); } '{' score_body '}' { - $$ = $4; + unsmob_score ($4)->origin ()->set_spot (@$); + $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $4)); parser->lexer_->pop_state (); } ; @@ -3439,7 +3608,7 @@ markup_braced_list_body: | markup_braced_list_body markup { $$ = scm_cons ($2, $1); } - | markup_braced_list_body simple_markup_list { + | markup_braced_list_body markup_list { $$ = scm_reverse_x ($2, $1); } ; @@ -3488,6 +3657,14 @@ simple_markup: STRING { $$ = make_simple_markup ($1); } + | SCORE { + SCM nn = parser->lexer_->lookup_identifier ("pitchnames"); + parser->lexer_->push_note_state (nn); + } '{' score_body '}' { + unsmob_score ($4)->origin ()->set_spot (@$); + $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $4); + parser->lexer_->pop_state (); + } | MARKUP_FUNCTION markup_command_basic_arguments { $$ = scm_cons ($1, scm_reverse_x ($2, SCM_EOL)); } @@ -3495,10 +3672,6 @@ simple_markup: { $$ = $2; } - | markup_score - { - $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $1); - } ; markup: @@ -3580,6 +3753,9 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid) *destination = p->self_scm (); p->unprotect (); return OUTPUT_DEF_IDENTIFIER; + } else if (unsmob_score (sid)) { + *destination = unsmob_score (sid)->clone ()->unprotect (); + return SCM_IDENTIFIER; } return -1; @@ -3736,9 +3912,12 @@ make_music_from_simple (Lily_parser *parser, Input loc, SCM simple) parser->default_duration_.smobbed_copy ()); } else if (parser->lexer_->is_chord_state ()) { if (unsmob_pitch (simple)) - return make_chord_elements (loc, simple, - parser->default_duration_.smobbed_copy (), - SCM_EOL); + return MAKE_SYNTAX + ("event-chord", + loc, + make_chord_elements (loc, simple, + parser->default_duration_.smobbed_copy (), + SCM_EOL)); } return simple; } @@ -3801,6 +3980,9 @@ yylex (YYSTYPE *s, YYLTYPE *loc, Lily_parser *parser) lex->lexval_ = s; lex->lexloc_ = loc; + int tok = lex->pop_extra_token (); + if (tok >= 0) + return tok; lex->prepare_for_next_token (); return lex->yylex (); }