X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flexer.ll;h=178ea88e97eb9d070e22359aa0458f2487158fab;hb=a68f287dcc2277fb7943923426c459dde0426598;hp=c6be4382d47aae37b479091ebaf0506af7153554;hpb=1a61d0b5a931377348f579b3379cc6ccb129af8e;p=lilypond.git diff --git a/lily/lexer.ll b/lily/lexer.ll index c6be4382d4..178ea88e97 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -112,6 +112,7 @@ SCM (* scm_parse_error_handler) (void *); %x markup %x notes %x quote +%x sourcefileline %x sourcefilename %x version @@ -191,6 +192,9 @@ BOM_UTF8 \357\273\277 \\sourcefilename{WHITE}* { yy_push_state (sourcefilename); } +\\sourcefileline{WHITE}* { + yy_push_state (sourcefileline); +} \"[^"]*\" { /* got the version number */ string s (YYText () + 1); s = s.substr (0, s.rfind ('\"')); @@ -218,6 +222,16 @@ BOM_UTF8 \357\273\277 scm_makfrom0str (s.c_str ())); } + +{INT} { + int i; + sscanf (YYText (), "%d", &i); + +// this->set_debug (1); + yy_pop_state (); + this->here_input ().get_source_file ()->set_line (here_input ().start (), i); +} + . { LexerError (_ ("quoted string expected after \\version").c_str ()); yy_pop_state (); @@ -226,6 +240,10 @@ BOM_UTF8 \357\273\277 LexerError (_ ("quoted string expected after \\sourcefilename").c_str ()); yy_pop_state (); } +. { + LexerError (_ ("integer expected after \\sourcefileline").c_str ()); + yy_pop_state (); +} { [^\%]* { } @@ -321,7 +339,7 @@ BOM_UTF8 \357\273\277 } yylval.scm = sval; - return SCM_T; + return SCM_TOKEN; } { \<\< { @@ -533,7 +551,7 @@ BOM_UTF8 \357\273\277 } } -<> { +<*><> { if (is_main_input_) { is_main_input_ = false; @@ -895,7 +913,7 @@ static void init_signature_hash_table () }; for (int i = 0; sigs[i].symbol; i++) - scm_hashq_set_x (signature_hash_table, scm_gc_protect_object (ly_symbol2scm (sigs[i].symbol)), + scm_hashq_set_x (signature_hash_table, ly_symbol2scm (sigs[i].symbol), scm_from_int (sigs[i].token_type)); }