From: David Kastrup Date: Fri, 10 Jan 2014 13:36:11 +0000 (+0100) Subject: Issue 3783: track default tremolo type in the parser X-Git-Tag: release/2.19.1-1~8^2~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4946b042b3480f77db6e641ce66cd0fdc80797e8;p=lilypond.git Issue 3783: track default tremolo type in the parser --- diff --git a/lily/include/lily-parser.hh b/lily/include/lily-parser.hh index b4a8f8c87a..e2d484f3fb 100644 --- a/lily/include/lily-parser.hh +++ b/lily/include/lily-parser.hh @@ -25,8 +25,7 @@ #include "pitch.hh" /** - State for the parser. Do not ever add any variables to parse - musical content here. We still have to remove default_duration_. + State for the parser. TODO: interface is too complicated */ @@ -38,6 +37,7 @@ public: Lily_lexer *lexer_; Sources *sources_; Duration default_duration_; + int default_tremolo_type_; string output_basename_; SCM closures_; diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index cf5f62b941..a82ec94bed 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -44,6 +44,7 @@ Lily_parser::Lily_parser (Sources *sources) lexer_ = 0; sources_ = sources; default_duration_ = Duration (2, 0); + default_tremolo_type_ = 8; error_level_ = 0; closures_ = SCM_EOL; @@ -58,6 +59,7 @@ Lily_parser::Lily_parser (Lily_parser const &src, SCM closures, SCM location) lexer_ = 0; sources_ = src.sources_; default_duration_ = src.default_duration_; + default_tremolo_type_ = src.default_tremolo_type_; error_level_ = 0; output_basename_ = src.output_basename_; closures_ = closures; diff --git a/lily/parser.yy b/lily/parser.yy index 2c5d8312e3..2a647c1ec6 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2980,12 +2980,16 @@ dots: tremolo_type: ':' { - $$ = SCM_INUM0; + $$ = scm_from_int (parser->default_tremolo_type_); } | ':' UNSIGNED { - if (SCM_UNBNDP (make_duration ($2))) + if (SCM_UNBNDP (make_duration ($2))) { parser->parser_error (@2, _ ("not a duration")); - $$ = $2; + $$ = scm_from_int (parser->default_tremolo_type_); + } else { + $$ = $2; + parser->default_tremolo_type_ = scm_to_int ($2); + } } ;