]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3783: track default tremolo type in the parser
authorDavid Kastrup <dak@gnu.org>
Fri, 10 Jan 2014 13:36:11 +0000 (14:36 +0100)
committerDavid Kastrup <dak@gnu.org>
Wed, 15 Jan 2014 10:11:20 +0000 (11:11 +0100)
lily/include/lily-parser.hh
lily/lily-parser.cc
lily/parser.yy

index b4a8f8c87ad5a14c71af92e79f5a7feed4f39993..e2d484f3fb7d7993e2790476953bdecf6a7c11d5 100644 (file)
@@ -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_;
 
index cf5f62b941550010abacc835b272465460305a3e..a82ec94bed4c79034caf28e128fa8dcfc309c56a 100644 (file)
@@ -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;
index 2c5d8312e36ca53502eb1b89458ea6c7883e6b89..2a647c1ec6a2b328d9935dea430652b0933ae2ce 100644 (file)
@@ -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);
+               }
        }
        ;