1 %{ // -*-Fundamental-*-
11 #include "input-score.hh"
12 #include "parseconstruct.hh"
14 #include "string-convert.hh"
23 %option yyclass="My_flex_lexer"
40 TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
48 PITCHMOD ['`]*{OPTSIGN}
64 yy_push_state(lyrics);
68 const char *s = YYText();
69 yylval.string = new String (s);
70 mtor << "rest:"<< yylval.string;
75 return ret_notename(p, YYText(), -1);
80 return ret_notename(p, YYText(), 0);
83 <notes>{NOTECOMMAND} {
84 String c = YYText() +1;
85 mtor << "\\word: " << YYText()+1<<eol;
86 int l = lookup_keyword(c);
89 Identifier * id = lookup_identifier(c);
94 String *sp = new String( c);
100 const char *s = YYText();
101 mtor << "pitchmod:"<< YYText()<<eol;
102 yylval.string = new String (s);
106 yylval.i = strlen(YYText());
110 yylval.i = String_convert::dec2_i( String( YYText() ) );
122 String s (YYText()+1);
123 s = s.left_str(s.length_i()-1);
124 yylval.string = new String(s);
128 return yylval.c = YYText()[0];
132 yy_push_state(quote);
135 yylval.string = new String (YYText());
138 mtor << "quoted string\n";
144 yylval.i = strlen(YYText());
148 yylval.i = String_convert::dec2_i( String( YYText() ) );
151 <lyrics>{NOTECOMMAND} {
152 String c = YYText() +1;
153 mtor << "\\word: " << YYText()+1<<eol;
154 int l = lookup_keyword(c);
158 /* let's try passing tex's typesetting macros like \ss \alpha \c */
159 String* str_p = new String(YYText());//huh?
162 /* and skip identifiers...
163 Identifier * id = lookup_identifier(c);
168 String *sp = new String( c);
175 String s (YYText()+1);
176 s = s.left_str(s.length_i()-1);
177 yylval.string = new String(s);
183 while ((i=s.index_i("_")) != -1) // change word binding "_" to " "
184 *(s.ch_l() + i) = ' ';
185 if ((i=s.index_i("\\,")) != -1) // change "\," to TeX's "\c "
187 *(s.ch_l() + i + 1) = 'c';
188 s = s.left_str(i+2) + " " + s.right_str(s.length_i()-i-2);
190 yylval.string = new String(s);
202 <lyrics>[()\[\]|/.^>_-] {
203 return yylval.c = YYText()[0];
215 yyterminate(); // can't move this, since it actually rets a YY_NULL
222 <incl>[ \t]* { /* eat the whitespace */ }
223 <incl>\"[^"]*\"+ { /* got the include file name */
224 String s (YYText()+1);
225 s = s.left_str(s.length_i()-1);
226 defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1;
233 mtor << "word: " << YYText()<<eol;
235 int l = lookup_keyword(c);
238 Identifier * id = lookup_identifier(c);
243 String *sp = new String( c);
244 mtor << "new id: " << *sp << eol;
251 int cnv=sscanf (YYText(), "%lf", &r);
253 mtor << "REAL" << r<<'\n';
264 char c = YYText()[0];
265 mtor << "misc char" <<c<<"\n";
276 error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_c_l() );