1 %
{ // -*-Fundamental-*-
10 #include "scommands.hh"
12 #include "parseconstruct.hh"
26 Score_commands
*scommands
;
37 %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
38 %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS
41 %token
<id
> IDENTIFIER
42 %token
<string> PITCH DURATION RESTNAME
44 %token
<string> STRING
46 %type
<paper
> paper_block paper_body
48 %type
<voice
> voice_block voice_body voice_elts voice_elts_dollar
50 %type
<command
> score_command
51 %type
<score
> score_block score_body
52 %type
<staff
> staff_block rhythmstaff_block rhythmstaff_body
54 %type
<scommands
> score_commands_block score_commands_body
65 score_block: SCORE
'{' score_body
'}' { $$
= $3; }
68 score_body: { $$
= new Score
; }
69 | score_body staff_block
{ $$
->add
($2); }
70 | score_body score_commands_block
{ $$
->set
($2); }
71 | score_body paper_block
{ $$
->set
($2); }
74 COMMANDS
'{' score_commands_body
'}' { $$
=$3;}
77 score_commands_body: { $$
= new Score_commands
; }
78 | score_commands_body score_command
{
84 PAPER
'{' paper_body
'}' { $$
= $3; }
88 /* empty */ { $$
= new Paperdef
; }
89 | paper_body WIDTH dim
{ $$
->width
= $3;}
90 | paper_body OUTPUT STRING
{ $$
->outfile
= *$3;
93 | paper_body UNITSPACE dim
{ $$
->whole_width
= $3; }
97 REAL unit
{ $$
= convert_dimen
($1,$2); }
101 unit: CM
{ $$
= "cm"; }
113 RHYTHMSTAFF
'{' rhythmstaff_body
'}' { $$
= $3; }
117 /* empty */ { $$
= get_new_rhythmstaff
(); }
118 | rhythmstaff_body voice_block
{ $$
->add_voice
($2); }
122 VOICE
'{' voice_body
'}' { $$
= $3; }
127 REAL voice_elts_dollar
{ $$
= $2; $$
->start
= $1; }
128 | voice_elts_dollar
{ $$
= $1; }
132 '$' voice_elts
'$' { $$
= $2; }
139 | voice_elts voice_elt
{
145 PITCH DURATION
{ $$
= get_note_element
(*$1, *$2);
148 | RESTNAME DURATION
{ $$
= get_rest_element
(*$1, *$2);
155 $$
= get_skip_command
($2, $4);
158 $$
= get_meterchange_command
($2, $3);
160 /* | PARTIALMEASURE REAL {
161 $$ = get_partial_command($2);
169 if
(ABS
($1-Real
(int($$
))) > 1e-8)
170 yyerror("expecting integer number");
180 *mlog
<< "Parsing ... ";
182 yydebug = !monitor.silence
("Parser");