1 %{ // -*-Fundamental-*-
11 #include "inputscore.hh"
21 %option yyclass="My_flex_lexer"
38 TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
46 PITCHMOD ['`]*{OPTSIGN}
62 yy_push_state(lyrics);
66 const char *s = YYText();
67 yylval.string = new String (s);
68 mtor << "rest:"<< yylval.string;
73 return ret_notename(p, YYText(), -1);
78 return ret_notename(p, YYText(), 0);
81 <notes>{NOTECOMMAND} {
82 String c = YYText() +1;
83 mtor << "\\word: " << YYText()+1<<eol;
84 int l = lookup_keyword(c);
87 Identifier * id = lookup_identifier(c);
92 String *sp = new String( c);
98 const char *s = YYText();
99 mtor << "pitchmod:"<< YYText()<<eol;
100 yylval.string = new String (s);
104 yylval.i = strlen(YYText());
108 yylval.i = String(YYText()).value();
120 String s (YYText()+1);
121 s = s.left(s.len()-1);
122 yylval.string = new String(s);
126 return yylval.c = YYText()[0];
130 yy_push_state(quote);
133 yylval.string = new String (YYText());
136 mtor << "quoted string\n";
142 yylval.i = strlen(YYText());
146 yylval.i = String(YYText()).value();
149 <lyrics>{NOTECOMMAND} {
150 String c = YYText() +1;
151 mtor << "\\word: " << YYText()+1<<eol;
152 int l = lookup_keyword(c);
156 /* let's try passing tex's typesetting macros like \ss \alpha \c */
157 String* str_p = new String(YYText());//huh?
160 /* and skip identifiers...
161 Identifier * id = lookup_identifier(c);
166 String *sp = new String( c);
173 String s (YYText()+1);
174 s = s.left(s.len()-1);
175 yylval.string = new String(s);
181 while ((i=s.pos("_")) != 0)// ugh. Whats this.
182 *((char*)s.cptr() + i - 1) = ' ';
183 if ((i=s.pos("\\,")) !=0)
185 *((char*)s.cptr() + i) = 'c';
186 s = s.left(i+1) + " " + s.right(s.len()-i-1);
188 yylval.string = new String(s);
200 <lyrics>[()\[\]|/.^>_-] {
201 return yylval.c = YYText()[0];
213 yyterminate(); // can't move this, since it actually rets a YY_NULL
220 <incl>[ \t]* { /* eat the whitespace */ }
221 <incl>\"[^"]*\"+ { /* got the include file name */
222 String s (YYText()+1);
223 s = s.left(s.len()-1);
230 mtor << "word: " << YYText()<<eol;
232 int l = lookup_keyword(c);
235 Identifier * id = lookup_identifier(c);
240 String *sp = new String( c);
241 mtor << "new id: " << *sp << eol;
248 int cnv=sscanf (YYText(), "%lf", &r);
250 mtor << "REAL" << r<<'\n';
261 char c = YYText()[0];
262 mtor << "misc char" <<c<<"\n";
273 // error( "lexer error: illegal character '"+String(YYText()[0])+ "' encountered");
274 error( String( "illegal character: " ) + String( YYText()[0] ) + ": ",