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