1 %{ // -*-Fundamental-*-
14 sstack<istream *> include_stack;
15 static int last_print;
16 const int DOTPRINT=50; // every 50 lines dots
28 NOTENAMEI A|B|C|D|E|F|G|As|Bes|Ces|Des|Es|Fes|Ges|Ais|Bis|Cis|Dis|Eis|Fis|Gis
29 NOTENAMEII a|b|c|d|e|f|g|as|bes|ces|des|es|fes|ges|ais|bis|cis|dis|eis|fis|gis
30 NOTENAMEIII Ases|Beses|Ceses|Deses|Eses|Feses|Geses|Aisis|Bisis|Cisis|Disis|Eisis|Fisis|Gisis
31 NOTENAMEIIII ases|beses|ceses|deses|eses|feses|geses|aisis|bisis|cisis|disis|eisis|fisis|gisis
33 NOTENAME {NOTENAMEI}|{NOTENAMEII}|{NOTENAMEIII}|{NOTENAMEIIII}
34 PITCH ['`]*{OPTSIGN}{NOTENAME}
37 FULLNOTE {PITCH}{DURATION}?
39 REAL [0-9]+(\.[0-9]*)?
44 BEGIN(notes); return '$';
48 const char *s = YYText();
49 yylval.string = new String (s);
50 if (debug_flags & DEBUGTOKEN)
51 mtor << "rest:"<< yylval.string;
55 const char *s = YYText();
56 yylval.string = new String (s);
57 if (debug_flags & DEBUGTOKEN)
58 mtor << "pitch:"<< yylval.string;
62 yylval.string = new String (YYText());
73 BEGIN(INITIAL); return '$';
76 cout << "SCANNER <notes> HOLE `" << YYText()<<'\''<<endl;
84 int l = lookup_keyword(YYText());
86 yylval.id = lookup_identifier(YYText());
94 sscanf (YYText(), "%lf", &r);
100 if (debug_flags & DEBUGTOKEN)
111 error("lexer error: illegal character '"+String(YYText()[0])+
118 yyFlexLexer *lexer=0;
120 // set the new input to s, remember old file.
129 newin = new ifstream( s ); //
132 error("cant open " + s);
133 cout << "["<<s<<flush;
135 include_stack.push(newin);
138 lexer = new yyFlexLexer;
139 lexer->set_debug( bool(debug_flags & DEBUGPARSER));
142 lexer->switch_streams(newin);
146 // pop the inputstack.
151 istream *closing= include_stack.pop();
155 cout << "]" << flush;
157 if (include_stack.empty())
160 lexer->switch_streams(include_stack.top());
166 return lexer->yylex();
172 *mlog << "error in line " << lexer->lineno() << ": " << s << '\n';
180 yylval.string = new String (YYText());