]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
juergen, heikki, chris patch.
[lilypond.git] / lily / parser.yy
index c7a905166c41759b000e5f08f1f3f93844af38d7..cc0c23b87f8f2bff6aefd1e789bffa0553c4ad74 100644 (file)
@@ -47,7 +47,6 @@ this.
 #include "property-iterator.hh"
 #include "file-results.hh"
 #include "input.hh"
-#include "scope.hh"
 #include "relative-music.hh"
 #include "lyric-combine-music.hh"
 #include "transposed-music.hh"
@@ -112,7 +111,10 @@ set_music_properties (Music *p, SCM a)
 
 
 // needed for bison.simple's malloc () and free ()
+
 #include <malloc.h>
+#include <stdlib.h>
+
 
 #ifndef NDEBUG
 #define YYDEBUG 1
@@ -130,6 +132,10 @@ set_music_properties (Music *p, SCM a)
 
 %}
 
+/* We use SCMs to do strings, because it saves us the trouble of
+deleting them.  Let's hope that a stack overflow doesnt trigger a move
+of the parse stack onto the heap. */
+
 
 %union {
 
@@ -138,16 +144,11 @@ set_music_properties (Music *p, SCM a)
     String *string; // needed by the lexer as temporary scratch area.
     Music *music;
     Score *score;
-    Scope *scope;
     Scheme_hash_table *scmhash;
     Music_output_def * outputdef;
 
     Request * request;
 
-    /* We use SCMs to do strings, because it saves us the trouble of
-deleting them.  Let's hope that a stack overflow doesnt trigger a move
-of the parse stack onto the heap. */
-
     SCM scm;
 
     Tempo_req *tempo;
@@ -243,7 +244,8 @@ yylex (YYSTYPE *s,  void * v_l)
 %token REST
 
 /* escaped */
-%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE E_TILDE
+%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
+%token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
 %token E_BACKSLASH
 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
 %token FIGURE_SPACE
@@ -360,9 +362,9 @@ toplevel_expression:
        }
        | output_def {
                if (dynamic_cast<Paper_def*> ($1))
-                       THIS->lexer_p_->set_identifier ("$defaultpaper", $1->self_scm ());
+                       THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultpaper"), $1->self_scm ());
                else if (dynamic_cast<Midi_def*> ($1))
-                       THIS->lexer_p_->set_identifier ("$defaultmidi", $1->self_scm ());
+                       THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultmidi"), $1->self_scm ());
        }
        | embedded_scm {
                // junk value
@@ -403,9 +405,7 @@ notenames_body:
 lilypond_header_body:
        {
                $$ = new Scheme_hash_table;
-               
-               Scope *sc = new Scope ($$);
-               THIS->lexer_p_-> scope_l_arr_.push (sc);
+               THIS->lexer_p_-> scope_l_arr_.push ($$);
        }
        | lilypond_header_body assignment  { 
 
@@ -415,7 +415,7 @@ lilypond_header_body:
 lilypond_header:
        HEADER '{' lilypond_header_body '}'     {
                $$ = $3;
-               delete THIS->lexer_p_-> scope_l_arr_.pop ();
+               THIS->lexer_p_->scope_l_arr_.pop ();
        }
        ;
 
@@ -439,7 +439,7 @@ assignment:
                        ip.warning (_ ("Identifier should have  alphabetic characters only"));
                }
 
-               THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
+               THIS->lexer_p_->set_identifier ($1, $4);
 
 /*
  TODO: devise standard for protection in parser.
@@ -613,7 +613,7 @@ music_output_def_body:
                p = new Midi_def;
 
         $$ = p;
-        THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
+        THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
        }
        | PAPER '{'     {
                Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
@@ -622,20 +622,20 @@ music_output_def_body:
                        p = dynamic_cast<Paper_def*> (id->clone ());
                else
                        p = new Paper_def;
-               THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
+               THIS-> lexer_p_-> scope_l_arr_.push (p->variable_tab_);
                $$ = p;
        }
        | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER         {
                Music_output_def *p = unsmob_music_output_def ($3);
                p = p->clone ();
-               THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
+               THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
                $$ = p;
        }
        | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER  {
                Music_output_def *p = unsmob_music_output_def ($3);
                p = p->clone ();
 
-               THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
+               THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
                $$ = p;
        }
        | music_output_def_body assignment  {
@@ -1174,11 +1174,11 @@ command_element:
        | TIME_T fraction  {
                Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
 
-  int l = gh_scm2int (ly_car ($2));
-  int o = gh_scm2int (ly_cdr ($2));
-  
-  Moment one_beat = Moment (1)/Moment (o);
-  Moment len = Moment (l) * one_beat;
+               int l = gh_scm2int (ly_car ($2));
+               int o = gh_scm2int (ly_cdr ($2));
+
+               Moment one_beat = Moment (1)/Moment (o);
+               Moment len = Moment (l) * one_beat;
 
 
                Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
@@ -1239,6 +1239,19 @@ shorthand_command_req:
                b->set_mus_property ("span-type", ly_str02scm ("beam"));
                $$ = b;
        }
+       | E_LEFTSQUARE {
+               Span_req *b = new Span_req;
+               b->set_span_dir (START);
+               b->set_mus_property ("span-type", ly_str02scm ("ligature-bracket"));
+               $$ = b;
+               THIS->last_ligature_start_ = b->self_scm ();
+       }
+       | E_RIGHTSQUARE {
+               Span_req *b = new Span_req;
+               b->set_span_dir (STOP);
+               b->set_mus_property ("span-type", ly_str02scm ("ligature-bracket"));
+               $$ = b;
+       }
        | BREATHE {
                $$ = new Breathing_sign_req;
        }
@@ -1744,12 +1757,14 @@ bass_figure:
 
 br_bass_figure:
        '[' bass_figure {
-               unsmob_music ($2)->set_mus_property ("bracket-start", SCM_BOOL_T);
+               $$ = $2;
+               unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
        }
        | bass_figure   {
-
+               $$ = $1;
        }
        | br_bass_figure ']' {
+               $$ = $1;
                unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
        }
        ;