]> git.donarmstrong.com Git - lilypond.git/blob - lily/parser.yy
release: 1.3.55
[lilypond.git] / lily / parser.yy
1 %{ // -*-Fundamental-*-
2
3 /*
4   parser.yy -- Bison/C++ parser for mudela
5
6   source file of the GNU LilyPond music typesetter
7
8   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9            Jan Nieuwenhuizen <janneke@gnu.org>
10 */
11
12 #include <iostream.h>
13 #include "lily-guile.hh"
14 #include "translation-property.hh"
15 #include "lookup.hh"
16 #include "misc.hh"
17 #include "my-lily-lexer.hh"
18 #include "paper-def.hh"
19 #include "midi-def.hh"
20 #include "main.hh"
21 #include "file-path.hh"
22 #include "debug.hh"
23 #include "dimensions.hh"
24 #include "identifier.hh"
25 #include "command-request.hh"
26 #include "musical-request.hh"
27 #include "my-lily-parser.hh"
28 #include "context-specced-music.hh"
29 #include "translator-group.hh"
30 #include "score.hh"
31 #include "music-list.hh"
32 #include "change-translator.hh"
33 #include "file-results.hh"
34 #include "scope.hh"
35 #include "relative-music.hh"
36 #include "lyric-combine-music.hh"
37 #include "transposed-music.hh"
38 #include "time-scaled-music.hh"
39 #include "repeated-music.hh"
40 #include "mudela-version.hh"
41 #include "grace-music.hh"
42 #include "auto-change-music.hh"
43 #include "output-property.hh"
44
45 bool
46 is_duration_b (int t)
47 {
48   return t && t == 1 << intlog2(t);
49 }
50
51
52 // mmm JUNKME ?
53 Mudela_version oldest_version ("1.3.42");
54
55 void
56 print_mudela_versions (ostream &os)
57 {
58   os << _f ("Oldest supported input version: %s", oldest_version.str ()) 
59     << endl;
60 }
61
62
63 // needed for bison.simple's malloc() and free()
64 #include <malloc.h>
65
66 #ifndef NDEBUG
67 #define YYDEBUG 1
68 #endif
69
70 #define YYERROR_VERBOSE 1
71
72 #define YYPARSE_PARAM my_lily_parser_l
73 #define YYLEX_PARAM my_lily_parser_l
74 #define THIS ((My_lily_parser *) my_lily_parser_l)
75
76 #define yyerror THIS->parser_error
77 #define ARRAY_SIZE(a,s)   if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
78
79 %}
80
81
82 %union {
83     Array<Musical_pitch> *pitch_arr;
84     Link_array<Request> *reqvec;
85     Array<int> *intvec;
86     Duration *duration;
87     Identifier *id;
88     String * string;
89     Music *music;
90     Music_list *music_list;
91     Score *score;
92     Scope *scope;
93     Interval *interval;
94     Musical_req* musreq;
95     Music_output_def * outputdef;
96     Musical_pitch * pitch;
97     Midi_def* midi;
98     Moment *moment;
99     Paper_def *paper;
100     Real real;
101     Request * request;
102
103     /* We use SCMs to do strings, because it saves us the trouble of
104 deleting them.  Let's hope that a stack overflow doesnt trigger a move
105 of the parse stack onto the heap. */
106     SCM scm;
107
108     Tempo_req *tempo;
109     Translator_group* trans;
110     int i;
111 }
112 %{
113
114 int
115 yylex (YYSTYPE *s,  void * v_l)
116 {
117         My_lily_parser   *pars_l = (My_lily_parser*) v_l;
118         My_lily_lexer * lex_l = pars_l->lexer_p_;
119
120         lex_l->lexval_l = (void*) s;
121         return lex_l->yylex ();
122 }
123
124
125 %}
126
127 %pure_parser
128
129 /* tokens which are not keywords */
130 %token AUTOCHANGE
131 %token TEXTSCRIPT
132 %token ACCEPTS
133 %token ALTERNATIVE
134 %token BAR
135 %token BREATHE
136 %token CHORDMODIFIERS
137 %token CHORDS
138 %token CHAR_T
139 %token CLEF
140 %token CM_T
141 %token CONSISTS
142 %token SEQUENTIAL
143 %token SIMULTANEOUS
144 %token CONSISTSEND
145 %token DURATION
146 %token EXTENDER
147 %token FONT
148 %token GRACE
149 %token HEADER
150 %token HYPHEN
151 %token IN_T
152 %token INVALID
153 %token KEY
154 %token KEYSIGNATURE
155 %token LYRICS
156 %token MARK
157 %token MEASURES
158 %token MIDI
159 %token MM_T
160 %token MUSICAL_PITCH
161 %token NAME
162 %token NOTENAMES
163 %token NOTES
164 %token PAPER
165 %token PARTIAL
166 %token PENALTY
167 %token PROPERTY
168 %token PT_T
169 %token RELATIVE
170 %token REMOVE
171 %token REPEAT
172 %token REPETITIONS
173 %token ADDLYRICS
174 %token SCM_T
175 %token SCORE
176 %token SCRIPT
177 %token SKIP
178 %token SPANREQUEST
179 %token COMMANDSPANREQUEST
180 %token TEMPO
181 %token OUTPUTPROPERTY
182 %token TIME_T
183 %token TIMES
184 %token TRANSLATOR
185 %token TRANSPOSE
186 %token TYPE
187 %token CONTEXT
188
189 /* escaped */
190 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER 
191 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET 
192
193 %type <i>       exclamations questions
194 %token <i>      DIGIT
195 %token <pitch>  NOTENAME_PITCH
196 %token <pitch>  TONICNAME_PITCH
197 %token <pitch>  CHORDMODIFIER_PITCH
198 %token <id>     DURATION_IDENTIFIER
199 %token <id>     IDENTIFIER
200 %token <id>     MUSIC_IDENTIFIER
201 %token <id>     REQUEST_IDENTIFIER
202 %token <id>     REAL_IDENTIFIER
203 %token <id>     STRING_IDENTIFIER
204 %token <id>     TRANS_IDENTIFIER
205 %token <id>     INT_IDENTIFIER
206 %token <id>     SCORE_IDENTIFIER
207 %token <id>     MIDI_IDENTIFIER
208 %token <id>     PAPER_IDENTIFIER
209 %token <real>   REAL
210 %token <scm>    DURATION RESTNAME
211 %token <scm>    STRING
212 %token <scm>    SCM_T
213 %token <i>      UNSIGNED
214
215
216 %type <outputdef> output_def
217 %type <scope>   mudela_header mudela_header_body
218 %type <request> open_request_parens close_request_parens open_request close_request
219 %type <request> request_with_dir request_that_take_dir verbose_request
220 %type <i>       sub_quotes sup_quotes
221 %type <music>   simple_element  request_chord command_element Simple_music  Composite_music 
222 %type <music>   Alternative_music Repeated_music
223 %type <i>       tremolo_type
224 %type <i>       int unsigned
225 %type <i>       script_dir
226 %type <i>       optional_modality 
227 %type <id>      identifier_init  
228 %type <duration> steno_duration optional_notemode_duration
229 %type <duration> entered_notemode_duration explicit_duration
230 %type <intvec>   int_list
231 %type <reqvec>  pre_requests post_requests
232 %type <request> gen_text_def
233 %type <pitch>   steno_musical_pitch musical_pitch absolute_musical_pitch
234 %type <pitch>   steno_tonic_pitch
235
236 %type <pitch_arr>       pitch_list chord_additions chord_subtractions chord_notes chord_step
237 %type <music>   chord
238 %type <pitch>   chord_note chord_inversion chord_bass
239 %type <midi>    midi_block midi_body
240 %type <duration>        duration_length
241
242 %type <scm>  embedded_scm scalar
243 %type <music>   Music Sequential_music Simultaneous_music Music_sequence
244 %type <music>   relative_music re_rhythmed_music
245 %type <music>   property_def translator_change
246 %type <music_list> Music_list
247 %type <paper>   paper_block paper_def_body
248 %type <real>    real real_with_dimension
249 %type <request> shorthand_command_req
250 %type <request> post_request 
251 %type <request> command_req verbose_command_req
252 %type <request> extender_req
253 %type <request> hyphen_req
254 %type <scm>     string
255 %type <score>   score_block score_body
256
257 %type <trans>   translator_spec_block translator_spec_body
258 %type <tempo>   tempo_request
259 %type <scm> notenames_body notenames_block chordmodifiers_block
260 %type <scm>     script_abbreviation
261
262
263
264 %left '-' '+'
265 %left '*' '/'
266 %left UNARY_MINUS
267
268 %%
269
270 mudela: /* empty */
271         | mudela toplevel_expression {}
272         | mudela assignment  { }
273         | mudela error
274         | mudela INVALID        {
275                 THIS->error_level_i_  =1;
276         }
277         ;
278
279 toplevel_expression:
280         notenames_block                 {
281                 THIS->lexer_p_->pitchname_tab_ =  $1;
282         }
283         | chordmodifiers_block                  {
284                 THIS->lexer_p_->chordmodifier_tab_  = $1;
285         }
286         | mudela_header {
287                 delete header_global_p;
288                 header_global_p = $1;
289         }
290         | score_block {
291                 score_global_array.push ($1);
292         }
293         | paper_block {
294                 Identifier * id = new
295                         Paper_def_identifier ($1, PAPER_IDENTIFIER);
296                 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
297         }
298         | midi_block {
299                 Identifier * id = new
300                         Midi_def_identifier ($1, MIDI_IDENTIFIER);
301                 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
302         }
303         | embedded_scm {
304                 // junk value
305         }       
306         ;
307
308 embedded_scm:
309         SCM_T
310         ;
311
312
313 chordmodifiers_block:
314         CHORDMODIFIERS notenames_body   {  $$ = $2; }
315         ;
316
317
318 notenames_block:
319         NOTENAMES notenames_body   {  $$ = $2; }
320         ;
321
322
323
324 notenames_body:
325         embedded_scm    {
326           int i = scm_ilength ($1);
327
328           SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
329           for (SCM s = $1; s != SCM_EOL; s = gh_cdr (s)) {
330                 SCM pt = gh_cdar (s);
331                 if (scm_ilength (pt) != 3)
332                         THIS->parser_error ("Need three args");
333                 scm_hashq_set_x (tab, gh_caar(s), pt);
334           }
335
336           $$ = tab;
337         }
338         ;
339
340 mudela_header_body:
341         {
342                 $$ = new Scope;
343                 THIS->lexer_p_-> scope_l_arr_.push ($$);
344         }
345         | mudela_header_body assignment semicolon { 
346
347         }
348         ;
349
350 mudela_header:
351         HEADER '{' mudela_header_body '}'       {
352                 $$ = $3;
353                 THIS->lexer_p_-> scope_l_arr_.pop ();           
354         }
355         ;
356
357
358 /*
359         DECLARATIONS
360 */
361 assignment:
362         STRING {
363                 THIS->remember_spot ();
364         }
365         /* cont */ '=' identifier_init  {
366             THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
367
368             $4->set_spot (THIS->pop_spot ());
369         }
370         ;
371
372
373
374 identifier_init:
375         score_block {
376                 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
377
378         }
379         | paper_block {
380                 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
381         }
382         | midi_block {
383                 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
384
385         }
386         | translator_spec_block {
387                 $$ = new Translator_group_identifier ($1, TRANS_IDENTIFIER);
388         }
389         | Music  {
390                 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
391         }
392
393         | post_request {
394                 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
395         }
396         | explicit_duration {
397                 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
398         }
399         | real {
400                 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
401         }
402         | string {
403                 $$ = new String_identifier (new String (ly_scm2string ($1)), STRING_IDENTIFIER);
404         }
405         | int   {
406                 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
407         }
408         ;
409
410 translator_spec_block:
411         TRANSLATOR '{' translator_spec_body '}'
412                 {
413                 $$ = $3;
414         }
415         ;
416
417 translator_spec_body:
418         TRANS_IDENTIFIER        {
419                 $$ = $1->access_content_Translator_group (true);
420                 $$-> set_spot (THIS->here_input ());
421         }
422         | TYPE STRING semicolon {
423                 Translator* t = get_translator_l (ly_scm2string ($2));
424                 Translator_group * tg = dynamic_cast<Translator_group*> (t);
425
426                 if (!tg)
427                         THIS->parser_error (_("Need a translator group for a context"));
428                 
429                 tg = dynamic_cast<Translator_group*> (t->clone ());
430                 tg->set_spot (THIS->here_input ());
431                 $$ = tg;
432         }
433         | translator_spec_body STRING '=' embedded_scm                  {
434                 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
435                 tg->set_property (ly_scm2string ($2), $4);
436         }
437         | translator_spec_body STRING '=' identifier_init semicolon     { 
438                 Identifier* id = $4;
439                 String_identifier *s = dynamic_cast<String_identifier*> (id);
440                 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
441                 int_identifier *i = dynamic_cast<int_identifier*> (id);
442         
443                 SCM v;
444                 if (s) v = ly_str02scm (s->access_content_String (false)->ch_C());
445                 if (i) v = gh_int2scm (*i->access_content_int (false));
446                 if (r) v = gh_double2scm (*r->access_content_Real (false));
447                 if (!s && !i && !r)
448                         THIS->parser_error (_("Wrong type for property value"));
449
450                 delete $4;
451                 /* ugh*/
452                 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
453                 
454                 tg->set_property (ly_scm2string ($2), v);
455         }
456         | translator_spec_body NAME STRING semicolon {
457                 $$->type_str_ = ly_scm2string ($3);
458         }
459         | translator_spec_body CONSISTS STRING semicolon {
460                 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
461         }
462         | translator_spec_body CONSISTSEND STRING semicolon {
463                 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
464         }
465         | translator_spec_body ACCEPTS STRING semicolon {
466                 dynamic_cast<Translator_group*> ($$)-> set_acceptor (ly_scm2string ($3), true);
467         }
468         | translator_spec_body REMOVE STRING semicolon {
469                 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), false);
470         }
471         ;
472
473 /*
474         SCORE
475 */
476 score_block:
477         SCORE { 
478         }
479         /*cont*/ '{' score_body '}'     {
480                 $$ = $4;
481                 if (!$$->def_p_arr_.size ())
482                 {
483                   Identifier *id =
484                         THIS->lexer_p_->lookup_identifier ("$defaultpaper");
485                   $$->add_output (id ? id->access_content_Paper_def (true) : new Paper_def );
486                 }
487         }
488         ;
489
490 score_body:
491         Music   {
492                 $$ = new Score;
493                 $$->set_spot (THIS->here_input ());
494                 $$->music_p_ = $1;
495         }
496         | SCORE_IDENTIFIER {
497                 $$ = $1->access_content_Score (true);
498         }
499         | score_body mudela_header      {
500                 $$->header_p_ = $2;
501         }
502         | score_body output_def {
503                 $$->add_output ($2);
504         }
505         | score_body error {
506
507         }
508         ;
509
510 output_def:
511         paper_block {
512                 $$ = $1;
513         }
514         |  midi_block           {
515                 $$= $1;
516         }
517         ;
518
519
520 /*
521         PAPER
522 */
523 paper_block:
524         PAPER '{' paper_def_body '}'    { 
525                 $$ = $3;
526                 THIS-> lexer_p_->scope_l_arr_.pop ();
527         }
528         ;
529
530
531 paper_def_body:
532         /* empty */                     {
533                   Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultpaper");
534                   Paper_def *p = id ? id->access_content_Paper_def (true) : new Paper_def;
535                 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
536                 $$ = p;
537         }
538         | PAPER_IDENTIFIER      {
539                 Paper_def *p = $1->access_content_Paper_def (true);
540                 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
541                 $$ = p;
542         }
543         | paper_def_body int '=' FONT STRING            { // ugh, what a syntax
544                 Lookup * l = new Lookup;
545                 l->font_name_ = ly_scm2string ($5);
546                 $$->set_lookup ($2, l);
547         }
548         | paper_def_body assignment semicolon {
549                 
550         }
551         | paper_def_body translator_spec_block {
552                 $$->assign_translator ($2);
553         }
554         | paper_def_body error {
555
556         }
557         ;
558
559
560
561 real_with_dimension:
562         REAL CM_T       {
563                 $$ = $1 CM;
564         }
565         | REAL PT_T     {
566                 $$ = $1 PT;
567         }
568         | REAL IN_T     {
569                 $$ = $1 INCH;
570         }
571         | REAL MM_T     {
572                 $$ = $1 MM;
573         }
574         | REAL CHAR_T   {
575                 $$ = $1 CHAR;
576         }
577         ;
578
579 real:
580         REAL            {
581                 $$ = $1;
582         }
583         | real_with_dimension
584         | REAL_IDENTIFIER               {
585                 $$= *$1->access_content_Real (false);
586         }
587         | '-'  real %prec UNARY_MINUS {
588                 $$ = -$2;
589         }
590         | real '*' real {
591                 $$ = $1 * $3;
592         }
593         | real '/' real {
594                 $$ = $1 / $3;
595         }
596         | real '+' real {
597                 $$ = $1  + $3;
598         }
599         | real '-' real {
600                 $$ = $1 - $3;
601         }
602         | '(' real ')'  {
603                 $$ = $2;
604         }
605         ;
606                 
607 /*
608         MIDI
609 */
610 midi_block:
611         MIDI
612         '{' midi_body '}'       {
613                 $$ = $3;
614                 THIS-> lexer_p_-> scope_l_arr_.pop();
615         }
616         ;
617
618 midi_body: /* empty */          {
619          Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultmidi");
620          Midi_def* p = id
621                 ? id->access_content_Midi_def (true) : new Midi_def ;
622
623          $$ = p;
624          THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
625         }
626         | MIDI_IDENTIFIER       {
627                 Midi_def * p =$1-> access_content_Midi_def (true);
628                 $$ = p;
629                 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
630         }
631         | midi_body assignment semicolon {
632
633         }
634         | midi_body translator_spec_block       {
635                 $$-> assign_translator ($2);
636         }
637         | midi_body tempo_request semicolon {
638                 /*
639                         junk this ? there already is tempo stuff in
640                         music.
641                 */
642                 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
643                 delete $2;
644         }
645         | midi_body error {
646
647         }
648         ;
649
650 tempo_request:
651         TEMPO steno_duration '=' unsigned       {
652                 $$ = new Tempo_req;
653                 $$->dur_ = *$2;
654                 delete $2;
655                 $$-> metronome_i_ = $4;
656         }
657         ;
658
659 Music_list: /* empty */ {
660                 $$ = new Music_list;
661                 $$->set_spot (THIS->here_input ());
662         }
663         | Music_list Music {
664                 $$->add_music ($2);
665         }
666         | Music_list error {
667         }
668         ;
669
670
671 Music:
672         Simple_music
673         | Composite_music
674         ;
675
676 Alternative_music:
677         /* empty */ {
678                 $$ = 0;
679         }
680         | ALTERNATIVE Music_sequence {
681                 $$ = $2;
682                 $2->set_spot (THIS->here_input ());
683         }
684         ;
685
686
687
688
689 Repeated_music:
690         REPEAT STRING unsigned Music Alternative_music
691         {
692                 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
693                 if (m && $3 < m->length_i ())
694                         $5->warning (_ ("More alternatives than repeats.  Junking excess alternatives."));
695
696                 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
697                 $$ = r;
698                 r->type_ = ly_scm2string ($2);
699                 r->fold_b_ = (r->type_ == "fold");
700                 r->volta_fold_b_ =  (r->type_ == "volta");
701                 r->set_spot ($4->spot  ());
702         }
703         ;
704
705 Music_sequence: '{' Music_list '}'      {
706                 $$ = new Music_sequence ($2);
707                 $$->set_spot ($2->spot ());
708         }
709         ;
710
711 Sequential_music:
712         SEQUENTIAL '{' Music_list '}'           {
713                 $$ = new Sequential_music ($3);
714                 $$->set_spot ($3->spot ());
715         }
716         | '{' Music_list '}'            {
717                 $$ = new Sequential_music ($2);
718                 $$->set_spot ($2->spot ());
719         }
720         ;
721
722 Simultaneous_music:
723         SIMULTANEOUS '{' Music_list '}'{
724                 $$ = new Simultaneous_music ($3);
725                 $$->set_spot ($3->spot ());
726         }
727         | '<' Music_list '>'    {
728                 $$ = new Simultaneous_music ($2);
729                 $$->set_spot ($2->spot ());
730         }
731         ;
732
733 Simple_music:
734         request_chord           { $$ = $1; }
735         | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm     {
736                 SCM pred = $2;
737                 if (!gh_symbol_p ($3))
738                 {
739                         THIS->parser_error (_("Second argument must be a symbol")); 
740                 }
741                 /*hould check # args */
742                 if (!gh_procedure_p (pred))
743                 {
744                         THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
745                 }
746         
747                 $$ = new Output_property (pred,$3, $5);
748         }
749         | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
750         | property_def
751         | translator_change
752         | Simple_music '*' unsigned '/' unsigned        {
753                 $$ = $1;
754                 $$->compress (Moment($3, $5 ));
755         }
756         | Simple_music '*' unsigned              {
757                 $$ = $1;
758                 $$->compress (Moment ($3, 1));
759         }
760         ;
761
762
763 Composite_music:
764         CONTEXT STRING Music    {
765                 Context_specced_music *csm =  new Context_specced_music ($3);
766
767                 csm->translator_type_str_ = ly_scm2string ($2);
768                 csm->translator_id_str_ = "";
769
770
771                 $$ = csm;
772         }
773         | AUTOCHANGE STRING Music       {
774                 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
775
776                 $$ = chm;
777                 chm->set_spot ($3->spot ());
778         }
779         | GRACE Music {
780                 $$ = new Grace_music ($2);
781         }
782         | CONTEXT STRING '=' STRING Music {
783                 Context_specced_music *csm =  new Context_specced_music ($5);
784
785                 csm->translator_type_str_ = ly_scm2string ($2);
786                 csm->translator_id_str_ = ly_scm2string ($4);
787
788                 $$ = csm;
789         }
790         | TIMES {
791                 THIS->remember_spot ();
792         }
793         /* CONTINUED */ 
794                 unsigned '/' unsigned Music     
795
796         {
797                 $$ = new Time_scaled_music ($3, $5, $6);
798                 $$->set_spot (THIS->pop_spot ());
799         }
800         | Repeated_music                { $$ = $1; }
801         | Simultaneous_music            { $$ = $1; }
802         | Sequential_music              { $$ = $1; }
803         | TRANSPOSE musical_pitch Music {
804                 $$ = new Transposed_music ($3, *$2);
805                 delete $2;
806         }
807         | TRANSPOSE steno_tonic_pitch Music {
808                 $$ = new Transposed_music ($3, *$2);
809                 delete $2;
810         }
811         | NOTES
812                 { THIS->lexer_p_->push_note_state (); }
813         Music
814                 { $$ = $3;
815                   THIS->lexer_p_->pop_state ();
816                 }
817         | CHORDS
818                 { THIS->lexer_p_->push_chord_state (); }
819         Music
820                 {
821                   $$ = $3;
822                   THIS->lexer_p_->pop_state ();
823         }
824         | LYRICS
825                 { THIS->lexer_p_->push_lyric_state (); }
826         Music
827                 {
828                   $$ = $3;
829                   THIS->lexer_p_->pop_state ();
830         }
831         | relative_music        { $$ = $1; }
832         | re_rhythmed_music     { $$ = $1; } 
833         ;
834
835 relative_music:
836         RELATIVE absolute_musical_pitch Music {
837                 $$ = new Relative_octave_music ($3, *$2);
838                 delete $2;
839         }
840         ;
841
842 re_rhythmed_music:
843         ADDLYRICS Music Music {
844                 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
845                 $$ = l;
846         }
847         ;
848
849 translator_change:
850         TRANSLATOR STRING '=' STRING  {
851                 Change_translator * t = new Change_translator;
852                 t-> change_to_type_str_ = ly_scm2string ($2);
853                 t-> change_to_id_str_ = ly_scm2string ($4);
854
855                 $$ = t;
856                 $$->set_spot (THIS->here_input ());
857         }
858         ;
859
860 property_def:
861         PROPERTY STRING '.' STRING '='  scalar {
862                 Translation_property *t = new Translation_property;
863
864                 t->var_str_ = ly_scm2string ($4);
865                 t->value_ = $6;
866
867                 Context_specced_music *csm = new Context_specced_music (t);
868                 $$ = csm;
869                 $$->set_spot (THIS->here_input ());
870
871                 csm-> translator_type_str_ = ly_scm2string ($2);
872         }
873         ;
874
875 scalar:
876         string          { $$ = $1; }
877         | int           { $$ = gh_int2scm ($1); }
878         | embedded_scm  { $$ = $1; }
879         ;
880
881
882 request_chord:
883         pre_requests simple_element post_requests       {
884                 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
885                 if (l) {
886                         for (int i=0; i < $1->size(); i++)
887                                 l->add_music ($1->elem(i));
888                         for (int i=0; i < $3->size(); i++)
889                                 l->add_music ($3->elem(i));
890                         }
891                 else
892                         programming_error ("Need Sequence to add music to");
893                 $$ = $2;
894                 
895         }
896         | command_element
897         ;
898
899 command_element:
900         command_req {
901                 $$ = new Request_chord;
902                 $$-> set_spot (THIS->here_input ());
903                 $1-> set_spot (THIS->here_input ());
904                 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
905         }
906         | PARTIAL duration_length ';'   {
907                 Translation_property * p = new Translation_property;
908                 p->var_str_ = "measurePosition";
909                 p->value_ =  (new Moment (-$2->length_mom ()))->smobify_self ();
910                 delete $2;
911                 Context_specced_music * sp = new Context_specced_music (p);
912                 $$ =sp ;
913                 sp-> translator_type_str_ = "Score";
914         }
915         ;
916
917 command_req:
918         shorthand_command_req
919         | verbose_command_req semicolon { $$ = $1; }
920         ;
921
922 shorthand_command_req:
923         extender_req {
924                 $$ = $1;
925         }
926         | hyphen_req {
927                 $$ = $1;
928         }
929         | '|'                           {
930                 $$ = new Barcheck_req;
931         }
932         | '~'   {
933                 $$ = new Tie_req;
934         }
935         | '['           {
936                 Span_req*b= new Span_req;
937                 b->span_dir_ = START;
938                 b->span_type_str_ = "beam";
939                 $$ =b;
940         }
941         | ']'           {
942              Span_req*b= new Span_req;
943              b->span_dir_ = STOP;
944              b->span_type_str_ = "beam";
945              $$ = b;
946         }
947         | BREATHE {
948                 $$ = new Breathing_sign_req;
949         }
950         ;
951
952
953 verbose_command_req:
954         
955         BAR STRING                      {
956                 $$ = new Bar_req (ly_scm2string ($2));
957         }
958         | COMMANDSPANREQUEST int STRING {
959                 Span_req * sp_p = new Span_req;
960                 sp_p-> span_dir_  = Direction($2);
961                 sp_p->span_type_str_ = ly_scm2string ($3);
962                 sp_p->set_spot (THIS->here_input ());
963                 $$ = sp_p;
964         }
965         | MARK  {
966                 Mark_req * m = new Mark_req;
967                 $$ = m;
968         }
969         | MARK STRING {
970                 Mark_req *m = new Mark_req;
971                 m->mark_label_ = $2;
972                 $$ = m;
973
974         }
975         | MARK unsigned {
976                 Mark_req *m = new Mark_req;
977                 m->mark_label_ =  gh_int2scm ($2);
978                 $$ = m;
979         }
980
981         | TIME_T unsigned '/' unsigned  {
982                 Time_signature_change_req *m = new Time_signature_change_req;
983                 m->beats_i_ = $2;
984                 m->one_beat_i_=$4;
985                 $$ = m;
986         }
987         | PENALTY int   {
988                 Break_req * b = new Break_req;
989                 b->penalty_f_ = $2 / 100.0;
990                 b->set_spot (THIS->here_input ());
991                 $$ = b;
992         }
993         | SKIP duration_length {
994                 Skip_req * skip_p = new Skip_req;
995                 skip_p->duration_ = *$2;
996                 delete $2;
997                 $$ = skip_p;
998         }
999         | tempo_request {
1000                 $$ = $1;
1001         }
1002         | CLEF STRING {
1003                 $$ = new Clef_change_req (ly_scm2string ($2));
1004
1005         }
1006         | KEY {
1007                 Key_change_req *key_p= new Key_change_req;
1008                 key_p->key_ = 0;
1009                 $$ = key_p;
1010         }
1011 /* UGH. optional.  */
1012
1013         | KEY NOTENAME_PITCH optional_modality  {
1014                 Key_change_req *key_p= new Key_change_req;
1015                 Key_def d;
1016                 d.pitch_arr_.push (*$2);
1017                 d.ordinary_key_b_ = true;
1018                 d.modality_i_ = $3;
1019
1020                 key_p->key_ = new Key_def (d);
1021                 $$ = key_p;
1022                 delete $2;
1023         }
1024         | KEYSIGNATURE pitch_list {
1025                 Key_change_req *key_p= new Key_change_req;
1026                 Key_def d;
1027                 d.pitch_arr_ = *$2;
1028                 d.ordinary_key_b_ = false;
1029
1030                 key_p->key_ = new Key_def(d);
1031                 $$ = key_p;
1032                 delete $2;
1033         }
1034         ;
1035
1036 post_requests:
1037         {
1038                 $$ = new Link_array<Request>;
1039         }
1040         | post_requests post_request {
1041                 $2->set_spot (THIS->here_input ());
1042                 $$->push ($2);
1043         }
1044         ;
1045
1046 post_request:
1047         verbose_request
1048         | request_with_dir
1049         | close_request
1050         ;
1051
1052
1053 request_that_take_dir:
1054         gen_text_def
1055         | verbose_request
1056         | script_abbreviation {
1057                 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1058                 Articulation_req *a = new Articulation_req;
1059                 a->articulation_str_ = *i->access_content_String (false);
1060                 $$ = a;
1061         }
1062         ;
1063
1064 request_with_dir:
1065         script_dir request_that_take_dir        {
1066                 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1067                         gs->dir_ = Direction ($1);
1068                 else if ($1)
1069                         $2->warning (_ ("Can't specify direction for this request"));
1070                 $$ = $2;
1071         }
1072         ;
1073         
1074 verbose_request:
1075         REQUEST_IDENTIFIER      {
1076                 $$ = (Request*)$1->access_content_Request (true);
1077                 $$->set_spot (THIS->here_input ());
1078         }
1079         | TEXTSCRIPT STRING STRING      {
1080                 Text_script_req *ts_p = new Text_script_req;
1081                 ts_p-> text_str_ = ly_scm2string ($2);
1082                 ts_p-> style_str_ = ly_scm2string ($3);
1083                 ts_p->set_spot (THIS->here_input ());
1084
1085                 $$ = ts_p;
1086         }
1087         | SPANREQUEST int STRING {
1088                 Span_req * sp_p = new Span_req;
1089                 sp_p-> span_dir_  = Direction($2);
1090                 sp_p->span_type_str_ = ly_scm2string ($3);
1091                 sp_p->set_spot (THIS->here_input ());
1092                 $$ = sp_p;
1093         }
1094         | tremolo_type  {
1095                 Tremolo_req* a = new Tremolo_req;
1096                 a->set_spot (THIS->here_input ());
1097                 a->type_i_ = $1;
1098                 $$ = a;
1099         }
1100         | SCRIPT STRING         { 
1101                 Articulation_req * a = new Articulation_req;
1102                 a->articulation_str_ = ly_scm2string ($2);
1103                 a->set_spot (THIS->here_input ());
1104                 $$ = a;
1105         }
1106         ;
1107
1108 optional_modality:
1109         /* empty */     {
1110                 $$ = 0;
1111         }
1112         | int   {
1113                 $$ = $1;
1114         }
1115         ;
1116
1117 sup_quotes:
1118         '\'' {
1119                 $$ = 1;
1120         }
1121         | sup_quotes '\'' {
1122                 $$ ++;
1123         }
1124         ;
1125
1126 sub_quotes:
1127         ',' {
1128                 $$ = 1;
1129         }
1130         | sub_quotes ',' {
1131                 $$ ++ ;
1132         }
1133         ;
1134
1135 steno_musical_pitch:
1136         NOTENAME_PITCH  {
1137                 $$ = $1;
1138         }
1139         | NOTENAME_PITCH sup_quotes     {
1140                 $$ = $1;
1141                 $$->octave_i_ +=  $2;
1142         }
1143         | NOTENAME_PITCH sub_quotes      {
1144                 $$ = $1;
1145                 $$->octave_i_ += - $2;
1146         }
1147         ;
1148
1149 steno_tonic_pitch:
1150         TONICNAME_PITCH {
1151                 $$ = $1;
1152         }
1153         | TONICNAME_PITCH sup_quotes    {
1154                 $$ = $1;
1155                 $$->octave_i_ +=  $2;
1156         }
1157         | TONICNAME_PITCH sub_quotes     {
1158                 $$ = $1;
1159                 $$->octave_i_ += - $2;
1160         }
1161         ;
1162
1163 musical_pitch:
1164         steno_musical_pitch {
1165                 $$ = $1;
1166         }
1167         | MUSICAL_PITCH embedded_scm {
1168                 int sz = scm_ilength ($2);
1169                 if (sz != 3) {
1170                         THIS->parser_error (_f ("Expecting %d arguments", 3));
1171                         $2 = gh_list (gh_int2scm (0), gh_int2scm (0), gh_int2scm (0), SCM_UNDEFINED);
1172                 }
1173                 $$ = new Musical_pitch ($2);
1174         }
1175         ;
1176
1177 explicit_duration:
1178         DURATION '{' int_list '}'       {
1179                 $$ = new Duration;
1180                 Array<int> &a = *$3;
1181                 ARRAY_SIZE(a,2);
1182                         
1183                 $$-> durlog_i_ = a[0];
1184                 $$-> dots_i_ = a[1];
1185
1186                 delete &a;              
1187         }
1188         ;
1189
1190 extender_req:
1191         EXTENDER {
1192                 if (!THIS->lexer_p_->lyric_state_b ())
1193                         THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1194                 $$ = new Extender_req;
1195         }
1196         ;
1197
1198 hyphen_req:
1199         HYPHEN {
1200                 if (!THIS->lexer_p_->lyric_state_b ())
1201                         THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1202                 $$ = new Hyphen_req;
1203         }
1204         ;
1205
1206 close_request:
1207         close_request_parens {
1208                 $$ = $1;
1209                 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1210         }
1211         
1212 close_request_parens:
1213         '('     {
1214                 Span_req* s= new Span_req;
1215                 $$ = s;
1216                 s->span_type_str_ = "slur";
1217         }
1218         | E_SMALLER {
1219                 Span_req*s =new Span_req;
1220                 $$ = s;
1221                 s->span_type_str_ = "crescendo";
1222         }
1223         | E_BIGGER {
1224                 Span_req*s =new Span_req;
1225                 $$ = s;
1226                 s->span_type_str_ = "decrescendo";
1227         }
1228         ;
1229
1230
1231 open_request:
1232         open_request_parens {
1233                 $$ = $1;
1234                 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1235         }
1236         ;
1237
1238 open_request_parens:
1239         E_EXCLAMATION   {
1240                 Span_req *s =  new Span_req;
1241                 s->span_type_str_ = "crescendo";
1242                 $$ = s;
1243         }
1244         | ')'   {
1245                 Span_req* s= new Span_req;
1246                 $$ = s;
1247                 s->span_type_str_ = "slur";
1248         }
1249         ;
1250
1251 gen_text_def:
1252         string {
1253                 Text_script_req *t  = new Text_script_req;
1254                 $$ = t;
1255                 t->text_str_ = ly_scm2string ($1);
1256
1257                 $$->set_spot (THIS->here_input ());
1258         }
1259         | DIGIT {
1260                 Text_script_req* t  = new Text_script_req;
1261                 $$ = t;
1262                 t->text_str_ = to_str ($1);
1263                 t->style_str_ = "finger";
1264                 $$->set_spot (THIS->here_input ());
1265         }
1266         ;
1267
1268 script_abbreviation:
1269         '^'             {
1270                 $$ = gh_str02scm  ("hat");
1271         }
1272         | '+'           {
1273                 $$ = gh_str02scm("plus");
1274         }
1275         | '-'           {
1276                 $$ = gh_str02scm ("dash");
1277         }
1278         | '|'           {
1279                 $$ = gh_str02scm ("bar");
1280         }
1281         | '>'           {
1282                 $$ = gh_str02scm ("larger");
1283         }
1284         | '.'           {
1285                 $$ = gh_str02scm ("dot");
1286         }
1287         ;
1288
1289
1290 script_dir:
1291         '_'     { $$ = DOWN; }
1292         | '^'   { $$ = UP; }
1293         | '-'   { $$ = CENTER; }
1294         ;
1295
1296 pre_requests:
1297         {
1298                 $$ = new Link_array<Request>;
1299         }
1300         | pre_requests open_request {
1301                 $$->push ($2);
1302         }
1303         ;
1304
1305 absolute_musical_pitch:
1306         steno_musical_pitch     {
1307                 $$ = $1;
1308         }
1309         ;
1310
1311 duration_length:
1312         steno_duration {
1313                 $$ = $1;
1314         }
1315         | duration_length '*' unsigned {
1316                 $$->tuplet_iso_i_ *= $3;
1317         }
1318         | duration_length '/' unsigned {
1319                 $$->tuplet_type_i_ *= $3;
1320         }
1321         ;
1322
1323 entered_notemode_duration:
1324         steno_duration  {
1325                 THIS->set_last_duration ($1);
1326         }
1327         ;
1328
1329 optional_notemode_duration:
1330         {
1331                 $$ = new Duration (THIS->default_duration_);
1332         }
1333         | entered_notemode_duration {
1334                 $$ = $1;
1335         }
1336         ;
1337
1338 steno_duration:
1339         unsigned                {
1340                 $$ = new Duration;
1341                 if (!is_duration_b ($1))
1342                         THIS->parser_error (_f ("not a duration: %d", $1));
1343                 else {
1344                         $$->durlog_i_ = intlog2 ($1);
1345                      }
1346         }
1347         | DURATION_IDENTIFIER   {
1348                 $$ = $1->access_content_Duration (true);
1349         }
1350         | steno_duration '.'    {
1351                 $$->dots_i_ ++;
1352         }
1353         ;
1354
1355
1356 tremolo_type: 
1357         ':'     {
1358                 $$ =0;
1359         }
1360         | ':' unsigned {
1361                 if (!is_duration_b ($2))
1362                         THIS->parser_error (_f ("not a duration: %d", $2));
1363                 $$ = $2;
1364         }
1365         ;
1366
1367
1368 simple_element:
1369         musical_pitch exclamations questions optional_notemode_duration {
1370                 if (!THIS->lexer_p_->note_state_b ())
1371                         THIS->parser_error (_ ("Have to be in Note mode for notes"));
1372
1373
1374                 Note_req *n = new Note_req;
1375                 
1376                 n->pitch_ = *$1;
1377                 n->duration_ = *$4;
1378
1379                 n->cautionary_b_ = $3 % 2;
1380                 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1381
1382                 Simultaneous_music*v = new Request_chord;
1383                 v->set_spot ($1->spot ());
1384                 n->set_spot ($1->spot ());
1385
1386                 v->add_music (n);
1387
1388                 $$ = v;
1389
1390                 delete $1;
1391                 delete $4;
1392
1393         }
1394         | RESTNAME optional_notemode_duration           {
1395                   Simultaneous_music* velt_p = new Request_chord;
1396                   velt_p->set_spot (THIS->here_input());
1397
1398                   if (ly_scm2string ($1) =="s")
1399                     { /* Space */
1400                       Skip_req * skip_p = new Skip_req;
1401                       skip_p->duration_ = *$2;
1402
1403                       skip_p->set_spot (THIS->here_input());
1404                       velt_p->add_music (skip_p);
1405                     }
1406                   else
1407                     {
1408                       Rest_req * rest_req_p = new Rest_req;
1409                       rest_req_p->duration_ = *$2;
1410                       rest_req_p->set_spot (THIS->here_input());
1411
1412                       velt_p->add_music (rest_req_p);
1413                     }
1414
1415                   delete $2;
1416                   $$ = velt_p;
1417         }
1418         | MEASURES optional_notemode_duration   {
1419                 Skip_req * sk = new Skip_req;
1420                 sk->duration_ = *$2;
1421                 Music_list * ms = new Music_list;
1422                 Request_chord * rqc1 = new Request_chord;
1423                 Request_chord * rqc2 = new Request_chord;
1424                 Request_chord * rqc3 = new Request_chord;
1425
1426                 Span_req *sp1 = new Span_req;
1427                 Span_req *sp2 = new Span_req;
1428                 sp1-> span_dir_ = START;
1429                 sp2-> span_dir_ = STOP;
1430                 sp1->span_type_str_ = sp2->span_type_str_ = "rest";
1431                 rqc1->add_music (sp1);
1432                 rqc2->add_music (sk);
1433                 rqc3->add_music (sp2);
1434                 
1435                 ms->add_music (rqc1);
1436                 ms->add_music (rqc2);
1437                 ms->add_music (rqc3);
1438
1439                 $$ = new Sequential_music (ms);
1440         }
1441         | STRING optional_notemode_duration     {
1442                 if (!THIS->lexer_p_->lyric_state_b ())
1443                         THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1444                   Simultaneous_music* velt_p = new Request_chord;
1445
1446                   Lyric_req* lreq_p = new Lyric_req;
1447                   lreq_p ->text_str_ = ly_scm2string ($1);
1448                   lreq_p->duration_ = *$2;
1449                   lreq_p->set_spot (THIS->here_input());
1450
1451                   velt_p->add_music (lreq_p);
1452
1453                   delete  $2;
1454                 $$= velt_p;
1455
1456         }
1457         | chord {
1458                 if (!THIS->lexer_p_->chord_state_b ())
1459                         THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1460                 $$ = $1;
1461         }
1462         ;
1463
1464 chord:
1465         steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1466                 $$ = THIS->get_chord (*$1, $3, $4, $5, $6, *$2);
1467         };
1468
1469 chord_additions: 
1470         {
1471                 $$ = new Array<Musical_pitch>;
1472         } 
1473         | CHORD_COLON chord_notes {
1474                 $$ = $2;
1475         }
1476         ;
1477
1478 chord_notes:
1479         chord_step {
1480                 $$ = $1
1481         }
1482         | chord_notes '.' chord_step {
1483                 $$ = $1;
1484                 $$->concat (*$3);
1485         }
1486         ;
1487
1488 chord_subtractions: 
1489         {
1490                 $$ = new Array<Musical_pitch>;
1491         } 
1492         | CHORD_CARET chord_notes {
1493                 $$ = $2;
1494         }
1495         ;
1496
1497
1498 chord_inversion:
1499         {
1500                 $$ = 0;
1501         }
1502         | '/' steno_tonic_pitch {
1503                 $$ = $2;
1504                 $$->set_spot (THIS->here_input ());
1505         }
1506         ;
1507
1508 chord_bass:
1509         {
1510                 $$ = 0;
1511         }
1512         | CHORD_BASS steno_tonic_pitch {
1513                 $$ = $2;
1514                 $$->set_spot (THIS->here_input ());
1515         }
1516         ;
1517
1518 chord_step:
1519         chord_note {
1520                 $$ = new Array<Musical_pitch>;
1521                 $$->push (*$1);
1522         }
1523         | CHORDMODIFIER_PITCH {
1524                 $$ = new Array<Musical_pitch>;
1525                 $$->push (*$1);
1526         }
1527         | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1528                 $$ = new Array<Musical_pitch>;
1529                 $$->push (*$1);
1530                 $$->push (*$2);
1531         }
1532         ;
1533
1534 chord_note:
1535         unsigned {
1536                 $$ = new Musical_pitch;
1537                 $$->notename_i_ = ($1 - 1) % 7;
1538                 $$->octave_i_ = $1 > 7 ? 1 : 0;
1539                 $$->accidental_i_ = 0;
1540         } 
1541         | unsigned '+' {
1542                 $$ = new Musical_pitch;
1543                 $$->notename_i_ = ($1 - 1) % 7;
1544                 $$->octave_i_ = $1 > 7 ? 1 : 0;
1545                 $$->accidental_i_ = 1;
1546         }
1547         | unsigned CHORD_MINUS {
1548                 $$ = new Musical_pitch;
1549                 $$->notename_i_ = ($1 - 1) % 7;
1550                 $$->octave_i_ = $1 > 7 ? 1 : 0;
1551                 $$->accidental_i_ = -1;
1552         }
1553         ;
1554
1555 /*
1556         UTILITIES
1557  */
1558 pitch_list:                     {
1559                 $$ = new Array<Musical_pitch>;
1560         }
1561         | pitch_list musical_pitch      {
1562                 $$->push (*$2);
1563                 delete $2;
1564         }
1565         ;
1566
1567
1568 int_list:
1569         /**/                    {
1570                 $$ = new Array<int>
1571         }
1572         | int_list int          {
1573                 $$->push ($2);          
1574         }
1575         ;
1576
1577 unsigned:
1578         UNSIGNED        {
1579                 $$ = $1;
1580         }
1581         | DIGIT         {
1582                 $$ = $1;
1583         }
1584         ;
1585
1586 int:
1587         unsigned {
1588                 $$ = $1;
1589         }
1590         | '-' unsigned {
1591                 $$ = -$2;
1592         }
1593         | INT_IDENTIFIER        {
1594                 $$ = *$1->access_content_int (false);
1595         }
1596         ;
1597
1598
1599 string:
1600         STRING          {
1601                 $$ = $1;
1602         }
1603         | STRING_IDENTIFIER     {
1604                 $$ = ly_str02scm ($1->access_content_String (true)->ch_C ());
1605         }
1606         | string '+' string {
1607                 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1608         }
1609         ;
1610
1611
1612 exclamations:
1613                 { $$ = 0; }
1614         | exclamations '!'      { $$ ++; }
1615         ;
1616
1617 questions:
1618                 { $$ = 0; }
1619         | questions '?' { $$ ++; }
1620         ;
1621
1622
1623 semicolon:
1624         ';'
1625         ;
1626 %%
1627
1628 void
1629 My_lily_parser::set_yydebug (bool b)
1630 {
1631 #ifdef YYDEBUG
1632         yydebug = b;
1633 #endif
1634 }
1635 void
1636 My_lily_parser::do_yyparse ()
1637 {
1638         yyparse ((void*)this);
1639 }
1640
1641