]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.6
authorfred <fred>
Sat, 2 Nov 1996 01:22:05 +0000 (01:22 +0000)
committerfred <fred>
Sat, 2 Nov 1996 01:22:05 +0000 (01:22 +0000)
parser.y
score.cc

index ebc4c54f8b340dfc0f6e03a3fbf44950579c6daf..7e2be63a68bb279c649508c531ab22ddb4b37964 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -11,6 +11,7 @@
 #include "debug.hh"
 #include "parseconstruct.hh"
 #include "dimen.hh"
+#include "identifier.hh"
 
 #ifndef NDEBUG
 #define YYDEBUG 1
 
 %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
 %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS
+%token MELODICSTAFF
 
 %type <consstr> unit
-%token <id> IDENTIFIER
+%token <id>  IDENTIFIER
+%token <string> NEWIDENTIFIER 
 %token <string> PITCH DURATION RESTNAME
 %token <real> REAL
 %token <string> STRING
-
+%type <id> declaration 
 %type <paper> paper_block paper_body
 %type <real> dim
 %type <voice> voice_block voice_body voice_elts voice_elts_dollar
 %type <command> score_command
 %type <score> score_block score_body
 %type <staff> staff_block  rhythmstaff_block rhythmstaff_body
+%type <staff> melodicstaff_block melodicstaff_body staffdecl
 %type <i> int
 %type <scommands> score_commands_block score_commands_body
 
 %%
 
 mudela:        /* empty */
-       | score_block { 
-               add_score($1);
+       | mudela score_block { 
+               add_score($2);
+       }
+       | mudela add_declaration {      }
+       ;
+
+add_declaration: declaration   {
+               add_identifier($1);
+       }
+       ;
+
+declaration:
+       NEWIDENTIFIER '=' staff_block  {
+               $$ = new Staff_id(*$1, $3);
+               delete $1; // this sux
        }
        ;
 
@@ -86,7 +103,7 @@ paper_block:
 
 paper_body:
        /* empty */                     { $$ = new Paperdef; }
-       | paper_body WIDTH dim          { $$->width = $3;}
+       | paper_body WIDTH dim          { $$->linewidth = $3;}
        | paper_body OUTPUT STRING      { $$->outfile = *$3;
                delete $3;
        }
@@ -104,9 +121,16 @@ unit:      CM              { $$ = "cm"; }
        |PT             { $$ = "pt"; }
        ;
        
-
+/*
+       staff
+*/
 staff_block:
-       rhythmstaff_block
+       staffdecl
+       | rhythmstaff_block
+       | melodicstaff_block
+       ;
+
+staffdecl: STAFF '{' IDENTIFIER '}' { $$ = $3->staff(); }
        ;
 
 rhythmstaff_block:
@@ -118,6 +142,18 @@ rhythmstaff_body:
        | rhythmstaff_body voice_block  { $$->add_voice($2); }  
        ;
 
+melodicstaff_block:
+       MELODICSTAFF '{' melodicstaff_body '}'  { $$ = $3; }
+       ;
+
+melodicstaff_body:
+       /* empty */                     { $$ = get_new_melodicstaff(); }
+       | melodicstaff_body voice_block         { $$->add_voice($2); }  
+       ;
+
+/*
+       voice
+*/
 voice_block:
        VOICE '{' voice_body '}'        { $$ = $3; }
        ;
@@ -183,4 +219,5 @@ parse_file(String s)
 #endif
    new_input(s);
    yyparse();
+   *mlog << "\n";
 }
index 3c95fd179002bfd593583d0d3dcd908572beedc1..097e2aa50d12f1d936f4f25045437999d2fd8793 100644 (file)
--- a/score.cc
+++ b/score.cc
@@ -29,6 +29,7 @@ Score::output(String s)
 void
 Score::process()
 {
+    *mlog << "Processing ...";
     set(commands_->parse(last()));
     commands_->print();
     
@@ -40,7 +41,7 @@ Score::process()
     /// distribute commands to disciples
     distribute_commands();
     
-    pscore_ = new PScore;
+    pscore_ = new PScore(paper_);
     for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
        sc->set_output(pscore_);
        sc->process();
@@ -52,9 +53,11 @@ Score::process()
     clean_cols();
     OK();
     //    print();
+    *mlog << "Calculating ... ";
     pscore_->calc_breaking();
     // TODO: calculate vertical structs
     // TODO: calculate mixed structs.
+    *mlog << "\n";
 }
 
 // remove empty cols with no spacing attached.