]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lexer.ll
release: 1.1.25
[lilypond.git] / lily / lexer.ll
index 514096c078a268a614a26f11cef24645145661da..dc409d288a4b5981a5ba2468a644e105f3c30618 100644 (file)
@@ -92,8 +92,6 @@ RESTNAME      [rs]
 NOTECOMMAND    \\{A}+
 LYRICS         ({AA}|{TEX})[^0-9 \t\n\f]*
 ESCAPED                [nt\\'"]
-PLET           \\\[
-TELP           \\\]
 EXTENDER       [_][_]
 
 %%
@@ -138,7 +136,13 @@ EXTENDER   [_][_]
 
 
 <INITIAL,chords,lyrics,notes>\\maininput           {
-       start_main_input ();
+       if (!main_input_b_)
+       {
+               start_main_input ();
+               main_input_b_ = true;
+       }
+       else
+               error ("\\maininput disallowed outside init files.");
 }
 
 <INITIAL,chords,lyrics,notes>\\include           {
@@ -283,6 +287,9 @@ EXTENDER    [_][_]
        {ALPHAWORD}     {
                return scan_bare_word (YYText ());
        }
+       {NOTECOMMAND}   {
+               return scan_escaped_word (YYText () + 1);
+       }
        {UNSIGNED}              {
                yylval.i = String_convert::dec2_i (String (YYText ()));
                return UNSIGNED;
@@ -332,14 +339,6 @@ EXTENDER   [_][_]
        return c;
 }
 
-<lyrics,notes>{PLET}   {
-       return yylval.i = PLET;
-}
-
-<lyrics,notes>{TELP}   {
-       return yylval.i = TELP;
-}
-
 <INITIAL,notes>.       {
        return yylval.c = YYText ()[0];
 }
@@ -407,13 +406,12 @@ My_lily_lexer::scan_escaped_word (String str)
                return id->token_code_i_;
        }
        if ((YYSTATE != notes) && (YYSTATE != chords)) {
-               if (notename_b (str))
-                       {
-                       yylval.pitch = new Musical_pitch (lookup_pitch (str));
+               if (notename_b (str)) {
+                       yylval.pitch = new Musical_pitch (lookup_notename (str));
                        yylval.pitch->set_spot (Input (source_file_l (), 
                          here_ch_C ()));
                        return NOTENAME_PITCH;
-                       }
+               }
        }
        if (check_debug)
                print_declarations (true);
@@ -432,10 +430,16 @@ My_lily_lexer::scan_bare_word (String str)
        if ((YYSTATE == notes) || (YYSTATE == chords)) {
                if (notename_b (str)) {
                    DOUT << "(notename)\n";
-                   yylval.pitch = new Musical_pitch (lookup_pitch (str));
+                   yylval.pitch = new Musical_pitch (lookup_notename (str));
+                   yylval.pitch->set_spot (Input (source_file_l (), 
+                     here_ch_C ()));
+                    return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH;
+               } else if (chordmodifier_b (str)) {
+                   DOUT << "(chordmodifier)\n";
+                   yylval.pitch = new Musical_pitch (lookup_chordmodifier (str));
                    yylval.pitch->set_spot (Input (source_file_l (), 
                      here_ch_C ()));
-                   return NOTENAME_PITCH;
+                   return CHORDMODIFIER_PITCH;
                }
        }