1 %{ // -*-Fundamental-*-
19 %option yyclass="My_flex_lexer"
33 TEX {AA}|-|{PUNCT}|{ACCENT}
41 PITCHMOD ['`]*{OPTSIGN}
60 const char *s = YYText();
61 yylval.string = new String (s);
62 mtor << "rest:"<< yylval.string;
68 lookup_notename(p[0], p[1], YYText());
69 mtor << "notename: "<< YYText()<<eol;
71 String e("notename does not exist: ");
77 <notes>{NOTECOMMAND} {
78 String c = YYText() +1;
79 mtor << "\\word: " << YYText()+1<<eol;
80 int l = lookup_keyword(c);
83 Identifier * id = lookup_identifier(c);
88 String *sp = new String( c);
95 const char *s = YYText();
96 mtor << "pitchmod:"<< YYText()<<eol;
97 yylval.string = new String (s);
101 yylval.i = strlen(YYText());
105 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];
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());
161 /* and skip identifiers...
162 Identifier * id = lookup_identifier(c);
167 String *sp = new String( c);
170 return NEWIDENTIFIER;
174 String s (YYText()+1);
175 s = s.left(s.len()-1);
176 yylval.string = new String(s);
182 while ((i=s.pos("_")) != 0)// ugh. Whats this.
183 *((char*)s.cptr() + i - 1) = ' ';
184 if ((i=s.pos("\\,")) !=0)
186 *((char*)s.cptr() + 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
218 include { BEGIN(incl); }
219 <incl>[ \t]* { /* eat the whitespace */ }
220 <incl>\"[^"]*\"+ { /* got the include file name */
221 String s (YYText()+1);
222 s = s.left(s.len()-1);
229 mtor << "word: " << YYText()<<eol;
231 int l = lookup_keyword(c);
234 Identifier * id = lookup_identifier(c);
239 String *sp = new String( c);
240 mtor << "new id: " << *sp << eol;
242 return NEWIDENTIFIER;
247 int cnv=sscanf (YYText(), "%lf", &r);
249 mtor << "REAL" << r<<'\n';
260 char c = YYText()[0];
261 mtor << "misc char" <<c<<"\n";
272 error("lexer error: illegal character '"+String(YYText()[0])+