]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.26
authorfred <fred>
Sun, 24 Mar 2002 19:30:04 +0000 (19:30 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:30:04 +0000 (19:30 +0000)
src/lexer.l
src/voice.cc

index dbe775560144c3e9df01111311d7dfc2132ab5ff..4446661d8ef426de46d9b525b50f34c33050038a 100644 (file)
@@ -17,6 +17,8 @@
 %option yylineno
 %option debug
 %option yyclass="My_flex_lexer"
+%option stack
+
 %x notes
 %x incl
 %x quote
@@ -30,7 +32,8 @@ N             [0-9]
 AN             {AA}|{N}
 PUNCT          [?!,.:;]
 ACCENT         [\\'"^]
-TEX            {AA}|-|{PUNCT}|{ACCENT}
+NATIONAL       [\241-\377]
+TEX            {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
 
 WORD           {A}{AN}*
 ALPHAWORD      {A}+
@@ -49,11 +52,11 @@ COMMENT             [%#].*\n
 %%
 
 \$             {
-       BEGIN(notes); 
+       yy_push_state(notes); 
 }
 
 \@             {
-       BEGIN(lyrics); 
+       yy_push_state(lyrics); 
 }
 
 <notes>{RESTNAME}      {
@@ -86,9 +89,8 @@ COMMENT               [%#].*\n
                return IDENTIFIER;
        }
        String *sp = new String( c);
-
        yylval.string=sp;
-       return NEWIDENTIFIER;
+       return STRING;
 }
 
 <notes>{PITCHMOD}      {
@@ -111,13 +113,9 @@ COMMENT            [%#].*\n
 
 }
 <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);
@@ -128,14 +126,14 @@ COMMENT           [%#].*\n
 }
 
 \"             {
-       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;
 }
 
@@ -155,7 +153,7 @@ COMMENT             [%#].*\n
                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...
@@ -167,10 +165,10 @@ COMMENT           [%#].*\n
        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);
@@ -204,7 +202,7 @@ COMMENT             [%#].*\n
 <lyrics>[ \t\n]+               {
 }
 <lyrics>@      {
-       BEGIN(INITIAL); 
+       yy_pop_state();
 }
 
 <<EOF>> {
@@ -215,13 +213,15 @@ COMMENT           [%#].*\n
 }
 
 
-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();
 }
 
 
@@ -239,7 +239,7 @@ include           { BEGIN(incl); }
        String *sp = new String( c);
        mtor << "new id: " << *sp << eol;
        yylval.string=sp;
-       return NEWIDENTIFIER;
+       return STRING;
 }
 
 {REAL}         {
index 334d1b4a5f6b5c2bce0adc89ac4a11eca5a71258..818e723b42972b35a11c5a42c588c7dacfbc25d3 100644 (file)
@@ -18,7 +18,7 @@ Voice::Voice()
 void
 Voice::add(Voice_element*v)
 {
-    v->voice_ = this;
+    v->voice_l_ = this;
     elts.bottom().add(v);
 }
 
@@ -59,9 +59,10 @@ void
 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);
 }
@@ -69,15 +70,15 @@ Voice_element::add(Request*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;
 }