]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
release: 1.1.26
[lilypond.git] / lily / parser.yy
index 202adcfcc2f3a74abd626cea328e43a659e8eb15..73a7557a4758d7be0d0324e8012df4c010377889 100644 (file)
@@ -15,7 +15,6 @@
 #include "scalar.hh"
 #include "translation-property.hh"
 #include "script-def.hh"
-#include "symtable.hh"
 #include "lookup.hh"
 #include "misc.hh"
 #include "my-lily-lexer.hh"
@@ -47,7 +46,7 @@
 
 // mmm
 Mudela_version oldest_version ("1.0.14");
-Mudela_version version ("1.0.14");
+Mudela_version version ("1.0.15");
 
 
 // needed for bison.simple's malloc() and free()
@@ -94,8 +93,6 @@ Paper_def* current_paper = 0;
     Array<Musical_pitch> *pitch_arr;
     Array<String> * strvec;
     Array<int> *intvec;
-    Atom * symbol;
-    Box *box;
     Notename_table *chordmodifiertab;
     Duration *duration;
     General_script_def * script;
@@ -118,8 +115,6 @@ Paper_def* current_paper = 0;
     Scalar *scalar;
     Simultaneous_music *chord;
     String *string;
-    Symtable * symtable;
-    Symtables* symtables;
     Tempo_req *tempo;
     Text_def * textdef;
     Translator* trans;
@@ -189,8 +184,6 @@ yylex (YYSTYPE *s,  void * v_l)
 %token SHAPE
 %token SKIP
 %token SPANDYNAMIC
-%token SYMBOLTABLES
-%token TABLE
 %token TEMPO
 %token TIME_T
 %token TIMES
@@ -229,7 +222,6 @@ yylex (YYSTYPE *s,  void * v_l)
 
 %type <outputdef> output_def
 %type <scope>  mudela_header mudela_header_body
-%type <box>    box
 %type <i>      open_request_parens close_request_parens
 %type <i>      sub_quotes sup_quotes
 %type <music>  simple_element  request_chord command_element Simple_music  Composite_music 
@@ -241,16 +233,14 @@ yylex (YYSTYPE *s,  void * v_l)
 %type <id>     identifier_init simple_identifier_init block_identifier
 %type <duration> steno_duration notemode_duration
 %type <duration> entered_notemode_duration explicit_duration
-%type <interval>       dinterval
 %type <intvec> intastint_list int_list
-%type <symtables>      symtables symtables_body
 
 %type <pitch>   explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
 %type <pitch>   steno_tonic_pitch
 %type <notereq>        steno_notepitch
 %type <pitch_arr>      pitch_list
 %type <music>  chord notemode_chord
-%type <pitch_arr>      chord_additions chord_subtractions
+%type <pitch_arr>      chord_additions chord_subtractions chord_notes
 %type <pitch>  chord_addsub chord_note chord_inversion notemode_chord_inversion
 %type <midi>   midi_block midi_body
 %type <duration>       duration_length
@@ -271,14 +261,11 @@ yylex (YYSTYPE *s,  void * v_l)
 %type <script> script_definition script_body mudela_script gen_script_def
 %type <textdef> text_def finger
 %type <string> script_abbreviation
-%type <symbol> symboldef
-%type <symtable>       symtable symtable_body
 %type <trans>  translator_spec translator_spec_body
 %type <tempo>  tempo_request
 %type <notenametab> notenames_body notenames_block chordmodifiers_block
 
-/* 5 extra for notemode_chord */
-%expect 15
+%expect 7
 
 
 %left '-' '+'
@@ -431,9 +418,6 @@ block_identifier:
                $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
 
        }
-       | symtables {
-               $$ = new Symtables_identifier ($1, IDENTIFIER);
-       }
        | translator_spec {
                $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
        }
@@ -498,7 +482,9 @@ translator_spec_body:
                        THIS->parser_error (_("Wrong type for property value"));
 
                delete $4;
-               $$->set_property (*$2, str);
+               /* ugh*/
+               Translator_group * tr = dynamic_cast<Translator_group*>($$);
+               tr->set_property (*$2, str);
        }
        | translator_spec_body NAME STRING ';' {
                $$->type_str_ = *$3;
@@ -523,7 +509,6 @@ translator_spec_body:
 */
 score_block:
        SCORE { THIS->remember_spot ();
-               THIS->error_level_i_ =0;
        }
        /*cont*/ '{' score_body '}'     {
                $$ = $4;
@@ -531,9 +516,6 @@ score_block:
                if (!$$->def_p_arr_.size ())
                        $$->add_output (THIS->default_paper_p ());
 
-               /* handle error levels. */
-               $$->errorlevel_i_ = THIS->error_level_i_;
-               THIS->error_level_i_ = 0;
        }
        ;
 
@@ -610,8 +592,10 @@ paper_def_body:
                THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
                $$ = p;
        }
-       | paper_def_body int '=' symtables              { // ugh, what a syntax
-               Lookup * l = new Lookup (*$4);
+       | paper_def_body int '=' FONT STRING            { // ugh, what a syntax
+               Lookup * l = new Lookup;
+               l->font_name_ = *$5;
+               delete $5;
                $$->set_lookup ($2, l);
        }
        | paper_def_body assignment ';' {
@@ -715,7 +699,7 @@ midi_body: /* empty */              {
        ;
 
 tempo_request:
-       TEMPO entered_notemode_duration '=' unsigned    {
+       TEMPO steno_duration '=' unsigned       {
                $$ = new Tempo_req;
                $$->dur_ = *$2;
                delete $2;
@@ -910,7 +894,7 @@ abbrev_command_req:
                $$ = $1->access_content_Request (true);
        }
        | '~'   {
-               $$ = new Command_tie_req;
+               $$ = new Tie_req;
        }
        | '['           {
                Beam_req*b= new Beam_req;
@@ -1399,7 +1383,7 @@ simple_element:
                        THIS->parser_error (_ ("have to be in Chord mode for chords"));
                $$ = $1;
        }
-       | '@' notemode_chord {
+       | '@' notemode_chord '@' {
                if (!THIS->lexer_p_->note_state_b ())
                        THIS->parser_error (_ ("have to be in Note mode for @chords"));
                $$ = $2;
@@ -1420,10 +1404,16 @@ chord_additions:
        {
                $$ = new Array<Musical_pitch>;
        } 
-       | '-' {
+       | '-' chord_notes {
+               $$ = $2;
+       }
+       ;
+
+chord_notes:
+       {
                $$ = new Array<Musical_pitch>;
-       } 
-       | chord_additions chord_addsub {
+       }
+       | chord_notes chord_addsub {
                $$ = $1;
                $$->push (*$2);
        }
@@ -1453,19 +1443,19 @@ notemode_chord_inversion:
        ;
 
 chord_note:
-       UNSIGNED {
+       unsigned {
                $$ = new Musical_pitch;
                $$->notename_i_ = ($1 - 1) % 7;
                $$->octave_i_ = $1 > 7 ? 1 : 0;
                $$->accidental_i_ = 0;
         } 
-       | UNSIGNED '+' {
+       | unsigned '+' {
                $$ = new Musical_pitch;
                $$->notename_i_ = ($1 - 1) % 7;
                $$->octave_i_ = $1 > 7 ? 1 : 0;
                $$->accidental_i_ = 1;
        }
-       | UNSIGNED '-' {
+       | unsigned '-' {
                $$ = new Musical_pitch;
                $$->notename_i_ = ($1 - 1) % 7;
                $$->octave_i_ = $1 > 7 ? 1 : 0;
@@ -1473,16 +1463,12 @@ chord_note:
        }
         ;
 
-chord_subtractions:
+chord_subtractions: 
        {
                $$ = new Array<Musical_pitch>;
-       }
-       | '^' {
-               $$ = new Array<Musical_pitch>;
-       }
-       | chord_subtractions chord_addsub {
-               $$ = $1;
-               $$->push (*$2);
+       } 
+       | '^' chord_notes {
+               $$ = $2;
        }
        ;
 
@@ -1544,74 +1530,8 @@ string:
 
 
 
-/*
-       symbol tables
-*/
-symtables:
-       SYMBOLTABLES '{' symtables_body '}'     { $$ = $3; }
-       ;
-
-symtables_body:
-                       {
-               $$ = new Symtables;
-       }
-       | IDENTIFIER            {
-               $$ = $1->access_content_Symtables (true);
-       }
-       | symtables_body FONT STRING            {
-               $$->font_ = *$3;
-               $$->font_path_ = global_path.find (*$3);
-               if  (!$$->font_path_.length_i ())
-                       THIS->here_input ().error (_f("can't open file: `%s'", $3->ch_C()));
-
-               delete $3;
-       }
-       | symtables_body STRING '=' symtable            {
-               $$->add (*$2, $4);
-               delete $2;
-       }
-       ;
-
-symtable:
-       TABLE '{' symtable_body '}' { $$ = $3; }
-       ;
-
-symtable_body:
-                               { $$ = new Symtable; }
-       | symtable_body STRING  symboldef {
-               $$->elem (*$2) = *$3;
-               delete $2;
-               delete $3;
-       }
-       ;
-
-symboldef:
-       STRING unsigned box             {
-               // ignore #args
-               $$ = new Atom (*$1, *$3);
-               delete $1;
-               delete $3;
-       }
-       | STRING unsigned {
-               Box b (Interval (0,0), Interval (0,0));
-               // ignore #args
-               $$ = new Atom (*$1, b);
-               delete $1;
-       }
-       ;
 
-box:
-       dinterval dinterval     {
-               $$ = new Box (*$1, *$2);
-               delete $1;
-               delete $2;
-       }
-       ;
 
-dinterval: real        real            {
-               $$ = new Interval ($1, $2);
-       }
-       ;
 
 %%