1 %
{ // -*-Fundamental-*-
11 #include "parseconstruct.hh"
36 %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
37 %token CM IN PT MM PAPER WIDTH METER
40 %token
<id
> IDENTIFIER
41 %token
<string> PITCH DURATION RESTNAME
43 %token
<string> STRING
45 %type
<paper
> paper_block paper_body
47 %type
<voice
> voice_block voice_body voice_elts voice_elts_dollar
49 %type
<command
> score_command
50 %type
<score
> score_block score_body
51 %type
<staff
> staff_block rhythmstaff_block rhythmstaff_body
64 score_block: SCORE
'{' score_body
'}' { $$
= $3; }
67 score_body: { $$
= new Score
; }
68 | score_body staff_block
{ $$
->add
($2); }
69 | score_body score_command
{ $$
->add
($2); }
70 | score_body paper_block
{ delete $$
->paper
;
76 PAPER
'{' paper_body
'}' { $$
= $3; }
80 /* empty */ { $$
= new Paperdef
; }
81 | paper_body WIDTH dim
{ $$
->width
= $3;}
82 | paper_body OUTPUT STRING
{ $$
->outfile
= *$3;
88 REAL unit
{ $$
= convert_dimen
($1,$2); }
92 unit: CM
{ $$
= "cm"; }
104 RHYTHMSTAFF
'{' rhythmstaff_body
'}' { $$
= $3; }
108 /* empty */ { $$
= get_new_rhythmstaff
(); }
109 | rhythmstaff_body voice_block
{ $$
->add_voice
($2); }
113 VOICE
'{' voice_body
'}' { $$
= $3; }
118 REAL voice_elts_dollar
{ $$
= $2; $$
->start
= $1; }
119 | voice_elts_dollar
{ $$
= $1; }
123 '$' voice_elts
'$' { $$
= $2; }
130 | voice_elts voice_elt
{
136 PITCH DURATION
{ $$
= get_note_element
(*$1, *$2);
139 | RESTNAME DURATION
{ $$
= get_rest_element
(*$1, *$2);
146 $$
= get_bar_command
($2);
148 | METER REAL
int int {
149 $$
= get_meter_command
($2, $3, $4);
156 if
(ABS
($1-Real
(int($$
))) > 1e-8)
157 yyerror("expecting integer number");
167 *mlog
<< "Parsing ... ";
169 yydebug = !monitor.silence
("Parser");