From 52e42bc215b1aef075afd4c5a456c8b1f7036ace Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:36:22 +0000 Subject: [PATCH] lilypond-0.0.44 --- lily/lexer.l | 57 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/lily/lexer.l b/lily/lexer.l index 549a957efd..21ce7aa06b 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -17,16 +17,19 @@ yy_push_state(quote);\ yylval.string = new String +#define yylval (*(YYSTYPE*)lexval_l) +#define YY_USER_ACTION add_lexed_char(YYLeng()); %} %option c++ %option noyywrap %option nodefault -%option yylineno %option debug %option yyclass="My_lily_lexer" %option stack +%option never-interactive +%option warn %x incl %x lyrics @@ -64,16 +67,17 @@ COMMENT %.*\n -^include { +include { yy_push_state(incl); } {WHITE}* { /* eat the whitespace */ } \"[^"]*\" { /* got the include file name */ - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1; - new_input(s); - yy_pop_state(); + String s (YYText()+1); + s = s.left_str(s.length_i()-1); + mtor << "#include `" << s << "\'\n"; +// defined_ch_C = here_ch_C() - String( YYText() ).length_i() - 1; + new_input(s,source_l_g); + yy_pop_state(); } {RESTNAME} { @@ -92,6 +96,18 @@ COMMENT %.*\n s=s.left_str(s.length_i() - 1); return scan_bare_word(s); } +{ALPHAWORD}/\' { + post_quotes_b_ = true; + return scan_bare_word(YYText()); +} +\'+ { + yylval.i = YYLeng(); + if (post_quotes_b_) { + post_quotes_b_ = false; + return POST_QUOTES; + } else + return PRE_QUOTES; +} {ALPHAWORD} { return scan_bare_word(YYText()); @@ -109,23 +125,21 @@ COMMENT %.*\n yylval.i = String_convert::dec2_i( String( YYText() ) ); return INT; } -[ \t\n]+ { -} \+\+ { return CONCAT; } \" { start_quote(); } -. { - return yylval.c = YYText()[0]; -} \" { start_quote(); } +\\\\ { + *yylval.string += '\\'; +} \\\" { *yylval.string +='\"'; } @@ -176,14 +190,13 @@ COMMENT %.*\n [()\[\]|/.^>_-] { return yylval.c = YYText()[0]; } -[ \t\n]+ { -} <> { - mtor << "<>"; + mtor << "<>"; - if (! close_input()) + if (! close_input()) { yyterminate(); // can't move this, since it actually rets a YY_NULL + } } {WORD} { return scan_bare_word(YYText()); @@ -210,15 +223,15 @@ COMMENT %.*\n mtor << "misc char" <{WHITE}+ { } - -{COMMENT} { - //ignore +. { + return yylval.c = YYText()[0]; } -. { - error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_c_l() ); + +<*>. { + error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_C() ); return YYText()[0]; } -- 2.39.5