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