1 %{ // -*-Fundamental-*-
11 #include "inputscore.hh"
12 #include "parseconstruct.hh"
22 %option yyclass="My_flex_lexer"
39 TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
47 PITCHMOD ['`]*{OPTSIGN}
63 yy_push_state(lyrics);
67 const char *s = YYText();
68 yylval.string = new String (s);
69 mtor << "rest:"<< yylval.string;
74 return ret_notename(p, YYText(), -1);
79 return ret_notename(p, YYText(), 0);
82 <notes>{NOTECOMMAND} {
83 String c = YYText() +1;
84 mtor << "\\word: " << YYText()+1<<eol;
85 int l = lookup_keyword(c);
88 Identifier * id = lookup_identifier(c);
93 String *sp = new String( c);
99 const char *s = YYText();
100 mtor << "pitchmod:"<< YYText()<<eol;
101 yylval.string = new String (s);
105 yylval.i = strlen(YYText());
109 yylval.i = String(YYText()).value();
121 String s (YYText()+1);
122 s = s.left(s.len()-1);
123 yylval.string = new String(s);
127 return yylval.c = YYText()[0];
131 yy_push_state(quote);
134 yylval.string = new String (YYText());
137 mtor << "quoted string\n";
143 yylval.i = strlen(YYText());
147 yylval.i = String(YYText()).value();
150 <lyrics>{NOTECOMMAND} {
151 String c = YYText() +1;
152 mtor << "\\word: " << YYText()+1<<eol;
153 int l = lookup_keyword(c);
157 /* let's try passing tex's typesetting macros like \ss \alpha \c */
158 String* str_p = new String(YYText());//huh?
161 /* and skip identifiers...
162 Identifier * id = lookup_identifier(c);
167 String *sp = new String( c);
174 String s (YYText()+1);
175 s = s.left(s.len()-1);
176 yylval.string = new String(s);
182 while ((i=s.pos("_")) != 0) // change word binding "_" to " "
183 *(s.ch_l() + i - 1) = ' ';
184 if ((i=s.pos("\\,")) !=0) // change "\," to TeX's "\c "
186 *(s.ch_l() + i) = 'c';
187 s = s.left(i+1) + " " + s.right(s.len()-i-1);
189 yylval.string = new String(s);
201 <lyrics>[()\[\]|/.^>_-] {
202 return yylval.c = YYText()[0];
214 yyterminate(); // can't move this, since it actually rets a YY_NULL
221 <incl>[ \t]* { /* eat the whitespace */ }
222 <incl>\"[^"]*\"+ { /* got the include file name */
223 String s (YYText()+1);
224 s = s.left(s.len()-1);
225 defined_ch_c_l = here_ch_c_l() - String( YYText() ).len() - 1;
232 mtor << "word: " << YYText()<<eol;
234 int l = lookup_keyword(c);
237 Identifier * id = lookup_identifier(c);
242 String *sp = new String( c);
243 mtor << "new id: " << *sp << eol;
250 int cnv=sscanf (YYText(), "%lf", &r);
252 mtor << "REAL" << r<<'\n';
263 char c = YYText()[0];
264 mtor << "misc char" <<c<<"\n";
275 error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_c_l() );