]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
*** empty log message ***
[lilypond.git] / lily / parser.yy
index ae8f3226d354ce1ec0ff99fe2a0d3eccc2e7aba6..7dccfe006b23040f09682c435841b8bd0d61b649 100644 (file)
 
 /*
   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
@@ -79,6 +71,7 @@ TODO:
 #include "music-sequence.hh"
 #include "input-smob.hh"
 #include "event.hh"
+#include "text-item.hh"
 
 bool
 regular_identifier_b (SCM id)
@@ -95,6 +88,15 @@ regular_identifier_b (SCM id)
   return v;
 }
 
+SCM
+make_simple_markup (SCM a)
+{
+       static SCM simple;
+       if (!simple)
+       simple = scm_c_eval_string ("simple-markup");
+
+       return scm_list_n (simple, a, SCM_UNDEFINED);
+}
 
 
 bool
@@ -275,8 +277,12 @@ yylex (YYSTYPE *s,  void * v)
 %token <scm>   REAL
 
 %token MARKUP
-%token <scm> MARKUP_HEAD_MARKUP0 MARKUP_HEAD_SCM0_MARKUP1 MARKUP_HEAD_MARKUP0_MARKUP1
-%token <scm> MARKUP_HEAD_SCM0 MARKUP_HEAD_SCM0_MARKUP1 MARKUP_HEAD_SCM0_SCM1_MARKUP2 MARKUP_HEAD_SCM0_SCM1 
+%token <scm> MARKUP_HEAD_MARKUP0
+%token <scm> MARKUP_HEAD_MARKUP0_MARKUP1
+%token <scm> MARKUP_HEAD_SCM0
+%token <scm> MARKUP_HEAD_SCM0_MARKUP1
+%token <scm> MARKUP_HEAD_SCM0_SCM1 
+%token <scm> MARKUP_HEAD_SCM0_SCM1_MARKUP2
 
 %token <scm> MARKUP_IDENTIFIER MARKUP_HEAD_LIST0
 %type <scm> markup markup_line markup_list  markup_list_body full_markup 
@@ -1635,9 +1641,10 @@ gen_text_def:
        }
        | string {
                Music *t = MY_MAKE_MUSIC("TextScriptEvent");
-               t->set_mus_property ("text", $1);
+               t->set_mus_property ("text", make_simple_markup ($1));
                t->set_spot (THIS->here_input ());
                $$ = t;
+       
        }
        | DIGIT {
                Music * t = MY_MAKE_MUSIC("FingerEvent");
@@ -2158,7 +2165,10 @@ questions:
 
 
 full_markup:
-       MARKUP 
+       MARKUP_IDENTIFIER {
+               $$ = $1;
+       }
+       | MARKUP 
                { THIS->lexer_->push_markup_state (); }
        markup
                { $$ = $3;
@@ -2168,15 +2178,14 @@ full_markup:
        
 markup:
        STRING {
-               static SCM simple;
-               if (!simple)
-                       simple = scm_c_eval_string ("simple-markup");
-
-               $$ = scm_list_n (simple, $1, SCM_UNDEFINED);
+               $$ = make_simple_markup ($1);
        }
        | 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); 
        }
@@ -2307,7 +2316,7 @@ My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid)
 
                *destination = p->self_scm();
                return MUSIC_OUTPUT_DEF_IDENTIFIER;
-       } else if (markup_p (sid)) {
+       } else if (new_markup_p (sid)) {
                *destination = sid;
                return MARKUP_IDENTIFIER;
        }