]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lexer.ll
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[lilypond.git] / lily / lexer.ll
index 295613c172980412e4fa485f6d28070d68de8a53..48d8c3564048cdac9e594947b7161ebfac8c5bd8 100644 (file)
 
 #include <iostream>
 
+#include "parse-scm.hh"
 #include "score.hh"
 #include "lily-guile.hh"
 #include "string.hh"
 #include "string-convert.hh"
 #include "my-lily-lexer.hh"
-#include "array.hh"
+#include "input-file-results.hh"
 #include "interval.hh"
 #include "lily-guile.hh"
 #include "parser.hh"
@@ -76,6 +77,8 @@ LYRICS                ({AA}|{TEX})[^0-9 \t\n\f]*
 
 
 SCM scan_fraction (String);
+SCM (* scm_parse_error_handler) (void *);
+
 
 %}
 
@@ -110,6 +113,7 @@ WORD                {A}{AN}*
 ALPHAWORD      {A}+
 DIGIT          {N}
 UNSIGNED       {N}+
+E_UNSIGNED     \\{N}+
 FRACTION       {N}+\/{N}+
 INT            -?{UNSIGNED}
 REAL           ({INT}\.{N}*)|(-?\.{N}+)
@@ -196,7 +200,7 @@ HYPHEN              --
        String s (YYText ()+1);
        s = s.left_string (s.index_last ('"'));
 
-       new_input (s,source_global);
+       new_input (s, &global_input_file->sources_ );
        yy_pop_state ();
 }
 <incl>\\{BLACK}*;?{WHITE} { /* got the include identifier */
@@ -207,7 +211,7 @@ HYPHEN              --
 
        SCM sid = lookup_identifier (s);
        if (gh_string_p (sid)) {
-               new_input (ly_scm2string (sid), source_global);
+               new_input (ly_scm2string (sid), &global_input_file->sources_);
                yy_pop_state ();
        } else { 
            String msg (_f ("wrong or undefined identifier: `%s'", s ));
@@ -224,7 +228,7 @@ HYPHEN              --
 }
 <chords,notes,figures>{RESTNAME}       {
        const char *s = YYText ();
-       yylval.scm = ly_str02scm (s);
+       yylval.scm = scm_makfrom0str (s);
        return RESTNAME;
 }
 <chords,notes,figures>R                {
@@ -258,7 +262,7 @@ HYPHEN              --
                yylval.scm =  SCM_EOL;
                return SCM_T;
        }
-       yylval.scm = ly_parse_scm (s, &n);
+       yylval.scm = ly_parse_scm (s, &n, here_input());
        
        for (int i=0; i < n; i++)
        {
@@ -300,6 +304,10 @@ HYPHEN             --
                yylval.i = String_convert::dec2int (String (YYText ()));
                return UNSIGNED;
        }
+       {E_UNSIGNED}    {
+               yylval.i = String_convert::dec2int (String (YYText () +1));
+               return E_UNSIGNED;
+       }
 
        \" {
                start_quote ();
@@ -322,7 +330,7 @@ HYPHEN              --
 
                /* yylval is union. Must remember STRING before setting SCM*/
                String *sp = yylval.string;
-               yylval.scm = ly_str02scm (sp->to_str0 ());
+               yylval.scm = scm_makfrom0str (sp->to_str0 ());
                delete sp;
                return STRING;
        }
@@ -358,8 +366,8 @@ HYPHEN              --
                char c = s[s.length () - 1];
                if (c == '{' ||  c == '}') // brace open is for not confusing dumb tools.
                        here_input ().warning (
-                               _ ("Brace found at end of lyric. Did you forget a space?"));
-               yylval.scm = ly_str02scm (s.to_str0 ());
+                               _ ("Brace found at end of lyric.  Did you forget a space?"));
+               yylval.scm = scm_makfrom0str (s.to_str0 ());
 
 
                return STRING;
@@ -395,6 +403,9 @@ HYPHEN              --
        \/\+ {
                return CHORD_BASS;
        }
+       \/  {
+               return CHORD_SLASH;
+       }
        \^  {
                return CHORD_CARET;
        }
@@ -432,6 +443,7 @@ HYPHEN              --
        return UNSIGNED;
 }
 
+
 [{}]   {
 
        return YYText ()[0];
@@ -468,6 +480,7 @@ HYPHEN              --
        return E_TILDE;
     case '\\':
        return E_BACKSLASH;
+
     default:
        return E_CHAR;
     }
@@ -563,7 +576,7 @@ My_lily_lexer::scan_escaped_word (String str)
        String msg (_f ("unknown escaped string: `\\%s'", str));        
        LexerError (msg.to_str0 ());
 
-       yylval.scm = ly_str02scm (str.to_str0 ());
+       yylval.scm = scm_makfrom0str (str.to_str0 ());
 
        return STRING;
 }
@@ -584,7 +597,7 @@ My_lily_lexer::scan_bare_word (String str)
                }
        }
 
-       yylval.scm = ly_str02scm (str.to_str0 ());
+       yylval.scm = scm_makfrom0str (str.to_str0 ());
        return STRING;
 }
 
@@ -651,8 +664,8 @@ valid_version_b (String s)
   Lilypond_version ver (s);
   if (! ((ver >= oldest_version) && (ver <= current)))
        {       
-               non_fatal_error (_f ("incorrect lilypond version: %s (%s, %s)", ver.string (), oldest_version.string (), current.string ()));
-               non_fatal_error (_ ("Consider converting the input with the convert-ly script")); 
+               non_fatal_error (_f ("Incorrect lilypond version: %s (%s, %s)", ver.string (), oldest_version.string (), current.string ()));
+               non_fatal_error (_ ("Consider updating the input with the convert-ly script")); 
                return false;
     }
   return true;