]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
(finish_primitive): compile fixes.
[lilypond.git] / lily / parser.yy
index 174e84ac2c5408d5b06a406b9fc8523575b7c71b..d6a3f997d0e3af8f65fc83af9664f53c7b068487 100644 (file)
@@ -5,26 +5,18 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
            Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 /*
   Two shift/reduce problems:
-    - empty music-list
-    - empty pre-events
-
-
-
-(bullshit.
-
-s/r:
 
 1.     foo = bar.
 
-       "bar" -> String -> Lyric -> Music
+       "bar" -> String -> Lyric -> Music -> music-assignment
 
-       "bar" -> String
+       "bar" -> String -> string-assignment
 
 
 2.  \repeat
@@ -270,6 +262,8 @@ yylex (YYSTYPE *s,  void * v)
 %token <scm>   DURATION_IDENTIFIER
 %token <scm>    FRACTION
 %token <id>    IDENTIFIER
+%token <scm>   CHORDNAMES CHORDNAMES_IDENTIFIER
+%type <scm>    chordnames_block chordnames_list chord_scm
 
 
 %token <scm>   SCORE_IDENTIFIER
@@ -412,7 +406,6 @@ notenames_body:
                else
                        scm_hashq_set_x (tab, ly_caar (s), pt);
          }
-
          $$ = tab;
        }
        ;
@@ -503,8 +496,39 @@ identifier_init:
        | embedded_scm  {
                $$ = $1;
        }
+       | chordnames_block {
+               $$ = $1;
+       }       
+       ;
+
+chordnames_block:
+       CHORDNAMES '{'
+               { THIS->lexer_->push_chord_state (); }
+               chordnames_list
+               { THIS->lexer_->pop_state (); }
+       '}'
+       {
+               $$ = $4;
+       }
        ;
 
+chordnames_list:
+       /* empty */ {
+               $$ = SCM_EOL;
+       }
+       | CHORDNAMES_IDENTIFIER chordnames_list {
+               $$ = scm_append (scm_list_2 ($1, $2));
+       }
+       | chord_scm '=' full_markup chordnames_list {
+               $$ = scm_cons (scm_cons ($1, $3), $4);
+       };
+
+chord_scm:
+       steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
+               $$ = Chord::tonic_add_sub_to_pitches ($1, $3, $4);
+               /* junk bass and inversion for now */
+       };
+
 translator_spec_block:
        TRANSLATOR '{' translator_spec_body '}'
                {
@@ -1167,6 +1191,7 @@ scalar:
         string          { $$ = $1; }
         | bare_int      { $$ = gh_int2scm ($1); }
         | embedded_scm  { $$ = $1; }
+       | full_markup {  $$ = $1; }
         ;
 
 
@@ -1648,7 +1673,11 @@ gen_text_def:
                $$ = t; 
        }
        | string {
-               $$ = make_simple_markup ($1);
+               Music *t = MY_MAKE_MUSIC("TextScriptEvent");
+               t->set_mus_property ("text", make_simple_markup ($1));
+               t->set_spot (THIS->here_input ());
+               $$ = t;
+       
        }
        | DIGIT {
                Music * t = MY_MAKE_MUSIC("FingerEvent");
@@ -2169,7 +2198,10 @@ questions:
 
 
 full_markup:
-       MARKUP 
+       MARKUP_IDENTIFIER {
+               $$ = $1;
+       }
+       | MARKUP 
                { THIS->lexer_->push_markup_state (); }
        markup
                { $$ = $3;
@@ -2184,6 +2216,9 @@ markup:
        | MARKUP_HEAD_MARKUP0 markup {
                $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
        }
+       | MARKUP_HEAD_MARKUP0_MARKUP1 markup markup {
+               $$ = scm_list_n ($1, $2, $3, SCM_UNDEFINED);
+       }
        | MARKUP_HEAD_SCM0_MARKUP1 SCM_T markup {
                $$  = scm_list_n ($1, $2, $3, SCM_UNDEFINED); 
        }
@@ -2206,7 +2241,7 @@ markup:
        ;
 
 markup_list:
-       '<' markup_list_body '>' { $$ = scm_reverse_x ($2, SCM_EOL); }
+       CHORD_OPEN markup_list_body CHORD_CLOSE { $$ = scm_reverse_x ($2, SCM_EOL); }
        ;
 
 markup_line: