From: fred Date: Sat, 2 Nov 1996 01:22:05 +0000 (+0000) Subject: lilypond-0.0.6 X-Git-Tag: release/1.5.59~6955 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7f22cb35022e7c83406ceea04ea1f303df230948;p=lilypond.git lilypond-0.0.6 --- diff --git a/parser.y b/parser.y index ebc4c54f8b..7e2be63a68 100644 --- 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 @@ -36,13 +37,15 @@ %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS +%token MELODICSTAFF %type unit -%token IDENTIFIER +%token IDENTIFIER +%token NEWIDENTIFIER %token PITCH DURATION RESTNAME %token REAL %token STRING - +%type declaration %type paper_block paper_body %type dim %type voice_block voice_body voice_elts voice_elts_dollar @@ -50,14 +53,28 @@ %type score_command %type score_block score_body %type staff_block rhythmstaff_block rhythmstaff_body +%type melodicstaff_block melodicstaff_body staffdecl %type int %type 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"; } diff --git a/score.cc b/score.cc index 3c95fd1790..097e2aa50d 100644 --- 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 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.