]> git.donarmstrong.com Git - lilypond.git/blob - lily/lexer.ll
* lily/my-lily-parser.cc (ly:parser-add-book-and-score): New function.
[lilypond.git] / lily / lexer.ll
1 %{ // -*-Fundamental-*-
2 /*
3   lexer.ll -- implement the Flex lexer
4
5   source file of the LilyPond music typesetter
6
7   (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8            Jan Nieuwenhuizen <janneke@gnu.org>
9 */
10
11
12 /*
13   backup rules
14
15   after making a change to the lexer rules, run 
16       flex -b <this lexer file>
17   and make sure that 
18       lex.backup
19   contains no backup states, but only the reminder
20       Compressed tables always back up.
21  (don-t forget to rm lex.yy.cc :-)
22  */
23
24
25 #include <stdio.h>
26 #include <ctype.h>
27 #include <errno.h>
28
29 /* Flex >= 2.5.29 fix; FlexLexer.h's multiple include bracing breaks
30    when building the actual lexer.  */
31 #define LEXER_CC
32
33 #include <iostream>
34 using namespace std;
35
36 #include "source-file.hh"
37 #include "parse-scm.hh"
38 #include "lily-guile.hh"
39 #include "string.hh"
40 #include "string-convert.hh"
41 #include "my-lily-lexer.hh"
42 #include "interval.hh"
43 #include "lily-guile.hh"
44 #include "parser.hh"
45 #include "warn.hh"
46 #include "main.hh"
47 #include "version.hh"
48 #include "lilypond-input-version.hh"
49 #include "context-def.hh"
50 #include "identifier-smob.hh"
51
52 /*
53 RH 7 fix (?)
54 */
55 #define isatty HORRIBLEKLUDGE
56
57 void strip_trailing_white (String&);
58 void strip_leading_white (String&);
59 String lyric_fudge (String s);
60
61 SCM lookup_markup_command (String s);
62 bool is_valid_version (String s);
63
64
65 #define start_quote()   \
66         yy_push_state (quote);\
67         yylval.string = new String
68
69 #define start_lyric_quote()     \
70         yy_push_state (lyric_quote);\
71         yylval.string = new String
72
73 #define yylval \
74         (*(YYSTYPE*)lexval)
75
76 #define YY_USER_ACTION  add_lexed_char (YYLeng ());
77 /*
78
79 LYRICS          ({AA}|{TEX})[^0-9 \t\n\f]*
80
81 */
82
83
84 SCM scan_fraction (String);
85 SCM (* scm_parse_error_handler) (void *);
86
87
88
89 %}
90
91 %option c++
92 %option noyywrap
93 %option nodefault
94 %option debug
95 %option yyclass="My_lily_lexer"
96 %option stack
97 %option never-interactive 
98 %option warn
99
100 %x chords
101 %x encoding
102 %x figures
103 %x incl
104 %x lyrics
105 %x lyric_quote
106 %x longcomment
107 %x markup 
108 %x notes
109 %x quote
110 %x renameinput
111 %x version
112
113 A               [a-zA-Z]
114 AA              {A}|_
115 N               [0-9]
116 AN              {AA}|{N}
117 PUNCT           [?!:'`]
118 ACCENT          \\[`'"^]
119 NATIONAL        [\001-\006\021-\027\031\036\200-\377]
120 TEX             {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
121 WORD            {A}{AN}*
122 ALPHAWORD       {A}+
123 DIGIT           {N}
124 UNSIGNED        {N}+
125 E_UNSIGNED      \\{N}+
126 FRACTION        {N}+\/{N}+
127 INT             -?{UNSIGNED}
128 REAL            ({INT}\.{N}*)|(-?\.{N}+)
129 KEYWORD         \\{WORD}
130 WHITE           [ \n\t\f\r]
131 HORIZONTALWHITE         [ \t]
132 BLACK           [^ \n\t\f\r]
133 RESTNAME        [rs]
134 NOTECOMMAND     \\{A}+
135 MARKUPCOMMAND   \\({A}|[-_])+
136 LYRICS          ({AA}|{TEX})[^0-9 \t\n\r\f]*
137 ESCAPED         [nt\\'"]
138 EXTENDER        __
139 HYPHEN          --
140 %%
141
142
143 <*>\r           {
144         // windows-suck-suck-suck
145 }
146
147 <INITIAL,chords,incl,markup,lyrics,notes,figures>{
148   "%{"  {
149         yy_push_state (longcomment);
150   }
151   %[^{\n\r].*[\n\r]     {
152   }
153   %[^{\n\r]     { // backup rule
154   }
155   %[\n\r]       {
156   }
157   %[^{\n\r].*   {
158   }
159   {WHITE}+      {
160
161   }
162 }
163
164 <INITIAL>\\encoding{WHITE}*     {
165         yy_push_state (encoding);
166 }
167 <INITIAL,chords,lyrics,notes,figures>\\version{WHITE}*  {
168         yy_push_state (version);
169 }
170 <INITIAL,chords,lyrics,notes,figures>\\renameinput{WHITE}*      {
171         yy_push_state (renameinput);
172 }
173 <encoding>\"[^"]*\"     {
174         String s (YYText () + 1);
175         s = s.left_string (s.index_last ('\"'));
176         set_encoding (s);
177         yy_pop_state ();
178 }
179 <version>\"[^"]*\"     { /* got the version number */
180         String s (YYText () + 1);
181         s = s.left_string (s.index_last ('\"'));
182
183         yy_pop_state ();
184         if (!is_valid_version (s))
185                 return INVALID;
186 }
187 <renameinput>\"[^"]*\"     {
188         String s (YYText ()+1);
189         s = s.left_string (s.index_last ('\"'));
190
191         yy_pop_state();
192         this->here_input().source_file_->name_ = s;
193         progress_indication ("\n");
194         progress_indication (_f ("input renamed to: `%s'", s.to_str0 ()));
195         progress_indication ("\n");
196         scm_module_define (ly_car (scopes_),
197                      ly_symbol2scm ("input-file-name"),
198                      scm_makfrom0str (s.to_str0()));
199
200 }
201 <encoding>.     {
202         LexerError (_ ("No quoted string found after \\encoding").to_str0 ());
203         yy_pop_state ();
204 }
205 <version>.      {
206         LexerError (_ ("No quoted string found after \\version").to_str0 ());
207         yy_pop_state ();
208 }
209 <renameinput>.  {
210         LexerError (_ ("No quoted string found after \\renameinput").to_str0 ());
211         yy_pop_state ();
212 }
213 <longcomment>{
214         [^\%]*          {
215         }
216         \%*[^}%]*               {
217
218         }
219         "%"+"}"         {
220                 yy_pop_state ();
221         }
222         <<EOF>>         {
223                 LexerError (_ ("EOF found inside a comment").to_str0 ());
224                 main_input_b_ = false;
225                 if (! close_input ()) 
226                   yyterminate (); // can't move this, since it actually rets a YY_NULL
227         }
228 }
229
230
231 <INITIAL,chords,lyrics,notes,figures>\\maininput           {
232         if (!main_input_b_)
233         {
234                 start_main_input ();
235                 main_input_b_ = true;
236                 SCM nn = lookup_identifier ("pitchnames");
237                 push_note_state (alist_to_hashq (nn));
238         }
239         else
240                 error (_ ("\\maininput not allowed outside init files"));
241 }
242
243 <INITIAL,chords,lyrics,figures,notes>\\include           {
244         yy_push_state (incl);
245 }
246 <incl>\"[^"]*\";?   { /* got the include file name */
247 /* FIXME: semicolon? */
248         String s (YYText ()+1);
249         s = s.left_string (s.index_last ('"'));
250
251         new_input (s, sources_);
252         yy_pop_state ();
253 }
254 <incl>\\{BLACK}*;?{WHITE} { /* got the include identifier */
255 /* FIXME: semicolon? */
256         String s = YYText () + 1;
257         strip_trailing_white (s);
258         if (s.length () && (s[s.length () - 1] == ';'))
259           s = s.left_string (s.length () - 1);
260
261         SCM sid = lookup_identifier (s);
262         if (ly_c_string_p (sid)) {
263                 new_input (ly_scm2string (sid), sources_);
264                 yy_pop_state ();
265         } else { 
266             String msg (_f ("wrong or undefined identifier: `%s'", s ));
267
268             LexerError (msg.to_str0 ());
269             SCM err = scm_current_error_port ();
270             scm_puts ("This value was found in the table: ", err);
271             scm_display (sid, err);
272           }
273 }
274 <incl>\"[^"]*   { // backup rule
275         error (_ ("Missing end quote"));
276         exit (1);
277 }
278 <chords,notes,figures>{RESTNAME}        {
279         const char *s = YYText ();
280         yylval.scm = scm_makfrom0str (s);
281         return RESTNAME;
282 }
283 <chords,notes,figures>R         {
284         return MULTI_MEASURE_REST;
285 }
286 <INITIAL,markup,chords,lyrics,notes,figures>#   { //embedded scm
287         //char const* s = YYText () + 1;
288         char const* s = here_str0 ();
289         int n = 0;
290         SCM sval = ly_parse_scm (s, &n, here_input (),
291                 safe_global_b && main_input_b_);
292
293         if (sval == SCM_UNDEFINED)
294         {
295                 sval = SCM_UNSPECIFIED;
296                 error_level_ = 1;
297         }
298
299         for (int i=0; i < n; i++)
300         {
301                 yyinput ();
302         }
303         char_count_stack_.top () += n;
304
305         if (unpack_identifier (sval) != SCM_UNDEFINED)
306         {
307                 yylval.scm = unpack_identifier(sval);
308                 return identifier_type (yylval.scm);
309         }
310                 
311         yylval.scm = sval;
312         return SCM_T;
313 }
314 <INITIAL,notes,lyrics>{ 
315         \<\<   {
316                 return LESSLESS;
317         }
318         \>\>   {
319                 return MOREMORE;
320         }
321 }
322 <figures>{
323         _       {
324                 return FIGURE_SPACE;
325         }
326         \>              {
327                 return FIGURE_CLOSE;
328         }
329         \<      {
330                 return FIGURE_OPEN;
331         }
332 }
333
334 <notes,figures>{
335         {ALPHAWORD}     {
336                 return scan_bare_word (YYText ());
337         }
338
339         {NOTECOMMAND}   {
340                 return scan_escaped_word (YYText () + 1); 
341         }
342         {FRACTION}      {
343                 yylval.scm =  scan_fraction (YYText ());
344                 return FRACTION;
345         }
346
347         {DIGIT}         {
348                 yylval.i = String_convert::dec2int (String (YYText ()));
349                 return DIGIT;
350         }
351         {UNSIGNED}              {
352                 yylval.i = String_convert::dec2int (String (YYText ()));
353                 return UNSIGNED;
354         }
355         {E_UNSIGNED}    {
356                 yylval.i = String_convert::dec2int (String (YYText () +1));
357                 return E_UNSIGNED;
358         }
359
360         \" {
361                 start_quote ();
362         }
363 }
364
365 \"              {
366         start_quote ();
367 }
368 <quote>{
369         \\{ESCAPED}     {
370                 *yylval.string += to_string (escaped_char (YYText ()[1]));
371         }
372         [^\\"]+ {
373                 *yylval.string += YYText ();
374         }
375         \"      {
376
377                 yy_pop_state ();
378
379                 /* yylval is union. Must remember STRING before setting SCM*/
380                 String *sp = yylval.string;
381                 yylval.scm = scm_makfrom0str (sp->to_str0 ());
382                 delete sp;
383                 return STRING;
384         }
385         .       {
386                 *yylval.string += YYText ();
387         }
388 }
389 <lyric_quote>{
390         \\{ESCAPED}     {
391                 *yylval.string += to_string (escaped_char (YYText ()[1]));
392         }
393         [^\\"]+ {
394                 *yylval.string += YYText ();
395         }
396         \"      {
397
398                 yy_pop_state ();
399
400                 /* yylval is union. Must remember STRING before setting SCM*/
401                 String *sp = yylval.string;
402                 yylval.scm = scm_makfrom0str (sp->to_str0 ());
403                 delete sp;
404                 return LYRICS_STRING;
405         }
406         .       {
407                 *yylval.string += YYText ();
408         }
409 }
410
411 <lyrics>{
412         \" {
413                 start_lyric_quote ();
414         }
415         {FRACTION}      {
416                 yylval.scm =  scan_fraction (YYText ());
417                 return FRACTION;
418         }
419         {UNSIGNED}              {
420                 yylval.i = String_convert::dec2int (String (YYText ()));
421                 return UNSIGNED;
422         }
423         {NOTECOMMAND}   {
424                 return scan_escaped_word (YYText () + 1);
425         }
426         {LYRICS} {
427                 /* ugr. This sux. */
428                 String s (YYText ()); 
429                 if (s == "__")
430                         return yylval.i = EXTENDER;
431                 if (s == "--")
432                         return yylval.i = HYPHEN;
433                 s = lyric_fudge (s);
434
435                 char c = s[s.length () - 1];
436                 if (c == '{' ||  c == '}') // brace open is for not confusing dumb tools.
437                         here_input ().warning (
438                                 _ ("Brace found at end of lyric.  Did you forget a space?"));
439                 yylval.scm = scm_makfrom0str (s.to_str0 ());
440
441
442                 return LYRICS_STRING;
443         }
444         . {
445                 return YYText ()[0];
446         }
447 }
448 <chords>{
449         {ALPHAWORD}     {
450                 return scan_bare_word (YYText ());
451         }
452         {NOTECOMMAND}   {
453                 return scan_escaped_word (YYText () + 1);
454         }
455         {FRACTION}      {
456                 yylval.scm =  scan_fraction (YYText ());
457                 return FRACTION;
458         }
459         {UNSIGNED}              {
460                 yylval.i = String_convert::dec2int (String (YYText ()));
461                 return UNSIGNED;
462         }
463         \" {
464                 start_quote ();
465         }
466         -  {
467                 return CHORD_MINUS;
468         }
469         :  {
470                 return CHORD_COLON;
471         }
472         \/\+ {
473                 return CHORD_BASS;
474         }
475         \/  {
476                 return CHORD_SLASH;
477         }
478         \^  {
479                 return CHORD_CARET;
480         }
481         . {
482                 return YYText ()[0];
483         }
484 }
485
486
487 <markup>{
488         \" {
489                 start_quote ();
490         }
491         \< {
492                 return '<';
493         }
494         \> {
495                 return '>';
496         }
497         {MARKUPCOMMAND} {
498                 String str (YYText () + 1);
499                 SCM s = lookup_markup_command (str);
500
501                 if (ly_c_pair_p (s) && ly_c_symbol_p (ly_cdr (s)) ) {
502                         yylval.scm = ly_car(s);
503                         SCM tag = ly_cdr(s);
504                         if (tag == ly_symbol2scm("markup0"))
505                                 return MARKUP_HEAD_MARKUP0;
506                         if (tag == ly_symbol2scm("empty"))
507                                 return MARKUP_HEAD_EMPTY;
508                         else if (tag == ly_symbol2scm ("markup0-markup1"))
509                                 return MARKUP_HEAD_MARKUP0_MARKUP1;
510                         else if (tag == ly_symbol2scm ("markup-list0"))
511                                 return MARKUP_HEAD_LIST0;
512                         else if (tag == ly_symbol2scm ("scheme0"))
513                                 return MARKUP_HEAD_SCM0;
514                         else if (tag == ly_symbol2scm ("scheme0-scheme1"))
515                                 return MARKUP_HEAD_SCM0_SCM1;
516                         else if (tag == ly_symbol2scm ("scheme0-markup1"))
517                                 return MARKUP_HEAD_SCM0_MARKUP1;
518                         else if (tag == ly_symbol2scm ("scheme0-scheme1-markup2"))
519                                 return MARKUP_HEAD_SCM0_SCM1_MARKUP2;
520                         else if (tag == ly_symbol2scm ("scheme0-scheme1-scheme2"))
521                                 return MARKUP_HEAD_SCM0_SCM1_SCM2;
522                         else {
523                                 programming_error ("No parser tag defined for this signature. Abort"); 
524                                 ly_display_scm (s);
525                                 assert(false);
526                         }
527                 } else
528                         return scan_escaped_word (str);
529         }
530         [{}]    {
531                 return YYText ()[0];
532         }
533         [^#{}"\\ \t\n\r\f]+ {
534                 String s (YYText ()); 
535
536                 char c = s[s.length () - 1];
537                 /* brace open is for not confusing dumb tools.  */
538                 if (c == '{' ||  c == '}')
539                         here_input ().warning (
540                                 _ ("Brace found at end of markup.  Did you forget a space?"));
541                 yylval.scm = scm_makfrom0str (s.to_str0 ());
542
543
544                 return STRING;
545         }
546         .  {
547                 return YYText()[0];
548         }
549 }
550
551 <<EOF>> {
552         if (main_input_b_)
553         {
554                 main_input_b_ = false;
555                 if (!close_input ())
556                 /* Returns YY_NULL */
557                         yyterminate ();
558                 return EOI;
559         }
560         else if (!close_input ())
561                 /* Returns YY_NULL */
562                 yyterminate ();
563 }
564
565
566 {WORD}  {
567         return scan_bare_word (YYText ());
568 }
569 {KEYWORD}       {
570         return scan_escaped_word (YYText () + 1);
571 }
572 {REAL}          {
573         Real r;
574         int cnv=sscanf (YYText (), "%lf", &r);
575         assert (cnv == 1);
576
577         yylval.scm = scm_make_real (r);
578         return REAL;
579 }
580
581 {UNSIGNED}      {
582         yylval.i = String_convert::dec2int (String (YYText ()));
583         return UNSIGNED;
584 }
585
586
587 [{}]    {
588
589         return YYText ()[0];
590 }
591 [*:=]           {
592         char c = YYText ()[0];
593
594         return c;
595 }
596
597 <INITIAL,notes,figures>.        {
598         return YYText ()[0];
599 }
600
601 <INITIAL,lyrics,notes,figures>\\. {
602     char c= YYText ()[1];
603
604     switch (c) {
605     case '>':
606         return E_BIGGER;
607     case '<':
608         return E_SMALLER;
609     case '!':
610         return E_EXCLAMATION;
611     case '(':
612         return E_OPEN;
613     case ')':
614         return E_CLOSE;
615     case '[':
616         return E_LEFTSQUARE;
617     case ']':
618         return E_RIGHTSQUARE;
619     case '~':
620         return E_TILDE;
621     case '\\':
622         return E_BACKSLASH;
623
624     default:
625         return E_CHAR;
626     }
627 }
628
629 <*>.            {
630         String msg = _f ("invalid character: `%c'", YYText ()[0]);
631         LexerError (msg.to_str0 ());
632         return YYText ()[0];
633 }
634
635 %%
636
637 void
638 My_lily_lexer::push_chord_state (SCM tab)
639 {
640         pitchname_tab_stack_ = scm_cons (tab, pitchname_tab_stack_);
641         yy_push_state (chords);
642 }
643
644 void
645 My_lily_lexer::push_figuredbass_state ()
646 {
647         yy_push_state (figures);
648 }
649
650 void
651 My_lily_lexer::push_initial_state ()
652 {
653         yy_push_state (INITIAL);
654 }
655
656 void
657 My_lily_lexer::push_lyric_state ()
658 {
659         yy_push_state (lyrics);
660 }
661
662 void
663 My_lily_lexer::push_markup_state ()
664 {
665         yy_push_state (markup);
666 }
667
668 void
669 My_lily_lexer::push_note_state (SCM tab)
670 {
671         pitchname_tab_stack_ = scm_cons (tab, pitchname_tab_stack_);
672         yy_push_state (notes);
673 }
674
675 void
676 My_lily_lexer::pop_state ()
677 {
678         if (YYSTATE == notes || YYSTATE == chords)
679                 pitchname_tab_stack_ = ly_cdr (pitchname_tab_stack_);
680         yy_pop_state ();
681 }
682
683 int
684 My_lily_lexer::identifier_type (SCM sid)
685 {
686         int k = try_special_identifiers (&yylval.scm , sid);
687         return k >= 0  ? k : SCM_IDENTIFIER;
688 }
689
690
691 int
692 My_lily_lexer::scan_escaped_word (String str)
693 {
694         // use more SCM for this.
695
696 //      SCM sym = ly_symbol2scm (str.to_str0 ());
697
698         int l = lookup_keyword (str);
699         if (l != -1) {
700                 return l;
701         }
702         SCM sid = lookup_identifier (str);
703         if (sid != SCM_UNDEFINED)
704         {
705                 yylval.scm = sid;
706                 return identifier_type (sid);
707         }
708
709         String msg (_f ("unknown escaped string: `\\%s'", str));        
710         LexerError (msg.to_str0 ());
711
712         yylval.scm = scm_makfrom0str (str.to_str0 ());
713
714         return STRING;
715 }
716
717 int
718 My_lily_lexer::scan_bare_word (String str)
719 {
720         SCM sym = ly_symbol2scm (str.to_str0 ());
721         if ((YYSTATE == notes) || (YYSTATE == chords)) {
722                 SCM handle = SCM_BOOL_F;
723                 if (ly_c_pair_p (pitchname_tab_stack_))
724                         handle = scm_hashq_get_handle (ly_car (pitchname_tab_stack_), sym);
725                 
726                 if (ly_c_pair_p (handle)) {
727                         yylval.scm = ly_cdr (handle);
728                         if (unsmob_pitch (yylval.scm)) 
729                             return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH;
730                         else if (ly_c_symbol_p (yylval.scm))
731                             return DRUM_PITCH;
732                 }
733                 else if ((handle = scm_hashq_get_handle (chordmodifier_tab_, sym))!= SCM_BOOL_F)
734                 {
735                     yylval.scm = ly_cdr (handle);
736                     return CHORD_MODIFIER;
737                 }
738         }
739
740         yylval.scm = scm_makfrom0str (str.to_str0 ());
741         return STRING;
742 }
743
744 bool
745 My_lily_lexer::is_note_state () const
746 {
747         return YY_START == notes;
748 }
749
750 bool
751 My_lily_lexer::is_chord_state () const
752 {
753         return YY_START == chords;
754 }
755
756 bool
757 My_lily_lexer::is_lyric_state () const
758 {
759         return YY_START == lyrics;
760 }
761
762 bool
763 My_lily_lexer::is_figure_state () const
764 {
765         return YY_START == figures;
766 }
767
768 /*
769  urg, belong to String (_convert)
770  and should be generalised 
771  */
772 void
773 strip_leading_white (String&s)
774 {
775         int i=0;
776         for (;  i < s.length (); i++) 
777                 if (!isspace (s[i]))
778                         break;
779
780         s = s.nomid_string (0, i);
781 }
782
783 void
784 strip_trailing_white (String&s)
785 {
786         int i=s.length ();      
787         while (i--) 
788                 if (!isspace (s[i]))
789                         break;
790
791         s = s.left_string (i+1);
792 }
793
794
795
796 /* 2.1.2x something -> \property -> \set. */ 
797 Lilypond_version oldest_version ("2.2.0");
798
799
800 bool
801 is_valid_version (String s)
802 {
803   Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL );
804   Lilypond_version ver (s);
805   if (! ((ver >= oldest_version) && (ver <= current)))
806         {       
807                 non_fatal_error (_f ("Incorrect lilypond version: %s (%s, %s)", ver.to_string (), oldest_version.to_string (), current.to_string ()));
808                 non_fatal_error (_ ("Consider updating the input with the convert-ly script")); 
809                 return false;
810     }
811   return true;
812 }
813         
814
815 /*
816   substitute _ and \,
817 */
818 String
819 lyric_fudge (String s)
820 {
821   char  * chars  =s.get_copy_str0 ();
822
823   for (char * p = chars; *p ; p++)
824     {
825       if (*p == '_' && (p == chars || *(p-1) != '\\'))
826         *p = ' ';
827     }
828   
829   s = String (chars);
830   delete[] chars;
831
832   int i =0;     
833   if ((i=s.index ("\\,")) != -1)   // change "\," to TeX's "\c "
834     {
835       * (s.get_str0 () + i + 1) = 'c';
836       s = s.left_string (i+2) + " " + s.right_string (s.length ()-i-2);
837     }
838
839   return s;
840 }
841
842 /*
843 Convert "NUM/DEN" into a '(NUM . DEN) cons.
844 */
845 SCM
846 scan_fraction (String frac)
847 {
848         int i = frac.index ('/');
849         int l = frac.length ();
850         String left = frac.left_string (i);
851         String right = frac.right_string (l - i - 1);
852
853         int n = String_convert::dec2int (left);
854         int d = String_convert::dec2int (right);
855         return scm_cons (scm_int2num (n), scm_int2num (d));
856 }
857
858 // Breaks for flex 2.5.31
859 #if 0
860 /* avoid silly flex induced gcc warnings */
861 static void yy_push_state (int) {;}
862 static void yy_pop_state () {;}
863 static int yy_top_state () { return 0; }
864
865 static void
866 avoid_silly_flex_induced_gcc_warnings ()
867 {
868         (void)yy_start_stack_ptr;
869         (void)yy_start_stack_depth;
870         (void)yy_start_stack;
871         yy_push_state (0);
872         yy_pop_state ();
873         yy_top_state ();
874         avoid_silly_flex_induced_gcc_warnings ();
875 }
876 #endif
877
878 SCM
879 lookup_markup_command (String s)
880 {
881         SCM proc = ly_scheme_function ("lookup-markup-command");
882         return scm_call_1 (proc, scm_makfrom0str (s.to_str0 ()));
883 }