]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
Doc: LM 2.4.1 and NR 3.3.2 additions and corrections
[lilypond.git] / lily / parser.yy
index df8e6bc209bd497b835ac6a786a4dae8a445fa10..c60c6ed64c1157fa00e516efdcd98b8cb9e9eb0b 100644 (file)
@@ -116,6 +116,7 @@ FIXME:
 #include <cctype>
 #include <cstdlib>
 #include <cstdio>
+using namespace std;
 
 #include "book.hh"
 #include "context-def.hh"
@@ -140,7 +141,7 @@ FIXME:
 #include "lily-imports.hh"
 
 void
-Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const std::string &s)
+Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s)
 {
        parser->parser_error (*i, s);
 }
@@ -222,7 +223,6 @@ SCM get_next_unique_lyrics_context_id ();
 #define _(x) gettext (x)
 #endif
 
-using std::string;
 
 static Music *make_music_with_input (SCM name, Input where);
 SCM check_scheme_arg (Lily_parser *parser, Input loc,
@@ -692,7 +692,7 @@ identifier_init_nonumber:
        | pitch_or_music
        | FRACTION
        | string
-        | embedded_scm
+       | embedded_scm
        | partial_markup
        | full_markup_list
         | context_modification
@@ -1282,10 +1282,10 @@ tempo_event:
        TEMPO steno_duration '=' tempo_range    {
                $$ = MAKE_SYNTAX (tempo, @$, SCM_EOL, $2, $4);
        }
-       | TEMPO scalar steno_duration '=' tempo_range   {
+       | TEMPO text steno_duration '=' tempo_range     {
                $$ = MAKE_SYNTAX (tempo, @$, $2, $3, $5);
        }
-       | TEMPO scalar {
+       | TEMPO text {
                $$ = MAKE_SYNTAX (tempo, @$, $2);
        } %prec ':'
        ;
@@ -2716,15 +2716,25 @@ music_property_def:
        ;
 
 string:
-       STRING {
-               $$ = $1;
-       }
+       STRING
        | full_markup
        ;
 
-simple_string: STRING {
-               $$ = $1;
+text:
+       STRING
+       | full_markup
+       | embedded_scm_bare
+       {
+               if (Text_interface::is_markup ($1)) {
+                       $$ = $1;
+               } else {
+                       parser->parser_error (@1, (_ ("markup expected")));
+                       $$ = scm_string (SCM_EOL);
+               }
        }
+       ;
+
+simple_string: STRING
        | embedded_scm_bare
        {
                if (scm_is_string ($1)) {
@@ -3661,7 +3671,7 @@ full_markup:
        ;
 
 partial_markup:
-       markup_mode markup_head_1_list ETC
+       markup_mode markup_partial_function ETC
        {
                $$ = MAKE_SYNTAX (partial_markup, @2, $2);
                parser->lexer_->pop_state ();
@@ -3779,6 +3789,37 @@ markup_command_list_arguments:
        }
        ;
 
+markup_partial_function:
+       MARKUP_FUNCTION markup_arglist_partial
+       {
+               $$ = scm_list_1 (scm_cons ($1, scm_reverse_x ($2, SCM_EOL)));
+       }
+       | markup_head_1_list MARKUP_FUNCTION markup_arglist_partial
+       {
+               $$ = scm_cons (scm_cons ($2, scm_reverse_x ($3, SCM_EOL)),
+                              $1);
+       }
+       ;
+
+markup_arglist_partial:
+       EXPECT_MARKUP markup_arglist_partial
+       {
+               $$ = $2;
+       }
+       | EXPECT_SCM markup_arglist_partial
+       {
+               $$= $2;
+       }
+       | EXPECT_MARKUP markup_command_list_arguments
+       {
+               $$ = $2;
+       }
+       | EXPECT_SCM markup_command_list_arguments
+       {
+               $$ = $2;
+       }
+       ;
+
 markup_head_1_item:
        MARKUP_FUNCTION EXPECT_MARKUP markup_command_list_arguments {
          $$ = scm_cons ($1, scm_reverse_x ($3, SCM_EOL));