1 %{ // -*-Fundamental-*-
14 sstack<istream *> include_stack;
15 static int last_print;
16 const int DOTPRINT=50; // every 50 lines dots
29 NOTENAMEI A|B|C|D|E|F|G|As|Bes|Ces|Des|Es|Fes|Ges|Ais|Bis|Cis|Dis|Eis|Fis|Gis
30 NOTENAMEII a|b|c|d|e|f|g|as|bes|ces|des|es|fes|ges|ais|bis|cis|dis|eis|fis|gis
31 NOTENAMEIII Ases|Beses|Ceses|Deses|Eses|Feses|Geses|Aisis|Bisis|Cisis|Disis|Eisis|Fisis|Gisis
32 NOTENAMEIIII ases|beses|ceses|deses|eses|feses|geses|aisis|bisis|cisis|disis|eisis|fisis|gisis
34 NOTENAME {NOTENAMEI}|{NOTENAMEII}|{NOTENAMEIII}|{NOTENAMEIIII}
35 PITCH ['`]*{OPTSIGN}{NOTENAME}
38 FULLNOTE {PITCH}{DURATION}?
40 REAL [0-9]+(\.[0-9]*)?
45 BEGIN(notes); return '$';
49 const char *s = YYText();
50 yylval.string = new String (s);
51 mtor << "rest:"<< yylval.string;
55 const char *s = YYText();
56 yylval.string = new String (s);
57 mtor << "pitch:"<< *yylval.string;
61 yylval.string = new String (YYText());
72 BEGIN(INITIAL); return '$';
75 error("lexer error: illegal character found: " + String(YYText()));
82 yylval.string = new String (YYText());
94 int l = lookup_keyword(YYText());
96 yylval.id = lookup_identifier(YYText());
104 int cnv=sscanf (YYText(), "%lf", &r);
106 mtor << "token (REAL)" << r;
123 error("lexer error: illegal character '"+String(YYText()[0])+
130 yyFlexLexer *lexer=0;
132 // set the new input to s, remember old file.
141 newin = new ifstream( s ); //
144 error("cant open " + s);
145 cout << "["<<s<<flush;
147 include_stack.push(newin);
150 lexer = new yyFlexLexer;
151 lexer->set_debug( !monitor.silence("Lexer"));
154 lexer->switch_streams(newin);
158 // pop the inputstack.
163 istream *closing= include_stack.pop();
167 cout << "]" << flush;
169 if (include_stack.empty())
172 lexer->switch_streams(include_stack.top());
178 return lexer->yylex();
184 *mlog << "error in line " << lexer->lineno() << ": " << s << '\n';
192 yylval.string = new String (YYText());