%option yylineno
%option debug
%option yyclass="My_flex_lexer"
+%option stack
+
%x notes
%x incl
%x quote
AN {AA}|{N}
PUNCT [?!,.:;]
ACCENT [\\'"^]
-TEX {AA}|-|{PUNCT}|{ACCENT}
+NATIONAL [\241-\377]
+TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
WORD {A}{AN}*
ALPHAWORD {A}+
%%
\$ {
- BEGIN(notes);
+ yy_push_state(notes);
}
\@ {
- BEGIN(lyrics);
+ yy_push_state(lyrics);
}
<notes>{RESTNAME} {
return IDENTIFIER;
}
String *sp = new String( c);
-
yylval.string=sp;
- return NEWIDENTIFIER;
+ return STRING;
}
<notes>{PITCHMOD} {
}
<notes>\$ {
- BEGIN(INITIAL);
+ yy_pop_state();
}
-<notes>[{}] {
- return YYText()[0];
-
-}
-<notes>\"[^\"]*\" {
+<notes>\"[^"]*\" {
String s (YYText()+1);
s = s.left(s.len()-1);
yylval.string = new String(s);
}
\" {
- BEGIN(quote);
+ yy_push_state(quote);
}
-<quote>[^\"]* {
+<quote>[^"]* {
yylval.string = new String (YYText());
}
<quote>\" {
mtor << "quoted string\n";
- BEGIN(INITIAL);
+ yy_pop_state();
return STRING;
}
return l;
/* let's try passing tex's typesetting macros like \ss \alpha \c */
- String* str_p = new String(YYText());
+ String* str_p = new String(YYText());//huh?
return STRING;
/* and skip identifiers...
String *sp = new String( c);
yylval.string=sp;
- return NEWIDENTIFIER;
+ return STRING;
*/
}
-<lyrics>\"[^\"]*\" {
+<lyrics>\"[^"]*\" {
String s (YYText()+1);
s = s.left(s.len()-1);
yylval.string = new String(s);
<lyrics>[ \t\n]+ {
}
<lyrics>@ {
- BEGIN(INITIAL);
+ yy_pop_state();
}
<<EOF>> {
}
-include { BEGIN(incl); }
+include {
+ yy_push_state(incl);
+}
<incl>[ \t]* { /* eat the whitespace */ }
<incl>\"[^"]*\"+ { /* got the include file name */
String s (YYText()+1);
s = s.left(s.len()-1);
new_input(s);
- BEGIN(INITIAL);
+ yy_pop_state();
}
String *sp = new String( c);
mtor << "new id: " << *sp << eol;
yylval.string=sp;
- return NEWIDENTIFIER;
+ return STRING;
}
{REAL} {
void
Voice::add(Voice_element*v)
{
- v->voice_ = this;
+ v->voice_l_ = this;
elts.bottom().add(v);
}
Voice_element::add(Request*r)
{
if (r->rhythmic()) {
- assert (!duration);
+ assert (!duration || duration == r->duration());
duration = r->duration();
}
+
r->elt_l_ = this;
reqs.bottom().add(r);
}
Voice_element::Voice_element()
{
- voice_ = 0;
- group = 0;
+ voice_l_ = 0;
+// group = 0;
duration = 0.0;
}
Voice_element::Voice_element(Voice_element const&src)
{
- voice_=src.voice_;
+ voice_l_=0;
for (iter_top(src.reqs, i); i.ok(); i++)
add(i->clone());
- group=src.group;
+// group=src.group;
}