From 8975b732591f00df9cf6aa64cebf405558cec655 Mon Sep 17 00:00:00 2001 From: Nicolas Sceaux Date: Sun, 29 Nov 2009 16:14:42 +0100 Subject: [PATCH] Chord repetition fixes - restrict elements that are subject to chord repetition: notes, note chords, etc; exclude skips, bar checks, etc. - when a lexer object is copied, copy the chord repetition data. --- lily/lily-lexer.cc | 2 +- lily/parser.yy | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index c861d7ba90..0adee98fec 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -123,7 +123,7 @@ Lily_lexer::Lily_lexer (Lily_lexer const &src, Lily_parser *parser) pitchname_tab_stack_ = src.pitchname_tab_stack_; sources_ = src.sources_; start_module_ = SCM_EOL; - chord_repetition_ = Chord_repetition (); + chord_repetition_ = src.chord_repetition_; error_level_ = src.error_level_; is_main_input_ = src.is_main_input_; diff --git a/lily/parser.yy b/lily/parser.yy index 422eb1b9b4..2ddc2c815f 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1013,9 +1013,7 @@ simultaneous_music: ; simple_music: - event_chord { - PARSER->lexer_->chord_repetition_.last_chord_ = $$; - } + event_chord | MUSIC_IDENTIFIER | music_property_def | context_change @@ -1419,6 +1417,11 @@ event_chord: /* TODO: Create a special case that avoids the creation of EventChords around simple_elements that have no post_events? */ + /* event_chords like simple notes, note chords, etc, are + saved into PARSER->lexer_->chord_repetition_ so that + the chord repetition mechanism can copy them when a + chord repetition symbol is found + */ simple_chord_elements post_events { SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL)); @@ -1427,6 +1430,7 @@ event_chord: * i = @$; */ i.set_location (@1, @2); $$ = MAKE_SYNTAX ("event-chord", i, elts); + PARSER->lexer_->chord_repetition_.last_chord_ = $$; } | CHORD_REPETITION optional_notemode_duration post_events { Input i; @@ -1442,7 +1446,9 @@ event_chord: $$ = MAKE_SYNTAX ("multi-measure-rest", i, $2, $3); } | command_element - | note_chord_element + | note_chord_element { + PARSER->lexer_->chord_repetition_.last_chord_ = $$; + } ; -- 2.39.5