#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
}
;
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;
}
|PT { $$ = "pt"; }
;
-
+/*
+ staff
+*/
staff_block:
- rhythmstaff_block
+ staffdecl
+ | rhythmstaff_block
+ | melodicstaff_block
+ ;
+
+staffdecl: STAFF '{' IDENTIFIER '}' { $$ = $3->staff(); }
;
rhythmstaff_block:
| 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; }
;
#endif
new_input(s);
yyparse();
+ *mlog << "\n";
}
void
Score::process()
{
+ *mlog << "Processing ...";
set(commands_->parse(last()));
commands_->print();
/// 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();
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.