]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/parser.yy, lily/lexer.ll: added some simplifications by
authorErik Sandberg <mandolaerik@gmail.com>
Wed, 19 Jul 2006 11:38:20 +0000 (11:38 +0000)
committerErik Sandberg <mandolaerik@gmail.com>
Wed, 19 Jul 2006 11:38:20 +0000 (11:38 +0000)
Angelo Contardi.

ChangeLog
THANKS
lily/lexer.ll
lily/parser.yy

index c00a11abae92eff5d9eb5b16667fabe914e11f81..e86fe90bb7a8e58faff9d64b898767f7ef2a261a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-19  Erik Sandberg  <mandolaerik@gmail.com>
+
+       * lily/parser.yy, lily/lexer.ll: added some simplifications by
+       Angelo Contardi.
+
 2006-07-19  Graham Percival  <gpermus@gmail.com>
 
        * input/manual/screech-boink.ly: moved to here.
diff --git a/THANKS b/THANKS
index 4ca18523bd786daddf31650d213082ff06ae762a..0fe6f802f2272e99f67e569577420c8fad5c1f67 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -10,6 +10,7 @@ Mats Bengtsson    - Support Guru
 
 CONTRIBUTORS
 
+Angelo Contardi
 David Feuer
 Erik Sandberg
 Erlend Aasland
index 2b887d0046b58ef940e2fa3623f54219c5f8c387..c6be4382d47aae37b479091ebaf0506af7153554 100644 (file)
@@ -179,6 +179,12 @@ BOM_UTF8   \357\273\277
   }
 }
 
+<INITIAL,notes,figures,chords,markup>{
+       \"              {
+               start_quote ();
+       }
+}
+
 <INITIAL,chords,lyrics,notes,figures>\\version{WHITE}* {
        yy_push_state (version);
 }
@@ -318,13 +324,23 @@ BOM_UTF8  \357\273\277
        return SCM_T;
 }
 <INITIAL,notes,lyrics>{ 
-       \<\<   {
+       \<\<    {
                return DOUBLE_ANGLE_OPEN;
        }
-       \>\>   {
+       \>\>    {
                return DOUBLE_ANGLE_CLOSE;
        }
 }
+
+<INITIAL,notes>{
+       \<      {
+               return ANGLE_OPEN;
+       }
+       \>      {
+               return ANGLE_CLOSE;
+       }
+}
+
 <figures>{
        _       {
                return FIGURE_SPACE;
@@ -362,36 +378,9 @@ BOM_UTF8   \357\273\277
                yylval.i = String_convert::dec2int (string (YYText () +1));
                return E_UNSIGNED;
        }
-       \" {
-               start_quote ();
-       }
 }
 
-\"             {
-       start_quote ();
-}
-<quote>{
-       \\{ESCAPED}     {
-               *yylval.string += to_string (escaped_char (YYText ()[1]));
-       }
-       [^\\"]+ {
-               *yylval.string += YYText ();
-       }
-       \"      {
-
-               yy_pop_state ();
-
-               /* yylval is union. Must remember STRING before setting SCM*/
-               string *sp = yylval.string;
-               yylval.scm = scm_makfrom0str (sp->c_str ());
-               delete sp;
-               return STRING;
-       }
-       .       {
-               *yylval.string += YYText ();
-       }
-}
-<lyric_quote>{
+<quote,lyric_quote>{
        \\{ESCAPED}     {
                *yylval.string += to_string (escaped_char (YYText ()[1]));
        }
@@ -406,7 +395,7 @@ BOM_UTF8    \357\273\277
                string *sp = yylval.string;
                yylval.scm = scm_makfrom0str (sp->c_str ());
                delete sp;
-               return LYRICS_STRING;
+               return is_lyric_state () ? LYRICS_STRING : STRING;
        }
        .       {
                *yylval.string += YYText ();
@@ -465,9 +454,6 @@ BOM_UTF8    \357\273\277
                yylval.i = String_convert::dec2int (string (YYText ()));
                return UNSIGNED;
        }
-       \" {
-               start_quote ();
-       }
        -  {
                return CHORD_MINUS;
        }
@@ -490,9 +476,6 @@ BOM_UTF8    \357\273\277
 
 
 <markup>{
-       \" {
-               start_quote ();
-       }
        \\score {
                return SCORE;
        }
index 08c0e1e742083472bb87a62f75a81c37ce59aa74..5901962c861103b99f998e4aeb6f587cba532d54 100644 (file)
@@ -160,7 +160,7 @@ void set_music_properties (Music *p, SCM a);
 %token ADDQUOTE "\\addquote"
 %token ALIAS "\\alias"
 %token ALTERNATIVE "\\alternative"
-%token BOOK "\book"
+%token BOOK "\\book"
 %token CHANGE "\\change"
 %token CHORDMODE "\\chordmode"
 %token CHORDS "\\chords"
@@ -223,8 +223,10 @@ void set_music_properties (Music *p, SCM a);
 %token CHORD_COLON ":"
 %token CHORD_MINUS "-"
 %token CHORD_SLASH "/"
-%token DOUBLE_ANGLE_CLOSE ">>"
+%token ANGLE_OPEN "<"
+%token ANGLE_CLOSE ">"
 %token DOUBLE_ANGLE_OPEN "<<"
+%token DOUBLE_ANGLE_CLOSE ">>"
 %token E_BACKSLASH "\\"
 %token E_ANGLE_CLOSE "\\>"
 %token E_CHAR "\\C[haracter]"
@@ -348,7 +350,6 @@ If we give names, Bison complains.
 %type <scm> simple_music_property_def
 %type <scm> string_number_event
 %type <scm> tempo_event
-%type <scm> toplevel_music
 
 %type <outputdef> output_def_body
 %type <outputdef> output_def_head
@@ -477,7 +478,7 @@ toplevel_expression:
                scm_call_2 (proc, PARSER->self_scm (), score->self_scm ());
                score->unprotect ();
        }
-       | toplevel_music {
+       | composite_music {
                Music *music = unsmob_music ($1);
                SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-music-handler");
                scm_call_2 (proc, PARSER->self_scm (), music->self_scm ());
@@ -502,11 +503,6 @@ toplevel_expression:
        }
        ;
 
-toplevel_music:
-       composite_music {
-       }
-       ;
-
 embedded_scm:
        SCM_T
        | SCM_IDENTIFIER
@@ -902,7 +898,7 @@ simultaneous_music:
        SIMULTANEOUS '{' music_list '}'{
                $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_car ($3));
        }
-       | simul_open music_list simul_close     {
+       | DOUBLE_ANGLE_OPEN music_list DOUBLE_ANGLE_CLOSE       {
                $$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_car ($2));
        }
        ;
@@ -1331,20 +1327,8 @@ note_chord_element:
        }
        ;
 
-chord_open: '<'
-       ;
-
-chord_close: '>'
-       ;
-
-simul_open: DOUBLE_ANGLE_OPEN
-       ;
-
-simul_close: DOUBLE_ANGLE_CLOSE
-       ;
-
 chord_body:
-       chord_open chord_body_elements chord_close
+       ANGLE_OPEN chord_body_elements ANGLE_CLOSE
        {
                $$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
        }
@@ -1766,7 +1750,7 @@ script_abbreviation:
        | '|'           {
                $$ = scm_makfrom0str ("Bar");
        }
-       | '>'           {
+       | ANGLE_CLOSE   {
                $$ = scm_makfrom0str ("Larger");
        }
        | '.'           {