]> git.donarmstrong.com Git - lilypond.git/blob - lily/parser.yy
''
[lilypond.git] / lily / parser.yy
1 %{ // -*-Fundamental-*-
2
3 /*
4   parser.yy -- Bison/C++ parser for lilypond
5
6   source file of the GNU LilyPond music typesetter
7
8   (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9            Jan Nieuwenhuizen <janneke@gnu.org>
10 */
11
12 /*
13   Two shift/reduce problems:
14     -
15     -
16  */
17
18 /*
19
20 the rules for who is protecting what are very shady. TODO: uniformise
21 this.
22
23
24 */
25
26 #include <ctype.h>
27 #include <iostream.h>
28
29 #include "translator-def.hh"
30 #include "lily-guile.hh"
31 #include "change-iterator.hh"
32 #include "misc.hh"
33 #include "my-lily-lexer.hh"
34 #include "paper-def.hh"
35 #include "midi-def.hh"
36 #include "main.hh"
37 #include "file-path.hh"
38 #include "debug.hh"
39 #include "dimensions.hh"
40 #include "command-request.hh"
41 #include "musical-request.hh"
42 #include "my-lily-parser.hh"
43 #include "context-specced-music.hh"
44 #include "score.hh"
45 #include "music-list.hh"
46 #include "output-property-music-iterator.hh"
47 #include "property-iterator.hh"
48 #include "file-results.hh"
49 #include "input.hh"
50 #include "relative-music.hh"
51 #include "lyric-combine-music.hh"
52 #include "transposed-music.hh"
53 #include "time-scaled-music.hh"
54 #include "repeated-music.hh"
55 #include "untransposable-music.hh"
56 #include "lilypond-input-version.hh"
57 #include "grace-music.hh"
58 #include "part-combine-music.hh"
59 #include "scm-hash.hh"
60 #include "auto-change-iterator.hh"
61 #include "un-relativable-music.hh"
62 #include "chord.hh"
63
64 bool
65 regular_identifier_b (SCM id)
66 {
67   String str = ly_scm2string (id);
68   char const *s = str.ch_C() ;
69
70   bool v = true;
71   while (*s && v)
72    {
73         v = v && isalpha (*s);
74         s++;
75    }
76   return v;
77 }
78
79
80 Music* 
81 set_property_music (SCM sym, SCM value)
82 {
83         Music * p = new Music (SCM_EOL);
84         p->set_mus_property ("symbol", sym);
85         p->set_mus_property ("iterator-ctor",
86         Property_iterator::constructor_cxx_function);
87
88         p->set_mus_property ("value", value);
89         return p;
90 }
91
92 bool
93 is_duration_b (int t)
94 {
95   return t && t == 1 << intlog2 (t);
96 }
97
98 void
99 set_music_properties (Music *p, SCM a)
100 {
101   for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
102         {
103         p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
104         }
105 }
106
107
108
109
110
111
112
113 // needed for bison.simple's malloc () and free ()
114
115 #include <malloc.h>
116 #include <stdlib.h>
117
118
119
120 #define YYERROR_VERBOSE 1
121
122 #define YYPARSE_PARAM my_lily_parser_l
123 #define YYLEX_PARAM my_lily_parser_l
124 #define THIS\
125         ((My_lily_parser *) my_lily_parser_l)
126
127 #define yyerror THIS->parser_error
128 #define ARRAY_SIZE(a,s)   if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
129
130 %}
131
132 /* We use SCMs to do strings, because it saves us the trouble of
133 deleting them.  Let's hope that a stack overflow doesnt trigger a move
134 of the parse stack onto the heap. */
135
136
137 %union {
138
139     Link_array<Request> *reqvec;
140
141     String *string; // needed by the lexer as temporary scratch area.
142     Music *music;
143     Score *score;
144     Scheme_hash_table *scmhash;
145     Music_output_def * outputdef;
146
147     Request * request;
148
149     SCM scm;
150
151     Tempo_req *tempo;
152     int i;
153 }
154 %{
155
156 int
157 yylex (YYSTYPE *s,  void * v_l)
158 {
159         My_lily_parser   *pars_l = (My_lily_parser*) v_l;
160         My_lily_lexer * lex_l = pars_l->lexer_p_;
161
162         lex_l->lexval_l = (void*) s;
163         return lex_l->yylex ();
164 }
165
166
167 %}
168
169 %pure_parser
170
171 /* tokens which are not keywords */
172 %token AUTOCHANGE
173 %token ALIAS
174 %token APPLY
175 %token ARPEGGIO
176 %token DYNAMICSCRIPT
177 %token ACCEPTS
178 %token ALTERNATIVE
179 %token BAR
180 %token BREATHE
181 %token CHORDMODIFIERS
182 %token CHORDS
183 %token CHAR_T
184 %token CLEF
185 %token CM_T
186 %token CONSISTS
187 %token DURATION
188 %token SEQUENTIAL
189 %token GROBDESCRIPTIONS
190 %token SIMULTANEOUS
191 %token CONSISTSEND
192 %token DENIES
193 %token DURATION
194 %token EXTENDER
195 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
196 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
197 %token GLISSANDO
198 %token GRACE 
199 %token HEADER
200 %token HYPHEN
201 %token IN_T
202 %token INVALID
203 %token KEY
204 %token LYRICS
205 %token MARK
206 %token MULTI_MEASURE_REST
207 %token MIDI
208 %token MM_T
209 %token PITCH
210 %token DEFAULT
211 %token NAME
212 %token PITCHNAMES
213 %token NOTES
214 %token PAPER
215 %token PARTIAL
216 %token PENALTY
217 %token PROPERTY
218 %token OVERRIDE SET REVERT 
219 %token PT_T
220 %token RELATIVE
221 %token REMOVE
222 %token REPEAT
223 %token ADDLYRICS
224 %token PARTCOMBINE
225 %token SCM_T
226 %token SCORE
227 %token SCRIPT
228 %token SKIP
229 %token SPANREQUEST
230 %token STYLESHEET
231 %token COMMANDSPANREQUEST
232 %token TEMPO
233 %token OUTPUTPROPERTY
234 %token TIME_T
235 %token TIMES
236 %token TRANSLATOR
237 %token TRANSPOSE
238 %token TYPE
239 %token UNSET
240 %token CONTEXT
241 %token REST
242
243 /* escaped */
244 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
245 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
246 %token E_BACKSLASH
247 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
248 %token FIGURE_SPACE
249
250
251 %type <i>       exclamations questions dots optional_rest
252 %type <i>       bass_number bass_mod
253 %type <scm>     br_bass_figure bass_figure figure_list figure_spec
254 %token <i>      DIGIT
255 %token <scm>    NOTENAME_PITCH
256 %token <scm>    TONICNAME_PITCH
257 %token <scm>    CHORDMODIFIER_PITCH
258 %token <scm>    DURATION_IDENTIFIER
259 %token <scm>    FRACTION
260 %token <id>     IDENTIFIER
261
262
263 %token <scm>    SCORE_IDENTIFIER
264 %token <scm>    MUSIC_OUTPUT_DEF_IDENTIFIER
265
266 %token <scm>    NUMBER_IDENTIFIER
267 %token <scm>    REQUEST_IDENTIFIER
268 %token <scm>    MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
269 %token <scm>    STRING_IDENTIFIER SCM_IDENTIFIER 
270 %token <scm>    RESTNAME
271 %token <scm>    STRING   
272 %token <scm>    SCM_T
273 %token <i>      UNSIGNED
274 %token <scm>   REAL
275
276 %type <outputdef> output_def
277 %type <scmhash>         lilypond_header lilypond_header_body
278 %type <request> open_request_parens close_request_parens open_request close_request
279 %type <request> request_with_dir request_that_take_dir verbose_request
280 %type <i>       sub_quotes sup_quotes
281 %type <music>   simple_element  request_chord command_element Simple_music  Composite_music 
282 %type <music>   Repeated_music
283 %type <scm>     Alternative_music
284 %type <i>       tremolo_type
285 %type <i>       bare_int  bare_unsigned
286 %type <i>       script_dir
287
288 %type <scm>     identifier_init 
289
290 %type <scm> steno_duration optional_notemode_duration multiplied_duration
291 %type <scm>  verbose_duration
292         
293 %type <reqvec>  pre_requests post_requests
294 %type <request> gen_text_def
295 %type <scm>   steno_pitch pitch absolute_pitch
296 %type <scm>   explicit_pitch steno_tonic_pitch
297
298 %type <scm>     chord_additions chord_subtractions chord_notes chord_step
299 %type <music>   chord
300 %type <scm>     chord_note chord_inversion chord_bass
301 %type <scm>     duration_length fraction
302
303 %type <scm>  embedded_scm scalar
304 %type <music>   Music Sequential_music Simultaneous_music 
305 %type <music>   relative_music re_rhythmed_music part_combined_music
306 %type <music>   property_def translator_change
307 %type <scm> Music_list
308 %type <outputdef>  music_output_def_body
309 %type <request> shorthand_command_req
310 %type <request> post_request 
311 %type <music> command_req verbose_command_req
312 %type <request> extender_req
313 %type <request> hyphen_req
314 %type <scm>     string bare_number number_expression number_term number_factor 
315
316 %type <score>   score_block score_body
317
318 %type <scm>     translator_spec_block translator_spec_body
319 %type <tempo>   tempo_request
320 %type <scm> notenames_body notenames_block chordmodifiers_block
321 %type <scm>     script_abbreviation
322
323
324
325 %left '-' '+'
326
327 /* We don't assign precedence to / and *, because we might need varied
328 prec levels in different prods */
329
330 %left UNARY_MINUS
331
332 %%
333
334 lilypond:       /* empty */
335         | lilypond toplevel_expression {}
336         | lilypond assignment  { }
337         | lilypond error {
338                 THIS->error_level_i_  = 1;
339         }
340         | lilypond INVALID      {
341                 THIS->error_level_i_  = 1;
342         }
343         ;
344
345 toplevel_expression:
346         notenames_block                 {
347                 THIS->lexer_p_->pitchname_tab_ =  $1;
348         }
349         | chordmodifiers_block                  {
350                 THIS->lexer_p_->chordmodifier_tab_  = $1;
351         }
352         | lilypond_header {
353                 if (global_header_p)
354                         scm_gc_unprotect_object (global_header_p->self_scm ());
355                 global_header_p = $1;
356         }
357         | score_block {
358                 score_global_array.push ($1);
359         }
360         | output_def {
361                 if (dynamic_cast<Paper_def*> ($1))
362                         THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultpaper"), $1->self_scm ());
363                 else if (dynamic_cast<Midi_def*> ($1))
364                         THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultmidi"), $1->self_scm ());
365         }
366         | embedded_scm {
367                 // junk value
368         }       
369         ;
370
371 embedded_scm:
372         SCM_T
373         | SCM_IDENTIFIER 
374         ;
375
376
377 chordmodifiers_block:
378         CHORDMODIFIERS notenames_body   {  $$ = $2; }
379         ;
380
381 notenames_block:
382         PITCHNAMES notenames_body   {  $$ = $2; }
383         ;
384
385 notenames_body:
386         embedded_scm    {
387           int i = scm_ilength ($1);
388
389           SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
390           for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
391                 SCM pt = ly_cdar (s);
392                 if (!unsmob_pitch (pt))
393                         THIS->parser_error ("Need pitch object.");
394                 else
395                         scm_hashq_set_x (tab, ly_caar (s), pt);
396           }
397
398           $$ = tab;
399         }
400         ;
401
402 lilypond_header_body:
403         {
404                 $$ = new Scheme_hash_table;
405                 THIS->lexer_p_-> scope_l_arr_.push ($$);
406         }
407         | lilypond_header_body assignment  { 
408
409         }
410         ;
411
412 lilypond_header:
413         HEADER '{' lilypond_header_body '}'     {
414                 $$ = $3;
415                 THIS->lexer_p_->scope_l_arr_.pop ();
416         }
417         ;
418
419
420 /*
421         DECLARATIONS
422 */
423 assignment:
424         STRING {
425                 THIS->push_spot ();
426         }
427         /* cont */ '=' identifier_init  {
428
429         /*
430                 Should find generic way of associating input with objects.
431         */
432                 Input ip = THIS->pop_spot ();
433
434                 if (! regular_identifier_b ($1))
435                 {
436                         ip.warning (_ ("Identifier should have  alphabetic characters only"));
437                 }
438
439                 THIS->lexer_p_->set_identifier ($1, $4);
440
441 /*
442  TODO: devise standard for protection in parser.
443
444   The parser stack lives on the C-stack, which means that
445 all objects can be unprotected as soon as they're here.
446
447 */
448         }
449         ;
450
451
452
453 identifier_init:
454         score_block {
455                 $$ = $1->self_scm ();
456                 scm_gc_unprotect_object ($$);
457         }
458         | output_def {
459                 $$ = $1->self_scm ();
460                 scm_gc_unprotect_object ($$);
461         }
462         | translator_spec_block {
463                 $$ = $1;
464         }
465         | Music  {
466                 $$ = $1->self_scm ();
467                 scm_gc_unprotect_object ($$);
468         }
469         | post_request {
470                 $$ = $1->self_scm ();
471                 scm_gc_unprotect_object ($$);
472         }
473         | verbose_duration {
474                 $$ = $1;
475         }
476         | number_expression {
477                 $$ = $1;
478         }
479         | string {
480                 $$ = $1;
481         }
482         | embedded_scm  {
483                 $$ = $1;
484         }
485         ;
486
487 translator_spec_block:
488         TRANSLATOR '{' translator_spec_body '}'
489                 {
490                 $$ = $3;
491         }
492         ;
493
494 translator_spec_body:
495         TRANSLATOR_IDENTIFIER   {
496                 $$ = unsmob_translator_def ($1)->clone_scm ();
497                 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
498         }
499         | TYPE STRING   {
500                 $$ = Translator_def::make_scm ();
501                 Translator_def*td =  unsmob_translator_def ($$);
502                 td->translator_group_type_ = $2;
503                 td->set_spot (THIS->here_input ());
504         }
505         | translator_spec_body STRING '=' embedded_scm                  {
506                 unsmob_translator_def ($$)->add_property_assign ($2, $4);
507         }
508         | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
509                 unsmob_translator_def ($$)
510                         ->add_push_property (scm_string_to_symbol ($2), $4, $6);
511         }
512         | translator_spec_body STRING REVERT embedded_scm  {
513           unsmob_translator_def ($$)->add_pop_property (
514                 scm_string_to_symbol ($2), $4);
515         }
516         | translator_spec_body NAME STRING  {
517                 unsmob_translator_def ($$)->type_name_ = $3;
518         }
519         | translator_spec_body CONSISTS STRING  {
520                 unsmob_translator_def ($$)->add_element ($3);
521         }
522         | translator_spec_body ALIAS STRING  {
523                 Translator_def*td = unsmob_translator_def ($$);
524                 td->type_aliases_ = gh_cons ($3, td->type_aliases_);
525         }
526         | translator_spec_body GROBDESCRIPTIONS embedded_scm {
527                 Translator_def*td = unsmob_translator_def($$);
528                 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
529                 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
530                         td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
531         }
532         | translator_spec_body CONSISTSEND STRING  {
533                 unsmob_translator_def ($$)->add_last_element ( $3);
534         }
535         | translator_spec_body ACCEPTS STRING  {
536                 unsmob_translator_def ($$)->set_acceptor ($3,true);
537         }
538         | translator_spec_body DENIES STRING  {
539                 unsmob_translator_def ($$)->set_acceptor ($3,false);
540         }
541         | translator_spec_body REMOVE STRING  {
542                 unsmob_translator_def ($$)->remove_element ($3);
543         }
544         ;
545
546 /*
547         SCORE
548 */
549 score_block:
550         SCORE { 
551                 THIS->push_spot ();
552         }
553         /*cont*/ '{' score_body '}'     {
554                 THIS->pop_spot ();
555                 $$ = $4;
556                 if (!$$->def_p_arr_.size ())
557                 {
558                   Music_output_def *id =
559                         unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
560                   $$->add_output (id ? id->clone () :  new Paper_def );
561                 }
562         }
563         ;
564
565 score_body:
566         Music   {
567                 $$ = new Score;
568         
569                 $$->set_spot (THIS->here_input ());
570                 SCM m = $1->self_scm ();
571                 scm_gc_unprotect_object (m);
572
573                 /*
574                         guh.
575                 */
576                 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
577                 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
578                         m = gh_call1 (gh_car (check_funcs), m);
579                 $$->music_ = m;
580
581         }
582         | SCORE_IDENTIFIER {
583                 $$ = new Score (*unsmob_score ($1));
584                 $$->set_spot (THIS->here_input ());
585         }
586         | score_body lilypond_header    {
587                 scm_gc_unprotect_object ($2->self_scm ()); 
588                 $$->header_p_ = $2;
589         }
590         | score_body output_def {
591                 $$->add_output ($2);
592         }
593         | score_body error {
594
595         }
596         ;
597
598
599 /*
600         MIDI
601 */
602 output_def:
603         music_output_def_body '}' {
604                 $$ = $1;
605                 THIS-> lexer_p_-> scope_l_arr_.pop ();
606         }
607         ;
608
609 music_output_def_body:
610         MIDI '{'    {
611            Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultmidi"));
612
613                 
614          Midi_def* p =0;
615         if (id)
616                 p = dynamic_cast<Midi_def*> (id->clone ());
617         else
618                 p = new Midi_def;
619
620          $$ = p;
621          THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
622         }
623         | PAPER '{'     {
624                 Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
625                   Paper_def *p = 0;
626                 if (id)
627                         p = dynamic_cast<Paper_def*> (id->clone ());
628                 else
629                         p = new Paper_def;
630                 THIS-> lexer_p_-> scope_l_arr_.push (p->variable_tab_);
631                 $$ = p;
632         }
633         | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER         {
634                 Music_output_def *p = unsmob_music_output_def ($3);
635                 p = p->clone ();
636                 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
637                 $$ = p;
638         }
639         | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER  {
640                 Music_output_def *p = unsmob_music_output_def ($3);
641                 p = p->clone ();
642
643                 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
644                 $$ = p;
645         }
646         | music_output_def_body assignment  {
647
648         }
649         | music_output_def_body translator_spec_block   {
650                 $$->assign_translator ($2);
651         }
652         | music_output_def_body STYLESHEET embedded_scm {
653                 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
654         }
655         | music_output_def_body tempo_request  {
656                 /*
657                         junk this ? there already is tempo stuff in
658                         music.
659                 */
660                 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
661                 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
662                 Midi_def * md = dynamic_cast<Midi_def*> ($$);
663                 if (md)
664                         md->set_tempo (d->length_mom (), m);
665         }
666         | music_output_def_body error {
667
668         }
669         ;
670
671 tempo_request:
672         TEMPO steno_duration '=' bare_unsigned  {
673                 $$ = new Tempo_req;
674                 $$->set_mus_property ("duration", $2);
675                 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
676         }
677         ;
678
679 /*
680 The representation of a  list is the
681
682   (LIST . LAST-CONS)
683
684  to have  efficient append.
685 */
686 Music_list: /* empty */ {
687                 $$ = gh_cons (SCM_EOL, SCM_EOL);
688         }
689         | Music_list Music {
690                 SCM s = $$;
691                 SCM c = gh_cons ($2->self_scm (), SCM_EOL);
692                 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
693                 if (gh_pair_p (ly_cdr (s)))
694                         gh_set_cdr_x (ly_cdr (s), c); /* append */
695                 else
696                         gh_set_car_x (s, c); /* set first cons */
697                 gh_set_cdr_x (s, c) ;  /* remember last cell */ 
698         }
699         | Music_list error {
700         }
701         ;
702
703
704 Music:
705         Simple_music
706         | Composite_music
707         ;
708
709 Alternative_music:
710         /* empty */ {
711                 $$ = SCM_EOL;
712         }
713         | ALTERNATIVE '{' Music_list '}' {
714                 $$ = $3;
715         }
716         ;
717
718 Repeated_music:
719         REPEAT string bare_unsigned Music Alternative_music
720         {
721                 Music *beg = $4;
722                 int times = $3;
723                 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
724                 if (times < scm_ilength (alts)) {
725                   unsmob_music (gh_car (alts))
726                     ->origin ()->warning (
727                     _("More alternatives than repeats.  Junking excess alternatives."));
728                   alts = ly_truncate_list (times, alts);
729                 }
730
731                 Repeated_music * r = new Repeated_music (SCM_EOL);
732                 if (beg)
733                         {
734                         r-> set_mus_property ("element", beg->self_scm ());
735                         scm_gc_unprotect_object (beg->self_scm ());
736                         }
737                 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
738
739                 r-> set_mus_property ("elements",alts);
740                 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
741                 SCM result = gh_call1 (func, $2);
742
743                 set_music_properties (r, result);
744
745                 r->set_spot (*$4->origin ());
746                 $$ = r;
747         }
748         ;
749
750 Sequential_music:
751         SEQUENTIAL '{' Music_list '}'           {
752                 $$ = new Sequential_music (SCM_EOL);
753                 $$->set_mus_property ("elements", ly_car ($3));
754                 $$->set_spot(THIS->here_input());
755         }
756         | '{' Music_list '}'            {
757                 $$ = new Sequential_music (SCM_EOL);
758                 $$->set_mus_property ("elements", ly_car ($2));
759                 $$->set_spot(THIS->here_input());
760         }
761         ;
762
763 Simultaneous_music:
764         SIMULTANEOUS '{' Music_list '}'{
765                 $$ = new Simultaneous_music (SCM_EOL);
766                 $$->set_mus_property ("elements", ly_car ($3));
767                 $$->set_spot(THIS->here_input());
768
769         }
770         | '<' Music_list '>'    {
771                 $$ = new Simultaneous_music (SCM_EOL);
772                 $$->set_mus_property ("elements", ly_car ($2));
773                 $$->set_spot(THIS->here_input());
774         }
775         ;
776
777 Simple_music:
778         request_chord           { $$ = $1; }
779         | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm     {
780                 SCM pred = $2;
781                 if (!gh_symbol_p ($3))
782                 {
783                         THIS->parser_error (_ ("Second argument must be a symbol")); 
784                 }
785                 /*hould check # args */
786                 if (!gh_procedure_p (pred))
787                 {
788                         THIS->parser_error (_ ("First argument must be a procedure taking 1 argument"));
789                 }
790
791                 Music *m = new Music (SCM_EOL);
792                 m->set_mus_property ("predicate", pred);
793                 m->set_mus_property ("grob-property", $3);
794                 m->set_mus_property ("grob-value",  $5);
795                 m->set_mus_property ("iterator-ctor",
796                 Output_property_music_iterator::constructor_cxx_function);
797
798                 $$ = m;
799         }
800         | MUSIC_IDENTIFIER {
801                 $$ = unsmob_music ($1)->clone ();
802
803                 $$->set_spot (THIS->here_input());
804         }
805         | property_def
806         | translator_change
807         ;
808
809
810 Composite_music:
811         CONTEXT STRING Music    {
812                 Context_specced_music *csm =  new Context_specced_music (SCM_EOL);
813                 csm->set_mus_property ("element", $3->self_scm ());
814                 scm_gc_unprotect_object ($3->self_scm ());
815
816                 csm->set_mus_property ("context-type",$2);
817                 csm->set_mus_property ("context-id", ly_str02scm (""));
818
819                 $$ = csm;
820         }
821         | AUTOCHANGE STRING Music       {
822                 Music * chm = new Music_wrapper (SCM_EOL);
823                 chm->set_mus_property ("element", $3->self_scm ());
824                 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_cxx_function);
825
826                 scm_gc_unprotect_object ($3->self_scm ());
827                 chm->set_mus_property ("what", $2); 
828
829                 $$ = chm;
830                 chm->set_spot (*$3->origin ());
831         }
832         | GRACE Music {
833 #if 1
834         /*
835                 The other version is for easier debugging  of
836                 Sequential_music_iterator in combination with grace notes.
837         */
838
839                 SCM start = THIS->lexer_p_->lookup_identifier ("startGraceMusic");
840                 SCM stop = THIS->lexer_p_->lookup_identifier ("stopGraceMusic");
841                 Music *startm = unsmob_music (start);
842                 Music *stopm = unsmob_music (stop);
843
844                 SCM ms = SCM_EOL;
845                 if (stopm) {
846                         stopm = stopm->clone ();
847                         ms = gh_cons (stopm->self_scm (), ms);
848                         scm_gc_unprotect_object (stopm->self_scm ());
849                 }
850                 ms = gh_cons ($2->self_scm (), ms);
851                 scm_gc_unprotect_object ($2->self_scm());
852                 if (startm) {
853                         startm = startm->clone ();
854                         ms = gh_cons (startm->self_scm () , ms);
855                         scm_gc_unprotect_object (startm->self_scm ());
856                 }
857
858                 Music* seq = new Sequential_music (SCM_EOL);
859                 seq->set_mus_property ("elements", ms);
860
861                 $$ = new Grace_music (SCM_EOL);
862                 $$->set_mus_property ("element", seq->self_scm ());
863                 scm_gc_unprotect_object (seq->self_scm ());
864 #else
865                 $$ = new Grace_music (SCM_EOL);
866                 $$->set_mus_property ("element", $2->self_scm ());
867                 scm_gc_unprotect_object ($2->self_scm ());
868 #endif
869         }
870         | CONTEXT string '=' string Music {
871                 Context_specced_music *csm =  new Context_specced_music (SCM_EOL);
872                 csm->set_mus_property ("element", $5->self_scm ());
873                 scm_gc_unprotect_object ($5->self_scm ());
874
875                 csm->set_mus_property ("context-type", $2);
876                 csm->set_mus_property ("context-id", $4);
877
878                 $$ = csm;
879         }
880         | TIMES {
881                 THIS->push_spot ();
882         }
883         /* CONTINUED */ 
884                 fraction Music  
885
886         {
887                 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
888                 Music *mp = $4;
889                 $$ = new Time_scaled_music (SCM_EOL);
890                 $$->set_spot (THIS->pop_spot ());
891
892
893                 $$->set_mus_property ("element", mp->self_scm ());
894                 scm_gc_unprotect_object (mp->self_scm ());
895                 $$->set_mus_property ("numerator", gh_int2scm (n));
896                 $$->set_mus_property ("denominator", gh_int2scm (d));
897                 $$->compress (Moment (Rational (n,d)));
898
899         }
900         | Repeated_music                { $$ = $1; }
901         | Simultaneous_music            { $$ = $1; }
902         | Sequential_music              { $$ = $1; }
903         | TRANSPOSE pitch Music {
904                 $$ = new Transposed_music (SCM_EOL);
905                 Music *p = $3;
906                 Pitch pit = *unsmob_pitch ($2);
907
908                 p->transpose (pit);
909                 $$->set_mus_property ("element", p->self_scm ());
910                 scm_gc_unprotect_object (p->self_scm ());
911         }
912         | TRANSPOSE steno_tonic_pitch Music {
913                 $$ = new Transposed_music (SCM_EOL);
914                 Music *p = $3;
915                 Pitch pit = *unsmob_pitch ($2);
916
917                 p->transpose (pit);
918                 $$->set_mus_property ("element", p->self_scm ());
919                 scm_gc_unprotect_object (p->self_scm ());
920         
921         }
922         | APPLY embedded_scm Music  {
923                 SCM ret = gh_call1 ($2, $3->self_scm ());
924                 Music *m = unsmob_music (ret);
925                 if (!m) {
926                         THIS->parser_error ("\\apply must return a Music");
927                         m = new Music (SCM_EOL);
928                         }
929                 $$ = m;
930         }
931         | NOTES
932                 { THIS->lexer_p_->push_note_state (); }
933         Music
934                 { $$ = $3;
935                   THIS->lexer_p_->pop_state ();
936                 }
937         | FIGURES
938                 { THIS->lexer_p_->push_figuredbass_state (); }
939         Music
940                 {
941                   Music * chm = new Untransposable_music () ;
942                   chm->set_mus_property ("element", $3->self_scm ());
943                   $$ = chm;
944                   scm_gc_unprotect_object ($3->self_scm());
945
946                   THIS->lexer_p_->pop_state ();
947         }
948         | CHORDS
949                 { THIS->lexer_p_->push_chord_state (); }
950         Music
951                 {
952                   Music * chm = new Un_relativable_music ;
953                   chm->set_mus_property ("element", $3->self_scm ());
954                   scm_gc_unprotect_object ($3->self_scm());
955                   $$ = chm;
956
957                   THIS->lexer_p_->pop_state ();
958         }
959         | LYRICS
960                 { THIS->lexer_p_->push_lyric_state (); }
961         Music
962                 {
963                   $$ = $3;
964                   THIS->lexer_p_->pop_state ();
965         }
966         | relative_music        { $$ = $1; }
967         | re_rhythmed_music     { $$ = $1; } 
968         | part_combined_music   { $$ = $1; } 
969         ;
970
971 relative_music:
972         RELATIVE absolute_pitch Music {
973                 Music * p = $3;
974                 Pitch pit = *unsmob_pitch ($2);
975                 $$ = new Relative_octave_music (SCM_EOL);
976
977                 $$->set_mus_property ("element", p->self_scm ());
978                 scm_gc_unprotect_object (p->self_scm ());
979
980                 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
981
982         }
983         ;
984
985 re_rhythmed_music:
986         ADDLYRICS Music Music {
987           Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
988           l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
989           scm_gc_unprotect_object ($3->self_scm ());
990           scm_gc_unprotect_object ($2->self_scm ());
991           $$ = l;
992         }
993         ;
994
995 part_combined_music:
996         PARTCOMBINE STRING Music Music {
997                 Part_combine_music * p = new Part_combine_music (SCM_EOL);
998
999                 p->set_mus_property ("what", $2);
1000                 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));  
1001
1002                 scm_gc_unprotect_object ($3->self_scm ());
1003                 scm_gc_unprotect_object ($4->self_scm ());  
1004
1005                 $$ = p;
1006         }
1007         ;
1008
1009 translator_change:
1010         TRANSLATOR STRING '=' STRING  {
1011                 Music * t = new Music (SCM_EOL);
1012                 t->set_mus_property ("iterator-ctor",
1013                         Change_iterator::constructor_cxx_function);
1014                 t-> set_mus_property ("change-to-type", $2);
1015                 t-> set_mus_property ("change-to-id", $4);
1016
1017                 $$ = t;
1018                 $$->set_spot (THIS->here_input ());
1019         }
1020         ;
1021
1022 property_def:
1023         PROPERTY STRING '.' STRING '='  scalar {
1024                 
1025                 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1026                 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1027
1028                 csm->set_mus_property ("element", t->self_scm ());
1029                 scm_gc_unprotect_object (t->self_scm ());
1030
1031                 $$ = csm;
1032                 $$->set_spot (THIS->here_input ());
1033
1034                 csm-> set_mus_property ("context-type", $2);
1035         }
1036         | PROPERTY STRING '.' STRING UNSET {
1037                 Music *t = new Music (SCM_EOL);
1038
1039                 t->set_mus_property ("iterator-ctor",
1040                         Property_unset_iterator::constructor_cxx_function);
1041                 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1042
1043                 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1044                 csm->set_mus_property ("element", t->self_scm ());
1045                 scm_gc_unprotect_object (t->self_scm ());
1046
1047                 $$ = csm;
1048                 $$->set_spot (THIS->here_input ());
1049
1050                 csm-> set_mus_property ("context-type", $2);
1051         }
1052         | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1053                 Music *t = new Music (SCM_EOL);
1054                 t->set_mus_property ("iterator-ctor",
1055                         Push_property_iterator::constructor_cxx_function);
1056                 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1057                 t->set_mus_property ("pop-first", SCM_BOOL_T);
1058                 t->set_mus_property ("grob-property", $6);
1059                 t->set_mus_property ("grob-value", $8);
1060                 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1061                 csm->set_mus_property ("element", t->self_scm ());
1062                 scm_gc_unprotect_object (t->self_scm ());
1063                 $$ = csm;
1064                 $$->set_spot (THIS->here_input ());
1065
1066                 csm-> set_mus_property ("context-type", $2);
1067         }
1068         | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
1069                 Music *t = new Music (SCM_EOL);
1070                 t->set_mus_property ("iterator-ctor",
1071                         Push_property_iterator::constructor_cxx_function);
1072                 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1073                 t->set_mus_property ("grob-property", $6);
1074                 t->set_mus_property ("grob-value", $8);
1075                 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1076                 csm->set_mus_property ("element", t->self_scm ());
1077                 scm_gc_unprotect_object (t->self_scm ());
1078
1079                 $$ = csm;
1080                 $$->set_spot (THIS->here_input ());
1081
1082                 csm-> set_mus_property ("context-type", $2);
1083         }
1084         | PROPERTY STRING '.' STRING REVERT embedded_scm {
1085                 Music *t = new Music (SCM_EOL);
1086                 t->set_mus_property ("iterator-ctor",
1087                         Pop_property_iterator::constructor_cxx_function);
1088                 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1089                 t->set_mus_property ("grob-property", $6);
1090
1091                 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1092                 csm->set_mus_property ("element", t->self_scm ());
1093                 scm_gc_unprotect_object (t->self_scm ());
1094
1095                 $$ = csm;
1096                 $$->set_spot (THIS->here_input ());
1097
1098                 csm-> set_mus_property ("context-type", $2);
1099         }
1100         ;
1101
1102 scalar:
1103         string          { $$ = $1; }
1104         | bare_int      { $$ = gh_int2scm ($1); }
1105         | embedded_scm  { $$ = $1; }
1106         ;
1107
1108
1109 request_chord:
1110         pre_requests {
1111                 THIS->push_spot ();
1112         } /*cont */ simple_element post_requests        {
1113                 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1114                 
1115                 $1->concat (*$4);
1116                 for (int i=0; i < $1->size (); i++) {
1117                   Music * m = $1->elem (i);
1118                   l->append_music (m);
1119                 }
1120                 $$ = $3;
1121
1122                 delete $1;
1123                 delete $4;
1124         }
1125         | command_element
1126         ;
1127
1128 command_element:
1129         command_req {
1130                 $$ = new Request_chord (SCM_EOL);
1131                 $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
1132           scm_gc_unprotect_object ($1->self_scm());
1133
1134                 $$-> set_spot (THIS->here_input ());
1135                 $1-> set_spot (THIS->here_input ());
1136         }
1137         | E_LEFTSQUARE {
1138                 Span_req *l = new Span_req;
1139                 l->set_span_dir (START);
1140                 l->set_mus_property ("span-type", ly_str02scm ("ligature"));
1141                 l->set_spot (THIS->here_input ());
1142
1143                 $$ = new Request_chord (SCM_EOL);
1144                 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1145           scm_gc_unprotect_object (l->self_scm());
1146                 $$->set_spot (THIS->here_input ());
1147         }
1148         | E_RIGHTSQUARE {
1149                 Span_req *l = new Span_req;
1150                 l->set_span_dir (STOP);
1151                 l->set_mus_property ("span-type", ly_str02scm ("ligature"));
1152                 l->set_spot (THIS->here_input ());
1153
1154                 $$ = new Request_chord (SCM_EOL);
1155                 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1156                 $$->set_spot (THIS->here_input ());
1157           scm_gc_unprotect_object (l->self_scm());
1158
1159         }
1160         | E_BACKSLASH {
1161                 $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1162                 $$->set_spot (THIS->here_input ());
1163         }
1164         | '|'      {
1165
1166                 extern Music * get_barcheck();
1167                 $$ = get_barcheck ();
1168                 $$->set_spot (THIS->here_input ());
1169         }
1170         | BAR STRING                    {
1171                 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1172
1173                 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1174                 csm->set_mus_property ("element", t->self_scm ());
1175                 scm_gc_unprotect_object (t->self_scm ());
1176
1177                 $$ = csm;
1178                 $$->set_spot (THIS->here_input ());
1179
1180                 csm->set_mus_property ("context-type", ly_str02scm ("Score"));
1181         }
1182         | PARTIAL duration_length       {
1183                 Moment m = - unsmob_duration ($2)->length_mom ();
1184                 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1185
1186                 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1187                 sp->set_mus_property ("element", p->self_scm ());
1188                 scm_gc_unprotect_object (p->self_scm ());
1189
1190                 $$ =sp ;
1191                 sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
1192         }
1193         | CLEF STRING  {
1194                 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1195                 SCM result = gh_call1 (func, $2);
1196
1197                 SCM l = SCM_EOL;
1198                 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1199                         Music * p = new Music (SCM_EOL);
1200                         set_music_properties (p, ly_car (s));
1201                         l = gh_cons (p->self_scm (), l);
1202                         scm_gc_unprotect_object (p->self_scm ());
1203                 }
1204                 Sequential_music * seq = new Sequential_music (SCM_EOL);
1205                 seq->set_mus_property ("elements", l);
1206
1207                 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1208                 sp->set_mus_property ("element", seq->self_scm ());
1209                 scm_gc_unprotect_object (seq->self_scm ());
1210
1211                 $$ =sp ;
1212                 sp-> set_mus_property ("context-type", ly_str02scm ("Staff"));
1213         }
1214         | TIME_T fraction  {
1215                 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1216
1217                 int l = gh_scm2int (ly_car ($2));
1218                 int o = gh_scm2int (ly_cdr ($2));
1219
1220                 Moment one_beat = Moment (1)/Moment (o);
1221                 Moment len = Moment (l) * one_beat;
1222
1223
1224                 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1225                 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1226
1227                 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1228                 Sequential_music *seq = new Sequential_music (SCM_EOL);
1229                 seq->set_mus_property ("elements", list);
1230                 
1231
1232                 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1233                 sp->set_mus_property ("element", seq->self_scm ());
1234
1235                 
1236
1237                 scm_gc_unprotect_object (p3->self_scm ());
1238                 scm_gc_unprotect_object (p2->self_scm ());
1239                 scm_gc_unprotect_object (p1->self_scm ());
1240                 scm_gc_unprotect_object (seq->self_scm ());
1241
1242                 $$ = sp;
1243
1244 /*
1245  TODO: should make alias TimingContext for Score
1246 */
1247
1248                 sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
1249         }
1250         ;
1251
1252 command_req:
1253         shorthand_command_req   { $$ = $1; }
1254         | verbose_command_req   { $$ = $1; }
1255         ;
1256
1257 shorthand_command_req:
1258         extender_req {
1259                 $$ = $1;
1260         }
1261         | hyphen_req {
1262                 $$ = $1;
1263         }
1264         | '~'   {
1265                 $$ = new Tie_req;
1266         }
1267         | '['           {
1268                 Span_req*b= new Span_req;
1269                 b->set_span_dir (START);
1270                 b->set_mus_property ("span-type", ly_str02scm ("beam"));
1271                 $$ =b;
1272
1273
1274                 THIS->last_beam_start_ = b->self_scm ();
1275         }
1276         | ']'           {
1277                 Span_req*b= new Span_req;
1278                 b->set_span_dir ( STOP);
1279                 b->set_mus_property ("span-type", ly_str02scm ("beam"));
1280                 $$ = b;
1281         }
1282         | BREATHE {
1283                 $$ = new Breathing_sign_req;
1284         }
1285         | E_TILDE {
1286                 $$ = new Porrectus_req;
1287         }
1288         ;
1289
1290 verbose_command_req:
1291         COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1292                 Span_req * sp_p = new Span_req;
1293                 sp_p-> set_span_dir ( Direction ($2));
1294                 sp_p->set_mus_property ("span-type",$3);
1295                 sp_p->set_spot (THIS->here_input ());
1296                 $$ = sp_p;
1297         }
1298         | MARK DEFAULT  {
1299                 Mark_req * m = new Mark_req;
1300                 $$ = m;
1301         }
1302         | MARK scalar {
1303                 Mark_req *m = new Mark_req;
1304                 m->set_mus_property ("label", $2);
1305                 $$ = m;
1306
1307         }
1308         | PENALTY SCM_T         {
1309                 Break_req * b = new Break_req;
1310                 SCM s = $2;
1311                 if (!gh_number_p (s))
1312                         s  =gh_int2scm (0);
1313
1314                 b->set_mus_property ("penalty", s);
1315                 b->set_spot (THIS->here_input ());
1316                 $$ = b;
1317         }
1318         | SKIP duration_length {
1319                 Skip_req * skip_p = new Skip_req;
1320                 skip_p->set_mus_property ("duration", $2);
1321
1322                 $$ = skip_p;
1323         }
1324         | tempo_request {
1325                 $$ = $1;
1326         }
1327         | KEY DEFAULT {
1328                 Key_change_req *key_p= new Key_change_req;
1329                 $$ = key_p;
1330         }
1331         | KEY NOTENAME_PITCH SCM_IDENTIFIER     {
1332                 Key_change_req *key_p= new Key_change_req;
1333                 
1334                 key_p->set_mus_property ("pitch-alist", $3);
1335                 ((Music*)key_p)->transpose (* unsmob_pitch ($2));
1336                 $$ = key_p; 
1337         }
1338         ;
1339
1340 post_requests:
1341         {
1342                 $$ = new Link_array<Request>;
1343         }
1344         | post_requests post_request {
1345                 $2->set_spot (THIS->here_input ());
1346                 $$->push ($2);
1347         }
1348         ;
1349
1350 post_request:
1351         verbose_request
1352         | request_with_dir
1353         | close_request
1354         ;
1355
1356
1357 request_that_take_dir:
1358         gen_text_def
1359         | verbose_request
1360         | script_abbreviation {
1361                 SCM s = THIS->lexer_p_->lookup_identifier ("dash" + ly_scm2string ($1));
1362                 Articulation_req *a = new Articulation_req;
1363                 if (gh_string_p (s))
1364                         a->set_mus_property ("articulation-type", s);
1365                 else THIS->parser_error (_ ("Expecting string as script definition"));
1366                 $$ = a;
1367         }
1368         ;
1369
1370 request_with_dir:
1371         script_dir request_that_take_dir        {
1372                 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1373                         gs->set_direction (Direction ($1));
1374                 else if ($1)
1375                         $2->origin ()->warning (_ ("Can't specify direction for this request"));
1376                 $$ = $2;
1377         }
1378         ;
1379         
1380 verbose_request:
1381         REQUEST_IDENTIFIER      {
1382                 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1383                 $$->set_spot (THIS->here_input ());
1384         }
1385         | DYNAMICSCRIPT embedded_scm {
1386                 /*
1387                         TODO: junkme, use text-type == dynamic
1388                 */
1389                 Text_script_req *d = new Text_script_req;
1390                 SCM dyn = ly_symbol2scm ("dynamic");
1391                 d->set_mus_property ("text-type" , dyn);
1392                 d->set_mus_property ("text", $2);
1393                 d->set_spot (THIS->here_input ());
1394                 $$ = d;
1395         }
1396         | SPANREQUEST bare_int STRING {
1397                 Span_req * sp_p = new Span_req;
1398                 sp_p->set_span_dir ( Direction ($2));
1399                 sp_p->set_mus_property ("span-type", $3);
1400                 sp_p->set_spot (THIS->here_input ());
1401                 $$ = sp_p;
1402         }
1403         | tremolo_type  {
1404                Tremolo_req* a = new Tremolo_req;
1405                a->set_spot (THIS->here_input ());
1406                a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1407                $$ = a;
1408         }
1409         | SCRIPT STRING         { 
1410                 Articulation_req * a = new Articulation_req;
1411                 a->set_mus_property ("articulation-type", $2);
1412                 a->set_spot (THIS->here_input ());
1413                 $$ = a;
1414         }
1415         /*
1416 duh, junk this syntax from the parser, if possible. 
1417         */
1418         | ARPEGGIO {
1419                 Arpeggio_req *a = new Arpeggio_req;
1420                 a->set_spot (THIS->here_input ());
1421                 $$ = a;
1422         }
1423         | GLISSANDO {
1424                 Glissando_req *g = new Glissando_req;
1425                 g->set_spot /* No pun intended */ (THIS->here_input ());
1426                 $$ = g;
1427         }       
1428         ;
1429
1430 sup_quotes:
1431         '\'' {
1432                 $$ = 1;
1433         }
1434         | sup_quotes '\'' {
1435                 $$ ++;
1436         }
1437         ;
1438
1439 sub_quotes:
1440         ',' {
1441                 $$ = 1;
1442         }
1443         | sub_quotes ',' {
1444                 $$ ++ ;
1445         }
1446         ;
1447
1448 steno_pitch:
1449         NOTENAME_PITCH  {
1450                 $$ = $1;
1451         }
1452         | NOTENAME_PITCH sup_quotes     {
1453                 Pitch p = *unsmob_pitch ($1);
1454                 p.octave_i_ +=  $2;
1455                 $$ = p.smobbed_copy ();
1456         }
1457         | NOTENAME_PITCH sub_quotes      {
1458                 Pitch p =* unsmob_pitch ($1);
1459
1460                 p.octave_i_ +=  -$2;
1461                 $$ = p.smobbed_copy ();
1462
1463         }
1464         ;
1465
1466 /*
1467 ugh. duplication
1468 */
1469
1470 steno_tonic_pitch:
1471         TONICNAME_PITCH {
1472                 $$ = $1;
1473         }
1474         | TONICNAME_PITCH sup_quotes    {
1475                 Pitch p = *unsmob_pitch ($1);
1476                 p.octave_i_ +=  $2;
1477                 $$ = p.smobbed_copy ();
1478         }
1479         | TONICNAME_PITCH sub_quotes     {
1480                 Pitch p =* unsmob_pitch ($1);
1481
1482                 p.octave_i_ +=  -$2;
1483                 $$ = p.smobbed_copy ();
1484
1485         }
1486         ;
1487
1488 pitch:
1489         steno_pitch {
1490                 $$ = $1;
1491         }
1492         | explicit_pitch {
1493                 $$ = $1;
1494         }
1495         ;
1496
1497 explicit_pitch:
1498         PITCH embedded_scm {
1499                 $$ = $2;
1500                 if (!unsmob_pitch ($2)) {
1501                         THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1502                          $$ = Pitch ().smobbed_copy ();
1503                 }
1504         }
1505         ;
1506
1507 verbose_duration:
1508         DURATION embedded_scm   {
1509                 $$ = $2;
1510                 if (!unsmob_duration ($2))
1511                 {
1512                         THIS->parser_error (_ ("Must have duration object"));
1513                         $$ = Duration ().smobbed_copy ();
1514                 }
1515         }
1516         ;
1517
1518 extender_req:
1519         EXTENDER {
1520                 if (!THIS->lexer_p_->lyric_state_b ())
1521                         THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1522                 $$ = new Extender_req;
1523         }
1524         ;
1525
1526 hyphen_req:
1527         HYPHEN {
1528                 if (!THIS->lexer_p_->lyric_state_b ())
1529                         THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1530                 $$ = new Hyphen_req;
1531         }
1532         ;
1533
1534 close_request:
1535         close_request_parens {
1536                 $$ = $1;
1537                 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1538         }
1539         ;
1540  
1541 close_request_parens:
1542         '('     {
1543                 Span_req* s= new Span_req;
1544                 $$ = s;
1545                 s->set_mus_property ("span-type", ly_str02scm ( "slur"));
1546                 s->set_spot (THIS->here_input());
1547         }
1548         | E_OPEN        {
1549                 Span_req* s= new Span_req;
1550                 $$ = s;
1551                 s->set_mus_property ("span-type", ly_str02scm ( "phrasing-slur"));
1552                 s->set_spot (THIS->here_input());
1553         }
1554         | E_SMALLER {
1555                 Span_req*s =new Span_req;
1556                 $$ = s;
1557                 s->set_mus_property ("span-type", ly_str02scm ( "crescendo"));
1558                 s->set_spot (THIS->here_input());
1559         }
1560         | E_BIGGER {
1561                 Span_req*s =new Span_req;
1562                 $$ = s;
1563                 s->set_mus_property ("span-type", ly_str02scm ("decrescendo"));
1564                 s->set_spot (THIS->here_input());
1565         }
1566         ;
1567
1568
1569 open_request:
1570         open_request_parens {
1571                 $$ = $1;
1572                 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1573         }
1574         ;
1575
1576 open_request_parens:
1577         E_EXCLAMATION   {
1578                 Span_req *s =  new Span_req;
1579                 s->set_mus_property ("span-type", ly_str02scm ( "crescendo"));
1580                 s->set_spot (THIS->here_input());
1581
1582                 $$ = s;
1583         }
1584         | ')'   {
1585                 Span_req* s= new Span_req;
1586                 $$ = s;
1587                 s->set_mus_property ("span-type", ly_str02scm ( "slur"));
1588                 s->set_spot (THIS->here_input());
1589
1590         }
1591         | E_CLOSE       {
1592                 Span_req* s= new Span_req;
1593                 $$ = s;
1594                 s->set_mus_property ("span-type", ly_str02scm ( "phrasing-slur"));
1595                 s->set_spot (THIS->here_input());
1596         }
1597         ;
1598
1599 gen_text_def:
1600         embedded_scm {
1601                 Text_script_req *t = new Text_script_req;
1602                 t->set_mus_property ("text", $1);
1603                 t->set_spot (THIS->here_input ());
1604                 $$ = t;
1605         }
1606         | string {
1607                 Text_script_req *t = new Text_script_req;
1608                 t->set_mus_property ("text", $1);
1609                 t->set_spot (THIS->here_input ());
1610                 $$ = t;
1611         }
1612         | DIGIT {
1613                 String ds = to_str ($1);
1614                 Text_script_req* t = new Text_script_req;
1615                 SCM finger = ly_symbol2scm ("finger");
1616                 t->set_mus_property ("text",  ly_str02scm (ds.ch_C ()));
1617                 t->set_mus_property ("text-type" , finger);
1618                 t->set_spot (THIS->here_input ());
1619                 $$ = t;
1620         }
1621         ;
1622
1623 script_abbreviation:
1624         '^'             {
1625                 $$ = gh_str02scm ("Hat");
1626         }
1627         | '+'           {
1628                 $$ = gh_str02scm ("Plus");
1629         }
1630         | '-'           {
1631                 $$ = gh_str02scm ("Dash");
1632         }
1633         | '|'           {
1634                 $$ = gh_str02scm ("Bar");
1635         }
1636         | '>'           {
1637                 $$ = gh_str02scm ("Larger");
1638         }
1639         | '.'           {
1640                 $$ = gh_str02scm ("Dot");
1641         }
1642         ;
1643
1644 script_dir:
1645         '_'     { $$ = DOWN; }
1646         | '^'   { $$ = UP; }
1647         | '-'   { $$ = CENTER; }
1648         ;
1649
1650 pre_requests:
1651         {
1652                 $$ = new Link_array<Request>;
1653         }
1654         | pre_requests open_request {
1655                 $$->push ($2);
1656         }
1657         ;
1658
1659 absolute_pitch:
1660         steno_pitch     {
1661                 $$ = $1;
1662         }
1663         ;
1664
1665 duration_length:
1666         multiplied_duration {
1667                 $$ = $1;
1668         }
1669         | verbose_duration {
1670                 $$ = $1;
1671         }       
1672         ;
1673
1674 optional_notemode_duration:
1675         {
1676                 Duration dd = THIS->default_duration_;
1677                 $$ = dd.smobbed_copy ();
1678
1679                 THIS->beam_check ($$);
1680         }
1681         | multiplied_duration   {
1682                 $$ = $1;
1683                 THIS->default_duration_ = *unsmob_duration ($$);
1684
1685                 THIS->beam_check ($$);
1686         }
1687         | verbose_duration {
1688                 $$ = $1;
1689                 THIS->default_duration_ = *unsmob_duration ($$);
1690         }       
1691         ;
1692
1693 steno_duration:
1694         bare_unsigned dots              {
1695                 int l = 0;
1696                 if (!is_duration_b ($1))
1697                         THIS->parser_error (_f ("not a duration: %d", $1));
1698                 else
1699                         l =  intlog2 ($1);
1700
1701                 $$ = Duration (l, $2).smobbed_copy ();
1702         }
1703         | DURATION_IDENTIFIER dots      {
1704                 Duration *d =unsmob_duration ($1);
1705                 Duration k (d->duration_log (),d->dot_count () + $2);
1706                 $$ = k.smobbed_copy ();
1707         }
1708         ;
1709
1710
1711
1712
1713 multiplied_duration:
1714         steno_duration {
1715                 $$ = $1;
1716         }
1717         | multiplied_duration '*' bare_unsigned {
1718                 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1719         }
1720         | multiplied_duration '*' FRACTION {
1721                 Rational  m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1722
1723                 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1724         }
1725         ;
1726
1727 fraction:
1728         FRACTION { $$ = $1; }
1729         | UNSIGNED '/' UNSIGNED {
1730                 $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3));
1731         }
1732         ;
1733
1734 dots:
1735         /* empty */     {
1736                 $$ = 0;
1737         }
1738         | dots '.' {
1739                 $$ ++;
1740         }
1741         ;
1742
1743
1744 tremolo_type: 
1745         ':'     {
1746                 $$ =0;
1747         }
1748         | ':' bare_unsigned {
1749                 if (!is_duration_b ($2))
1750                         THIS->parser_error (_f ("not a duration: %d", $2));
1751                 $$ = $2;
1752         }
1753         ;
1754
1755
1756 bass_number:
1757         DIGIT
1758         | UNSIGNED 
1759         ;
1760
1761 bass_mod:
1762         '-'     { $$ = -1; }
1763         | '+'   { $$ = 1; } 
1764         | '!'   { $$ = 0; }
1765         ;
1766
1767 bass_figure:
1768         FIGURE_SPACE {
1769                 Bass_figure_req *bfr = new Bass_figure_req;
1770                 $$ = bfr->self_scm();
1771                 scm_gc_unprotect_object ($$);
1772         }
1773         | bass_number  {
1774                 Bass_figure_req *bfr = new Bass_figure_req;
1775                 $$ = bfr->self_scm();
1776
1777                 bfr->set_mus_property ("figure", gh_int2scm ($1));
1778
1779                 scm_gc_unprotect_object ($$);
1780         }
1781         | bass_figure bass_mod {
1782                 Music *m = unsmob_music ($1);
1783                 if ($2) {
1784                         SCM salter =m->get_mus_property ("alteration");
1785                         int alter = gh_number_p( salter) ? gh_scm2int (salter) : 0;
1786                         m->set_mus_property ("alteration",
1787                                 gh_int2scm (alter + $2));
1788                 } else {
1789                         m->set_mus_property ("alteration", gh_int2scm (0));
1790                 }
1791         }
1792         ;
1793
1794 br_bass_figure:
1795         '[' bass_figure {
1796                 $$ = $2;
1797                 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1798         }
1799         | bass_figure   {
1800                 $$ = $1;
1801         }
1802         | br_bass_figure ']' {
1803                 $$ = $1;
1804                 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1805         }
1806         ;
1807
1808 figure_list:
1809         /**/            {
1810                 $$ = SCM_EOL;
1811         }
1812         | figure_list br_bass_figure {
1813                 $$ = gh_cons ($2, $1); 
1814         }
1815         ;
1816
1817 figure_spec:
1818         FIGURE_OPEN figure_list FIGURE_CLOSE {
1819                 Music * m = new Request_chord (SCM_EOL);
1820                 $2 = scm_reverse_x ($2, SCM_EOL);
1821                 m->set_mus_property ("elements",  $2);
1822                 $$ = m->self_scm ();
1823         }
1824         ;
1825
1826
1827 optional_rest:
1828         /**/   { $$ = 0; }
1829         | REST { $$ = 1; }
1830         ;
1831
1832 simple_element:
1833         pitch exclamations questions optional_notemode_duration optional_rest {
1834
1835                 Input i = THIS->pop_spot ();
1836                 if (!THIS->lexer_p_->note_state_b ())
1837                         THIS->parser_error (_ ("Have to be in Note mode for notes"));
1838
1839                 Music *n = 0;
1840                 if ($5)
1841                         n =  new Rest_req ;
1842                 else
1843                         n =  new Note_req;
1844                 
1845                 n->set_mus_property ("pitch", $1);
1846                 n->set_mus_property ("duration", $4);
1847
1848
1849                 if ($3 % 2)
1850                         n->set_mus_property ("cautionary", SCM_BOOL_T);
1851                 if ($2 % 2 || $3 % 2)
1852                         n->set_mus_property ("force-accidental", SCM_BOOL_T);
1853
1854                 Simultaneous_music*v = new Request_chord (SCM_EOL);
1855                 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1856                 scm_gc_unprotect_object (n->self_scm());
1857
1858                 v->set_spot (i);
1859                 n->set_spot (i);
1860                 $$ = v;
1861         }
1862         | figure_spec optional_notemode_duration {
1863                 Music * m = unsmob_music ($1);
1864                 Input i = THIS->pop_spot (); 
1865                 m->set_spot (i);
1866                 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1867                         {
1868                                 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1869                         }
1870                 $$ = m;
1871         }       
1872         | RESTNAME optional_notemode_duration           {
1873
1874                 Input i = THIS->pop_spot ();
1875                 SCM e = SCM_UNDEFINED;
1876                 if (ly_scm2string ($1) =="s") {
1877                         /* Space */
1878                         Skip_req * skip_p = new Skip_req;
1879                         skip_p->set_mus_property ("duration" ,$2);
1880                         skip_p->set_spot (i);
1881                         e = skip_p->self_scm ();
1882                   }
1883                   else {
1884                         Rest_req * rest_req_p = new Rest_req;
1885                         rest_req_p->set_mus_property ("duration", $2);
1886                         rest_req_p->set_spot (i);
1887                         e = rest_req_p->self_scm ();
1888                     }
1889                 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
1890                 velt_p-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1891                 velt_p->set_spot (i);
1892
1893                 $$ = velt_p;
1894         }
1895         | MULTI_MEASURE_REST optional_notemode_duration         {
1896                 Input i = THIS->pop_spot ();
1897
1898                 Skip_req * sk = new Skip_req;
1899                 sk->set_mus_property ("duration", $2);
1900                 Span_req *sp1 = new Span_req;
1901                 Span_req *sp2 = new Span_req;
1902                 sp1-> set_span_dir ( START);
1903                 sp2-> set_span_dir ( STOP);
1904                 SCM r = ly_str02scm ("rest");
1905                 sp1->set_mus_property ("span-type", r);
1906                 sp2->set_mus_property ("span-type", r);
1907
1908                 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1909                 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1910                 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1911                 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1912                 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1913                 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1914
1915                 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1916
1917                 $$ = new Sequential_music (SCM_EOL);
1918                 $$->set_mus_property ("elements", ms);
1919         }
1920         | STRING optional_notemode_duration     {
1921                 Input i = THIS->pop_spot ();
1922
1923                 Lyric_req* lreq_p = new Lyric_req;
1924                 lreq_p->set_mus_property ("text", $1);
1925                 lreq_p->set_mus_property ("duration",$2);
1926                 lreq_p->set_spot (i);
1927                 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
1928                 velt_p->set_mus_property ("elements", scm_list_n (lreq_p->self_scm (), SCM_UNDEFINED));
1929
1930                 $$= velt_p;
1931         }
1932         | chord {
1933                 Input i = THIS->pop_spot ();
1934
1935                 if (!THIS->lexer_p_->chord_state_b ())
1936                         THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1937                 $$ = $1;
1938         }
1939         ;
1940
1941
1942 chord:
1943         steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1944                 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1945                 $$->set_spot (THIS->here_input ());
1946         };
1947
1948 chord_additions: 
1949         {
1950                 $$ = SCM_EOL;
1951         } 
1952         | CHORD_COLON chord_notes {
1953                 $$ = $2;
1954         }
1955         ;
1956
1957 chord_notes:
1958         chord_step {
1959                 $$ = $1
1960         }
1961         | chord_notes '.' chord_step {
1962                 $$ = gh_append2 ($$, $3);
1963         }
1964         ;
1965
1966 chord_subtractions: 
1967         {
1968                 $$ = SCM_EOL;
1969         } 
1970         | CHORD_CARET chord_notes {
1971                 $$ = $2;
1972         }
1973         ;
1974
1975
1976 chord_inversion:
1977         {
1978                 $$ = SCM_EOL;
1979         }
1980         | '/' steno_tonic_pitch {
1981                 $$ = $2;
1982         }
1983         ;
1984
1985 chord_bass:
1986         {
1987                 $$ = SCM_EOL;
1988         }
1989         | CHORD_BASS steno_tonic_pitch {
1990                 $$ = $2;
1991         }
1992         ;
1993
1994 chord_step:
1995         chord_note {
1996                 $$ = gh_cons ($1, SCM_EOL);
1997         }
1998         | CHORDMODIFIER_PITCH {
1999                 $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2000         }
2001         | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2002                 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2003                         $2, SCM_UNDEFINED);
2004         }
2005         ;
2006
2007 chord_note:
2008         bare_unsigned {
2009                  Pitch m;
2010                 m.notename_i_ = ($1 - 1) % 7;
2011                 m.octave_i_ = $1 > 7 ? 1 : 0;
2012                 m.alteration_i_ = 0;
2013
2014                 $$ = m.smobbed_copy ();
2015         } 
2016         | bare_unsigned '+' {
2017                 Pitch m;
2018                 m.notename_i_ = ($1 - 1) % 7;
2019                 m.octave_i_ = $1 > 7 ? 1 : 0;
2020                 m.alteration_i_ = 1;
2021
2022
2023                 $$ = m.smobbed_copy ();
2024         }
2025         | bare_unsigned CHORD_MINUS {
2026                 Pitch m;
2027                 m.notename_i_ = ($1 - 1) % 7;
2028                 m.octave_i_ = $1 > 7 ? 1 : 0;
2029                 m.alteration_i_ = -1;
2030
2031                 $$ = m.smobbed_copy ();
2032         }
2033         ;
2034
2035 /*
2036         UTILITIES
2037  */
2038 number_expression:
2039         number_expression '+' number_term {
2040                 $$ = scm_sum ($1, $3);
2041         }
2042         | number_expression '-' number_term {
2043                 $$ = scm_difference ($1, $3);
2044         }
2045         | number_term 
2046         ;
2047
2048 number_term:
2049         number_factor {
2050                 $$ = $1;
2051         }
2052         | number_factor '*' number_factor {
2053                 $$ = scm_product ($1, $3);
2054         }
2055         | number_factor '/' number_factor {
2056                 $$ = scm_divide ($1, $3);
2057         }
2058         ;
2059
2060 number_factor:
2061         '(' number_expression ')'       {
2062                 $$ = $2;
2063         }
2064         | '-'  number_factor { /* %prec UNARY_MINUS */
2065                 $$ = scm_difference ($2, SCM_UNDEFINED);
2066         }
2067         | bare_number
2068         ;
2069
2070
2071 bare_number:
2072         UNSIGNED        {
2073                 $$ = gh_int2scm ($1);
2074         }
2075         | REAL          {
2076                 $$ = $1;
2077         }
2078         | NUMBER_IDENTIFIER             {
2079                 $$ = $1;
2080         }
2081         | REAL CM_T     {
2082                 $$ = gh_double2scm (gh_scm2double ($1) CM );
2083         }
2084         | REAL PT_T     {
2085                 $$ = gh_double2scm (gh_scm2double ($1) PT);
2086         }
2087         | REAL IN_T     {
2088                 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2089         }
2090         | REAL MM_T     {
2091                 $$ = gh_double2scm (gh_scm2double ($1) MM);
2092         }
2093         | REAL CHAR_T   {
2094                 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2095         }
2096         ;
2097
2098
2099 bare_unsigned:
2100         UNSIGNED {
2101                         $$ = $1;
2102         }
2103         | DIGIT {
2104                 $$ = $1;
2105         }
2106         ;
2107
2108 bare_int:
2109         bare_number {
2110                 if (scm_integer_p ($1) == SCM_BOOL_T)
2111                 {
2112                         int k = gh_scm2int ($1);
2113                         $$ = k;
2114                 } else
2115                 {
2116                         THIS->parser_error (_ ("need integer number arg"));
2117                         $$ = 0;
2118                 }
2119         }
2120         | '-' bare_int {
2121                 $$ = -$2;
2122         }
2123         ;
2124
2125
2126 string:
2127         STRING          {
2128                 $$ = $1;
2129         }
2130         | STRING_IDENTIFIER     {
2131                 $$ = $1;
2132         }
2133         | string '+' string {
2134                 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2135         }
2136         ;
2137
2138
2139 exclamations:
2140                 { $$ = 0; }
2141         | exclamations '!'      { $$ ++; }
2142         ;
2143
2144 questions:
2145                 { $$ = 0; }
2146         | questions '?' { $$ ++; }
2147         ;
2148
2149
2150 %%
2151
2152 void
2153 My_lily_parser::set_yydebug (bool )
2154 {
2155 #if 0
2156         yydebug = b;
2157 #endif
2158 }
2159
2160 extern My_lily_parser * current_parser;
2161
2162 void
2163 My_lily_parser::do_yyparse ()
2164 {
2165
2166         current_parser = this;;
2167         yyparse ((void*)this);
2168 }
2169
2170
2171 /*
2172 Should make this optional?    It will also complain when you do
2173
2174         [s4]
2175
2176 which is entirely legitimate.
2177
2178 Or we can scrap it. Barchecks should detect wrong durations, and
2179 skipTypesetting speeds it up a lot.
2180 */
2181 void
2182 My_lily_parser::beam_check (SCM dur)
2183 {
2184   Duration *d = unsmob_duration (dur);
2185   if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2186     {
2187       Music * m = unsmob_music (last_beam_start_);
2188       m->origin ()->warning (_("Suspect duration found following this beam"));
2189     }
2190   last_beam_start_ = SCM_EOL;
2191 }