1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $Header: /home/lilydev/vc/lilypond.git/../lilypond.cvsrepo/lilypond/lily/Attic/lexer.cc,v 1.3 1998/04/09 08:42:17 fred Exp $
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
13 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
27 /* Use prototypes in function declarations. */
30 /* The "const" storage-class-modifier is valid. */
33 #else /* ! __cplusplus */
41 #endif /* ! __cplusplus */
60 #define YY_PROTO(proto) proto
62 #define YY_PROTO(proto) ()
65 /* Returned upon end-of-file. */
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
79 #define BEGIN yy_start = 1 + 2 *
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
103 #define EOB_ACT_CONTINUE_SCAN 0
104 #define EOB_ACT_END_OF_FILE 1
105 #define EOB_ACT_LAST_MATCH 2
107 /* The funky do-while in the following #define is used to turn the definition
108 * int a single C statement (which needs a semi-colon terminator). This
109 * avoids problems with code like:
111 * if ( condition_holds )
114 * do_something_else();
116 * Prior to using the do-while the compiler would get upset at the
117 * "else" because it interpreted the "if" statement as being all
118 * done when it reached the ';' after the yyless() call.
121 /* Return all but the first 'n' matched characters back to the input stream. */
126 /* Undo effects of setting up yytext. */ \
127 *yy_cp = yy_hold_char; \
128 YY_RESTORE_YY_MORE_OFFSET \
129 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
130 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
134 #define unput(c) yyunput( c, yytext_ptr )
136 /* The following is because we cannot portably get our hands on size_t
137 * (without autoconf's help, which isn't available because we want
138 * flex-generated scanners to compile on their own).
140 typedef unsigned int yy_size_t
;
143 struct yy_buffer_state
145 istream
* yy_input_file
;
147 char *yy_ch_buf
; /* input buffer */
148 char *yy_buf_pos
; /* current position in input buffer */
150 /* Size of input buffer in bytes, not including room for EOB
153 yy_size_t yy_buf_size
;
155 /* Number of characters read into yy_ch_buf, not including EOB
160 /* Whether we "own" the buffer - i.e., we know we created it,
161 * and can realloc() it to grow it, and should free() it to
164 int yy_is_our_buffer
;
166 /* Whether this is an "interactive" input source; if so, and
167 * if we're using stdio for input, then we want to use getc()
168 * instead of fread(), to make sure we stop fetching input after
171 int yy_is_interactive
;
173 /* Whether we're considered to be at the beginning of a line.
174 * If so, '^' rules will be active on the next match, otherwise
179 /* Whether to try to fill the input buffer when we reach the
184 int yy_buffer_status
;
185 #define YY_BUFFER_NEW 0
186 #define YY_BUFFER_NORMAL 1
187 /* When an EOF's been seen but there's still some text to process
188 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
189 * shouldn't try reading from the input source any more. We might
190 * still have a bunch of tokens to match, though, because of
191 * possible backing-up.
193 * When we actually see the EOF, we change the status to "new"
194 * (via yyrestart()), so that the user can continue scanning by
195 * just pointing yyin at a new input file.
197 #define YY_BUFFER_EOF_PENDING 2
201 /* We provide macros for accessing buffer states in case in the
202 * future we want to put the buffer states in a more general
205 #define YY_CURRENT_BUFFER yy_current_buffer
209 static void *yy_flex_alloc
YY_PROTO(( yy_size_t
));
210 static void *yy_flex_realloc
YY_PROTO(( void *, yy_size_t
));
211 static void yy_flex_free
YY_PROTO(( void * ));
213 #define yy_new_buffer yy_create_buffer
215 #define yy_set_interactive(is_interactive) \
217 if ( ! yy_current_buffer ) \
218 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
219 yy_current_buffer->yy_is_interactive = is_interactive; \
222 #define yy_set_bol(at_bol) \
224 if ( ! yy_current_buffer ) \
225 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
226 yy_current_buffer->yy_at_bol = at_bol; \
229 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
233 #define YY_SKIP_YYWRAP
236 typedef unsigned char YY_CHAR
;
237 #define yytext_ptr yytext
238 #define YY_INTERACTIVE
242 #include <FlexLexer.h>
243 int yyFlexLexer::yylex()
245 LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" );
249 #define YY_DECL int My_lily_lexer::yylex()
252 /* Done after the current pattern has been matched and before the
253 * corresponding action - sets up yytext.
255 #define YY_DO_BEFORE_ACTION \
256 yytext_ptr = yy_bp; \
257 yyleng = (int) (yy_cp - yy_bp); \
258 yy_hold_char = *yy_cp; \
262 #define YY_NUM_RULES 47
263 #define YY_END_OF_BUFFER 48
264 static yyconst
short int yy_accept
[124] =
266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
267 8, 8, 48, 44, 7, 7, 1, 26, 18, 44,
268 41, 44, 44, 39, 36, 44, 40, 46, 7, 1,
269 13, 46, 34, 35, 7, 1, 31, 18, 35, 32,
270 34, 35, 25, 20, 23, 21, 44, 14, 28, 28,
271 1, 29, 30, 8, 8, 1, 9, 8, 7, 18,
272 16, 4, 5, 2, 0, 0, 38, 38, 39, 36,
273 45, 17, 37, 37, 13, 12, 34, 32, 34, 33,
274 42, 43, 33, 20, 24, 19, 21, 22, 22, 28,
275 27, 8, 8, 9, 9, 10, 6, 3, 38, 17,
277 15, 37, 37, 33, 33, 22, 22, 37, 33, 22,
278 37, 33, 22, 37, 33, 22, 37, 33, 22, 11,
282 static yyconst
int yy_ec
[256] =
284 1, 1, 1, 1, 1, 1, 2, 2, 3, 4,
285 2, 3, 5, 2, 2, 2, 1, 1, 1, 1,
286 1, 1, 1, 2, 1, 2, 2, 2, 2, 1,
287 2, 3, 6, 7, 2, 8, 9, 2, 10, 2,
288 2, 11, 2, 2, 12, 13, 2, 14, 14, 14,
289 14, 14, 14, 14, 14, 14, 14, 15, 2, 2,
290 11, 2, 6, 2, 16, 16, 16, 16, 16, 16,
291 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
292 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
293 17, 18, 19, 20, 21, 20, 16, 16, 22, 23,
295 24, 16, 16, 16, 25, 16, 16, 26, 16, 27,
296 16, 16, 16, 28, 28, 29, 30, 16, 16, 16,
297 16, 16, 31, 2, 32, 2, 2, 1, 1, 1,
298 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
299 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
300 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
301 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
302 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
303 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
304 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
306 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
307 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
308 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
310 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
314 static yyconst
int yy_meta
[33] =
316 1, 1, 2, 3, 1, 1, 4, 1, 5, 6,
317 1, 1, 1, 7, 1, 8, 1, 4, 1, 1,
318 9, 8, 8, 8, 8, 8, 10, 8, 10, 8,
322 static yyconst
short int yy_base
[144] =
324 0, 0, 30, 37, 46, 0, 78, 0, 107, 111,
325 115, 117, 409, 410, 124, 127, 410, 410, 129, 109,
326 410, 121, 394, 123, 0, 142, 410, 410, 135, 410,
327 400, 113, 0, 410, 138, 410, 410, 142, 144, 392,
328 0, 175, 410, 395, 390, 393, 200, 392, 0, 0,
329 0, 410, 0, 369, 368, 366, 142, 0, 149, 151,
330 410, 391, 410, 410, 350, 143, 330, 324, 146, 0,
331 410, 158, 0, 310, 329, 410, 0, 320, 0, 0,
332 410, 410, 299, 311, 305, 410, 304, 0, 283, 0,
333 410, 277, 0, 200, 201, 410, 286, 410, 217, 208,
335 410, 0, 199, 0, 198, 0, 196, 189, 188, 187,
336 149, 143, 133, 120, 100, 22, 19, 14, 12, 0,
337 0, 0, 410, 233, 243, 253, 263, 273, 277, 287,
338 297, 307, 312, 322, 329, 339, 349, 359, 369, 379,
342 static yyconst
short int yy_def
[144] =
344 123, 1, 124, 124, 123, 5, 123, 7, 125, 125,
345 126, 126, 123, 123, 123, 123, 123, 123, 127, 128,
346 123, 123, 123, 123, 129, 130, 123, 123, 123, 123,
347 131, 128, 132, 123, 123, 123, 123, 127, 128, 123,
348 132, 123, 123, 123, 123, 133, 130, 133, 134, 134,
349 134, 123, 135, 136, 136, 136, 137, 138, 123, 127,
350 123, 139, 123, 123, 123, 123, 123, 123, 123, 129,
351 123, 140, 141, 141, 131, 123, 132, 123, 132, 142,
352 123, 123, 142, 123, 123, 123, 133, 143, 143, 134,
353 123, 136, 138, 137, 137, 123, 139, 123, 123, 140,
355 123, 141, 141, 142, 142, 143, 143, 141, 142, 143,
356 141, 142, 143, 141, 142, 143, 141, 142, 143, 141,
357 142, 143, 0, 123, 123, 123, 123, 123, 123, 123,
358 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
362 static yyconst
short int yy_nxt
[443] =
364 14, 14, 15, 16, 17, 14, 18, 19, 20, 14,
365 21, 22, 23, 24, 21, 25, 14, 26, 14, 14,
366 14, 25, 25, 25, 25, 25, 25, 25, 25, 25,
367 27, 27, 29, 16, 30, 122, 31, 121, 32, 29,
368 16, 30, 120, 31, 119, 32, 33, 34, 35, 16,
369 36, 33, 37, 38, 39, 33, 34, 33, 34, 40,
370 33, 41, 34, 42, 34, 34, 41, 41, 41, 41,
371 41, 41, 41, 41, 41, 41, 34, 34, 14, 14,
372 15, 16, 17, 14, 43, 19, 20, 44, 14, 14,
373 14, 45, 14, 46, 14, 47, 14, 14, 14, 46,
375 46, 46, 46, 46, 46, 48, 46, 46, 14, 14,
376 50, 51, 63, 52, 50, 51, 63, 52, 55, 56,
377 55, 56, 118, 57, 53, 57, 59, 59, 53, 59,
378 59, 61, 61, 65, 66, 68, 69, 59, 59, 64,
379 59, 59, 117, 64, 61, 61, 58, 63, 58, 72,
380 95, 59, 59, 61, 61, 68, 66, 73, 68, 69,
381 101, 101, 116, 73, 73, 73, 74, 73, 73, 73,
382 73, 73, 115, 96, 64, 71, 71, 71, 114, 71,
383 71, 79, 72, 71, 79, 71, 71, 71, 71, 71,
384 80, 81, 71, 82, 79, 71, 80, 80, 80, 83,
386 80, 80, 80, 80, 80, 71, 71, 72, 123, 95,
387 101, 101, 113, 112, 111, 88, 81, 110, 82, 109,
388 108, 88, 88, 88, 89, 88, 88, 88, 88, 88,
389 99, 123, 96, 28, 28, 28, 28, 28, 28, 28,
390 28, 28, 28, 49, 49, 49, 49, 49, 49, 49,
391 49, 49, 49, 54, 54, 54, 54, 54, 54, 54,
392 54, 54, 54, 60, 60, 60, 60, 60, 60, 60,
393 60, 60, 60, 62, 62, 62, 62, 62, 62, 62,
394 62, 62, 62, 70, 70, 70, 70, 71, 71, 98,
395 71, 71, 71, 71, 71, 71, 71, 75, 75, 75,
397 75, 75, 75, 75, 75, 75, 75, 77, 93, 107,
398 77, 77, 77, 86, 77, 77, 77, 87, 85, 87,
399 84, 87, 90, 90, 90, 105, 90, 90, 90, 90,
400 90, 90, 91, 78, 91, 76, 103, 99, 91, 92,
401 92, 92, 92, 67, 92, 92, 92, 92, 92, 94,
402 94, 94, 94, 94, 94, 94, 94, 94, 94, 93,
403 93, 93, 93, 67, 93, 93, 93, 93, 93, 97,
404 97, 97, 97, 97, 97, 97, 97, 97, 97, 100,
405 100, 100, 100, 100, 100, 100, 100, 100, 100, 102,
406 102, 102, 102, 104, 98, 104, 106, 93, 106, 93,
408 93, 86, 86, 85, 84, 78, 76, 67, 123, 13,
409 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
410 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
411 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
415 static yyconst
short int yy_chk
[443] =
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 3, 3, 3, 119, 3, 118, 3, 4,
421 4, 4, 117, 4, 116, 4, 5, 5, 5, 5,
422 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
423 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
424 5, 5, 5, 5, 5, 5, 5, 5, 7, 7,
425 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
426 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
428 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
429 9, 9, 20, 9, 10, 10, 32, 10, 11, 11,
430 12, 12, 115, 11, 9, 12, 15, 15, 10, 16,
431 16, 19, 19, 22, 22, 24, 24, 29, 29, 20,
432 35, 35, 114, 32, 38, 38, 11, 39, 12, 26,
433 57, 59, 59, 60, 60, 66, 66, 26, 69, 69,
434 72, 72, 113, 26, 26, 26, 26, 26, 26, 26,
435 26, 26, 112, 57, 39, 42, 42, 42, 111, 42,
436 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
437 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
439 42, 42, 42, 42, 42, 42, 42, 47, 94, 95,
440 100, 100, 110, 109, 108, 47, 47, 107, 47, 105,
441 103, 47, 47, 47, 47, 47, 47, 47, 47, 47,
442 99, 94, 95, 124, 124, 124, 124, 124, 124, 124,
443 124, 124, 124, 125, 125, 125, 125, 125, 125, 125,
444 125, 125, 125, 126, 126, 126, 126, 126, 126, 126,
445 126, 126, 126, 127, 127, 127, 127, 127, 127, 127,
446 127, 127, 127, 128, 128, 128, 128, 128, 128, 128,
447 128, 128, 128, 129, 129, 129, 129, 130, 130, 97,
448 130, 130, 130, 130, 130, 130, 130, 131, 131, 131,
450 131, 131, 131, 131, 131, 131, 131, 132, 92, 89,
451 132, 132, 132, 87, 132, 132, 132, 133, 85, 133,
452 84, 133, 134, 134, 134, 83, 134, 134, 134, 134,
453 134, 134, 135, 78, 135, 75, 74, 68, 135, 136,
454 136, 136, 136, 67, 136, 136, 136, 136, 136, 137,
455 137, 137, 137, 137, 137, 137, 137, 137, 137, 138,
456 138, 138, 138, 65, 138, 138, 138, 138, 138, 139,
457 139, 139, 139, 139, 139, 139, 139, 139, 139, 140,
458 140, 140, 140, 140, 140, 140, 140, 140, 140, 141,
459 141, 141, 141, 142, 62, 142, 143, 56, 143, 55,
461 54, 48, 46, 45, 44, 40, 31, 23, 13, 123,
462 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
463 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
464 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
468 static yyconst
short int yy_rule_linenum
[47] =
470 94, 99, 102, 104, 106, 108, 110, 116, 118, 121,
471 133, 136, 143, 147, 153, 158, 163, 167, 172, 176,
472 184, 189, 193, 198, 203, 208, 212, 215, 218, 223,
473 230, 233, 237, 240, 255, 267, 270, 273, 282, 287,
474 292, 298, 302, 306, 310, 325
477 /* The intent behind this definition is that it'll catch
478 * any uses of REJECT which flex missed.
480 #define REJECT reject_used_but_not_detected
481 #define yymore() yymore_used_but_not_detected
482 #define YY_MORE_ADJ 0
483 #define YY_RESTORE_YY_MORE_OFFSET
488 lexer.l -- implement the Flex lexer
490 source file of the LilyPond music typesetter
492 (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
499 after making a change to the lexer rules, run
500 flex -b <this lexer file>
503 contains no backup states, but only the reminder
504 Compressed tables always back up.
505 (don-t forget to rm lex.yy.cc :-)
513 #include "string-convert.hh"
514 #include "my-lily-lexer.hh"
516 #include "interval.hh"
519 #include "parseconstruct.hh"
521 #include "identifier.hh"
522 void strip_trailing_white (String
&);
523 void strip_leading_white (String
&);
526 #define start_quote() \
527 yy_push_state (quote);\
528 yylval.string = new String
530 #define yylval (*(YYSTYPE*)lexval_l)
532 #define YY_USER_ACTION add_lexed_char (YYLeng ());
533 #define YY_STACK_USED 1
534 #define YY_NEVER_INTERACTIVE 1
543 #define longcomment 5
545 #line 546 "lex.yy.cc"
547 /* Macros after this point can all be overridden by user definitions in
551 #ifndef YY_SKIP_YYWRAP
553 extern "C" int yywrap
YY_PROTO(( void ));
555 extern int yywrap
YY_PROTO(( void ));
561 static void yy_flex_strncpy
YY_PROTO(( char *, yyconst
char *, int ));
564 #ifdef YY_NEED_STRLEN
565 static int yy_flex_strlen
YY_PROTO(( yyconst
char * ));
572 static int yy_start_stack_ptr
= 0;
573 static int yy_start_stack_depth
= 0;
574 static int *yy_start_stack
= 0;
575 #ifndef YY_NO_PUSH_STATE
576 static void yy_push_state
YY_PROTO(( int new_state
));
578 #ifndef YY_NO_POP_STATE
579 static void yy_pop_state
YY_PROTO(( void ));
581 #ifndef YY_NO_TOP_STATE
582 static int yy_top_state
YY_PROTO(( void ));
586 #define YY_NO_PUSH_STATE 1
587 #define YY_NO_POP_STATE 1
588 #define YY_NO_TOP_STATE 1
591 #ifdef YY_MALLOC_DECL
599 /* Just try to get by without declaring the routines. This will fail
600 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
601 * or sizeof(void*) != sizeof(int).
606 /* Amount of stuff to slurp up with each read. */
607 #ifndef YY_READ_BUF_SIZE
608 #define YY_READ_BUF_SIZE 8192
611 /* Copy whatever the last rule matched to the standard output. */
614 #define ECHO LexerOutput( yytext, yyleng )
617 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
618 * is returned in "result".
621 #define YY_INPUT(buf,result,max_size) \
622 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
623 YY_FATAL_ERROR( "input in flex scanner failed" );
626 /* No semi-colon after return; correct usage is to write "yyterminate();" -
627 * we don't want an extra ';' after the "return" because that will cause
628 * some compilers to complain about unreachable statements.
631 #define yyterminate() return YY_NULL
634 /* Number of entries by which start-condition stack grows. */
635 #ifndef YY_START_STACK_INCR
636 #define YY_START_STACK_INCR 25
639 /* Report a fatal error. */
640 #ifndef YY_FATAL_ERROR
641 #define YY_FATAL_ERROR(msg) LexerError( msg )
644 /* Default declaration of generated scanner - a define so the user can
645 * easily add parameters.
648 #define YY_DECL int yyFlexLexer::yylex()
651 /* Code executed at the beginning of each rule, after yytext and yyleng
654 #ifndef YY_USER_ACTION
655 #define YY_USER_ACTION
658 /* Code executed at the end of each rule. */
660 #define YY_BREAK break;
663 #define YY_RULE_SETUP \
668 register yy_state_type yy_current_state
;
669 register char *yy_cp
, *yy_bp
;
676 #line 677 "lex.yy.cc"
687 yy_start
= 1; /* first start state */
695 if ( ! yy_current_buffer
)
697 yy_create_buffer( yyin
, YY_BUF_SIZE
);
699 yy_load_buffer_state();
702 while ( 1 ) /* loops until end-of-file is reached */
706 /* Support of yytext. */
707 *yy_cp
= yy_hold_char
;
709 /* yy_bp points to the position in yy_ch_buf of the start of
714 yy_current_state
= yy_start
;
718 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
719 if ( yy_accept
[yy_current_state
] )
721 yy_last_accepting_state
= yy_current_state
;
722 yy_last_accepting_cpos
= yy_cp
;
724 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
726 yy_current_state
= (int) yy_def
[yy_current_state
];
727 if ( yy_current_state
>= 124 )
728 yy_c
= yy_meta
[(unsigned int) yy_c
];
730 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
733 while ( yy_base
[yy_current_state
] != 410 );
736 yy_act
= yy_accept
[yy_current_state
];
738 { /* have to back up */
739 yy_cp
= yy_last_accepting_cpos
;
740 yy_current_state
= yy_last_accepting_state
;
741 yy_act
= yy_accept
[yy_current_state
];
747 do_action
: /* This label is used only to access EOF actions. */
752 cerr
<< "--scanner backing up\n";
753 else if ( yy_act
< 47 )
754 cerr
<< "--accepting rule at line " << yy_rule_linenum
[yy_act
] <<
755 "(\"" << yytext
<< "\")\n";
756 else if ( yy_act
== 47 )
757 cerr
<< "--accepting default rule (\"" << yytext
<< "\")\n";
758 else if ( yy_act
== 48 )
759 cerr
<< "--(end of buffer or a NUL)\n";
761 cerr
<< "--EOF (start condition " << YY_START
<< ")\n";
765 { /* beginning of action switch */
766 case 0: /* must back up */
767 /* undo the effects of YY_DO_BEFORE_ACTION */
768 *yy_cp
= yy_hold_char
;
769 yy_cp
= yy_last_accepting_cpos
;
770 yy_current_state
= yy_last_accepting_state
;
777 // windows-suck-suck-suck
785 yy_push_state (longcomment
);
841 case YY_STATE_EOF(longcomment
):
844 LexerError ("EOF found inside a comment");
845 if (! close_input ())
846 yyterminate (); // can't move this, since it actually rets a YY_NULL
854 yy_push_state (incl
);
860 { /* got the include file name */
861 String
s (YYText ()+1);
862 s
= s
.left_str (s
.length_i ()-1);
863 DOUT
<< "#include `" << s
<< "\'\n";
864 new_input (s
,source_global_l
);
872 cerr
<< "missing end quote" << endl
;
880 const char *s
= YYText ();
881 yylval
.string
= new String (s
);
882 DOUT
<< "rest:"<< yylval
.string
;
890 String s
=YYText () + 2;
891 s
=s
.left_str (s
.length_i () - 1);
892 return scan_escaped_word (s
);
899 String s
=YYText () + 1;
900 s
=s
.left_str (s
.length_i () - 1);
901 return scan_bare_word (s
);
908 cerr
<< "white expected" << endl
;
916 cerr
<< "white expected" << endl
;
922 *yy_cp
= yy_hold_char
; /* undo effects of setting up yytext */
923 yy_c_buf_p
= yy_cp
-= 1;
924 YY_DO_BEFORE_ACTION
; /* set up yytext again */
928 post_quotes_b_
= true;
929 return scan_bare_word (YYText ());
936 yylval
.i
= YYLeng ();
937 if (post_quotes_b_
) {
938 post_quotes_b_
= false;
948 return scan_bare_word (YYText ());
956 return scan_escaped_word (YYText ()+1);
963 yylval
.i
= String_convert::dec2_i (String (YYText ()));
971 yylval
.i
= String_convert::dec2_i (String (YYText ()));
995 *yylval
.string
+= escaped_char(YYText()[1]);
1000 #line 215 "lexer.ll"
1002 *yylval
.string
+= YYText ();
1007 #line 218 "lexer.ll"
1009 DOUT
<< "quoted string: `" << *yylval
.string
<< "'\n";
1016 #line 223 "lexer.ll"
1018 *yylval
.string
+= YYText ();
1025 #line 230 "lexer.ll"
1032 #line 233 "lexer.ll"
1034 yylval
.i
= String_convert::dec2_i (String (YYText ()));
1040 #line 237 "lexer.ll"
1042 return scan_escaped_word (YYText ()+1);
1047 #line 240 "lexer.ll"
1049 /* ugr. This sux. */
1050 String
s (YYText ());
1052 while ((i
=s
.index_i ("_")) != -1) // change word binding "_" to " "
1053 *(s
.ch_l () + i
) = ' ';
1054 if ((i
=s
.index_i ("\\,")) != -1) // change "\," to TeX's "\c "
1056 *(s
.ch_l () + i
+ 1) = 'c';
1057 s
= s
.left_str (i
+2) + " " + s
.right_str (s
.length_i ()-i
-2);
1059 yylval
.string
= new String (s
);
1060 DOUT
<< "lyric : `" << s
<< "'\n";
1066 #line 255 "lexer.ll"
1068 return yylval
.c
= YYText ()[0];
1072 case YY_STATE_EOF(INITIAL
):
1073 case YY_STATE_EOF(incl
):
1074 case YY_STATE_EOF(lyrics
):
1075 case YY_STATE_EOF(notes
):
1076 case YY_STATE_EOF(quote
):
1077 #line 260 "lexer.ll"
1081 if (! close_input ()) {
1082 yyterminate (); // can't move this, since it actually rets a YY_NULL
1088 #line 267 "lexer.ll"
1090 return scan_bare_word (YYText ());
1095 #line 270 "lexer.ll"
1097 return scan_escaped_word (YYText ()+1);
1102 #line 273 "lexer.ll"
1105 int cnv
=sscanf (YYText (), "%lf", &r
);
1107 DOUT
<< "REAL" << r
<<'\n';
1114 #line 282 "lexer.ll"
1116 yylval
.i
= String_convert::dec2_i (String (YYText ()));
1122 #line 287 "lexer.ll"
1126 return YYText ()[0];
1131 #line 292 "lexer.ll"
1133 char c
= YYText ()[0];
1134 DOUT
<< "misc char" <<c
<<"\n";
1140 #line 298 "lexer.ll"
1142 return yylval
.i
= PLET
;
1147 #line 302 "lexer.ll"
1149 return yylval
.i
= TELP
;
1154 #line 306 "lexer.ll"
1156 return yylval
.c
= YYText ()[0];
1161 #line 310 "lexer.ll"
1163 char c
= YYText ()[1];
1171 return E_EXCLAMATION
;
1179 #line 325 "lexer.ll"
1181 String msg
= String ("illegal character: ") +String (YYText ()[0]);
1182 LexerError (msg
.ch_C ());
1183 return YYText ()[0];
1188 #line 331 "lexer.ll"
1189 YY_FATAL_ERROR( "flex scanner jammed" );
1191 #line 1192 "lex.yy.cc"
1193 case YY_END_OF_BUFFER
:
1195 /* Amount of text matched not including the EOB char. */
1196 int yy_amount_of_matched_text
= (int) (yy_cp
- yytext_ptr
) - 1;
1198 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1199 *yy_cp
= yy_hold_char
;
1200 YY_RESTORE_YY_MORE_OFFSET
1202 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_NEW
)
1204 /* We're scanning a new file or input source. It's
1205 * possible that this happened because the user
1206 * just pointed yyin at a new source and called
1207 * yylex(). If so, then we have to assure
1208 * consistency between yy_current_buffer and our
1209 * globals. Here is the right place to do so, because
1210 * this is the first action (other than possibly a
1211 * back-up) that will match for the new input source.
1213 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1214 yy_current_buffer
->yy_input_file
= yyin
;
1215 yy_current_buffer
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1218 /* Note that here we test for yy_c_buf_p "<=" to the position
1219 * of the first EOB in the buffer, since yy_c_buf_p will
1220 * already have been incremented past the NUL character
1221 * (since all states make transitions on EOB to the
1222 * end-of-buffer state). Contrast this with the test
1225 if ( yy_c_buf_p
<= &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1226 { /* This was really a NUL. */
1227 yy_state_type yy_next_state
;
1229 yy_c_buf_p
= yytext_ptr
+ yy_amount_of_matched_text
;
1231 yy_current_state
= yy_get_previous_state();
1233 /* Okay, we're now positioned to make the NUL
1234 * transition. We couldn't have
1235 * yy_get_previous_state() go ahead and do it
1236 * for us because it doesn't know how to deal
1237 * with the possibility of jamming (and we don't
1238 * want to build jamming into it because then it
1239 * will run more slowly).
1242 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1244 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1246 if ( yy_next_state
)
1248 /* Consume the NUL. */
1249 yy_cp
= ++yy_c_buf_p
;
1250 yy_current_state
= yy_next_state
;
1257 goto yy_find_action
;
1261 else switch ( yy_get_next_buffer() )
1263 case EOB_ACT_END_OF_FILE
:
1265 yy_did_buffer_switch_on_eof
= 0;
1269 /* Note: because we've taken care in
1270 * yy_get_next_buffer() to have set up
1271 * yytext, we can now set up
1272 * yy_c_buf_p so that if some total
1273 * hoser (like flex itself) wants to
1274 * call the scanner after we return the
1275 * YY_NULL, it'll still work - another
1276 * YY_NULL will get returned.
1278 yy_c_buf_p
= yytext_ptr
+ YY_MORE_ADJ
;
1280 yy_act
= YY_STATE_EOF(YY_START
);
1286 if ( ! yy_did_buffer_switch_on_eof
)
1292 case EOB_ACT_CONTINUE_SCAN
:
1294 yytext_ptr
+ yy_amount_of_matched_text
;
1296 yy_current_state
= yy_get_previous_state();
1299 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1302 case EOB_ACT_LAST_MATCH
:
1304 &yy_current_buffer
->yy_ch_buf
[yy_n_chars
];
1306 yy_current_state
= yy_get_previous_state();
1309 yy_bp
= yytext_ptr
+ YY_MORE_ADJ
;
1310 goto yy_find_action
;
1317 "fatal flex scanner internal error--no action found" );
1318 } /* end of action switch */
1319 } /* end of scanning one token */
1320 } /* end of yylex */
1322 yyFlexLexer::yyFlexLexer( istream
* arg_yyin
, ostream
* arg_yyout
)
1330 yylineno
= 1; // this will only get updated if %option yylineno
1332 yy_did_buffer_switch_on_eof
= 0;
1334 yy_looking_for_trail_begin
= 0;
1337 yy_more_offset
= yy_prev_more_offset
= 0;
1339 yy_start_stack_ptr
= yy_start_stack_depth
= 0;
1342 yy_current_buffer
= 0;
1344 #ifdef YY_USES_REJECT
1345 yy_state_buf
= new yy_state_type
[YY_BUF_SIZE
+ 2];
1351 yyFlexLexer::~yyFlexLexer()
1353 delete yy_state_buf
;
1354 yy_delete_buffer( yy_current_buffer
);
1357 void yyFlexLexer::switch_streams( istream
* new_in
, ostream
* new_out
)
1361 yy_delete_buffer( yy_current_buffer
);
1362 yy_switch_to_buffer( yy_create_buffer( new_in
, YY_BUF_SIZE
) );
1369 #ifdef YY_INTERACTIVE
1370 int yyFlexLexer::LexerInput( char* buf
, int /* max_size */ )
1372 int yyFlexLexer::LexerInput( char* buf
, int max_size
)
1375 if ( yyin
->eof() || yyin
->fail() )
1378 #ifdef YY_INTERACTIVE
1379 yyin
->get( buf
[0] );
1390 (void) yyin
->read( buf
, max_size
);
1395 return yyin
->gcount();
1399 void yyFlexLexer::LexerOutput( const char* buf
, int size
)
1401 (void) yyout
->write( buf
, size
);
1404 /* yy_get_next_buffer - try to read in a new buffer
1406 * Returns a code representing an action:
1407 * EOB_ACT_LAST_MATCH -
1408 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1409 * EOB_ACT_END_OF_FILE - end of file
1412 int yyFlexLexer::yy_get_next_buffer()
1414 register char *dest
= yy_current_buffer
->yy_ch_buf
;
1415 register char *source
= yytext_ptr
;
1416 register int number_to_move
, i
;
1419 if ( yy_c_buf_p
> &yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] )
1421 "fatal flex scanner internal error--end of buffer missed" );
1423 if ( yy_current_buffer
->yy_fill_buffer
== 0 )
1424 { /* Don't try to fill the buffer, so this is an EOF. */
1425 if ( yy_c_buf_p
- yytext_ptr
- YY_MORE_ADJ
== 1 )
1427 /* We matched a single character, the EOB, so
1428 * treat this as a final EOF.
1430 return EOB_ACT_END_OF_FILE
;
1435 /* We matched some text prior to the EOB, first
1438 return EOB_ACT_LAST_MATCH
;
1442 /* Try to read more data. */
1444 /* First move last chars to start of buffer. */
1445 number_to_move
= (int) (yy_c_buf_p
- yytext_ptr
) - 1;
1447 for ( i
= 0; i
< number_to_move
; ++i
)
1448 *(dest
++) = *(source
++);
1450 if ( yy_current_buffer
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1451 /* don't do the read, it's not guaranteed to return an EOF,
1454 yy_current_buffer
->yy_n_chars
= yy_n_chars
= 0;
1459 yy_current_buffer
->yy_buf_size
- number_to_move
- 1;
1461 while ( num_to_read
<= 0 )
1462 { /* Not enough room in the buffer - grow it. */
1463 #ifdef YY_USES_REJECT
1465 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1468 /* just a shorter name for the current buffer */
1469 YY_BUFFER_STATE b
= yy_current_buffer
;
1471 int yy_c_buf_p_offset
=
1472 (int) (yy_c_buf_p
- b
->yy_ch_buf
);
1474 if ( b
->yy_is_our_buffer
)
1476 int new_size
= b
->yy_buf_size
* 2;
1478 if ( new_size
<= 0 )
1479 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1481 b
->yy_buf_size
*= 2;
1483 b
->yy_ch_buf
= (char *)
1484 /* Include room in for 2 EOB chars. */
1485 yy_flex_realloc( (void *) b
->yy_ch_buf
,
1486 b
->yy_buf_size
+ 2 );
1489 /* Can't grow it, we don't own it. */
1492 if ( ! b
->yy_ch_buf
)
1494 "fatal error - scanner input buffer overflow" );
1496 yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1498 num_to_read
= yy_current_buffer
->yy_buf_size
-
1503 if ( num_to_read
> YY_READ_BUF_SIZE
)
1504 num_to_read
= YY_READ_BUF_SIZE
;
1506 /* Read in more data. */
1507 YY_INPUT( (&yy_current_buffer
->yy_ch_buf
[number_to_move
]),
1508 yy_n_chars
, num_to_read
);
1510 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1513 if ( yy_n_chars
== 0 )
1515 if ( number_to_move
== YY_MORE_ADJ
)
1517 ret_val
= EOB_ACT_END_OF_FILE
;
1523 ret_val
= EOB_ACT_LAST_MATCH
;
1524 yy_current_buffer
->yy_buffer_status
=
1525 YY_BUFFER_EOF_PENDING
;
1530 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1532 yy_n_chars
+= number_to_move
;
1533 yy_current_buffer
->yy_ch_buf
[yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
1534 yy_current_buffer
->yy_ch_buf
[yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
1536 yytext_ptr
= &yy_current_buffer
->yy_ch_buf
[0];
1542 /* yy_get_previous_state - get the state just before the EOB char was reached */
1544 yy_state_type
yyFlexLexer::yy_get_previous_state()
1546 register yy_state_type yy_current_state
;
1547 register char *yy_cp
;
1549 yy_current_state
= yy_start
;
1551 for ( yy_cp
= yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yy_c_buf_p
; ++yy_cp
)
1553 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 2);
1554 if ( yy_accept
[yy_current_state
] )
1556 yy_last_accepting_state
= yy_current_state
;
1557 yy_last_accepting_cpos
= yy_cp
;
1559 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1561 yy_current_state
= (int) yy_def
[yy_current_state
];
1562 if ( yy_current_state
>= 124 )
1563 yy_c
= yy_meta
[(unsigned int) yy_c
];
1565 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1568 return yy_current_state
;
1572 /* yy_try_NUL_trans - try to make a transition on the NUL character
1575 * next_state = yy_try_NUL_trans( current_state );
1578 yy_state_type
yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state
)
1580 register int yy_is_jam
;
1581 register char *yy_cp
= yy_c_buf_p
;
1583 register YY_CHAR yy_c
= 2;
1584 if ( yy_accept
[yy_current_state
] )
1586 yy_last_accepting_state
= yy_current_state
;
1587 yy_last_accepting_cpos
= yy_cp
;
1589 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1591 yy_current_state
= (int) yy_def
[yy_current_state
];
1592 if ( yy_current_state
>= 124 )
1593 yy_c
= yy_meta
[(unsigned int) yy_c
];
1595 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1596 yy_is_jam
= (yy_current_state
== 123);
1598 return yy_is_jam
? 0 : yy_current_state
;
1602 void yyFlexLexer::yyunput( int c
, register char* yy_bp
)
1604 register char *yy_cp
= yy_c_buf_p
;
1606 /* undo effects of setting up yytext */
1607 *yy_cp
= yy_hold_char
;
1609 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1610 { /* need to shift things up to make room */
1611 /* +2 for EOB chars. */
1612 register int number_to_move
= yy_n_chars
+ 2;
1613 register char *dest
= &yy_current_buffer
->yy_ch_buf
[
1614 yy_current_buffer
->yy_buf_size
+ 2];
1615 register char *source
=
1616 &yy_current_buffer
->yy_ch_buf
[number_to_move
];
1618 while ( source
> yy_current_buffer
->yy_ch_buf
)
1619 *--dest
= *--source
;
1621 yy_cp
+= (int) (dest
- source
);
1622 yy_bp
+= (int) (dest
- source
);
1623 yy_current_buffer
->yy_n_chars
=
1624 yy_n_chars
= yy_current_buffer
->yy_buf_size
;
1626 if ( yy_cp
< yy_current_buffer
->yy_ch_buf
+ 2 )
1627 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1630 *--yy_cp
= (char) c
;
1634 yy_hold_char
= *yy_cp
;
1639 int yyFlexLexer::yyinput()
1643 *yy_c_buf_p
= yy_hold_char
;
1645 if ( *yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
1647 /* yy_c_buf_p now points to the character we want to return.
1648 * If this occurs *before* the EOB characters, then it's a
1649 * valid NUL; if not, then we've hit the end of the buffer.
1651 if ( yy_c_buf_p
< &yy_current_buffer
->yy_ch_buf
[yy_n_chars
] )
1652 /* This was really a NUL. */
1656 { /* need more input */
1657 int offset
= yy_c_buf_p
- yytext_ptr
;
1660 switch ( yy_get_next_buffer() )
1662 case EOB_ACT_LAST_MATCH
:
1663 /* This happens because yy_g_n_b()
1664 * sees that we've accumulated a
1665 * token and flags that we need to
1666 * try matching the token before
1667 * proceeding. But for input(),
1668 * there's no matching to consider.
1669 * So convert the EOB_ACT_LAST_MATCH
1670 * to EOB_ACT_END_OF_FILE.
1673 /* Reset buffer status. */
1678 case EOB_ACT_END_OF_FILE
:
1683 if ( ! yy_did_buffer_switch_on_eof
)
1692 case EOB_ACT_CONTINUE_SCAN
:
1693 yy_c_buf_p
= yytext_ptr
+ offset
;
1699 c
= *(unsigned char *) yy_c_buf_p
; /* cast for 8-bit char's */
1700 *yy_c_buf_p
= '\0'; /* preserve yytext */
1701 yy_hold_char
= *++yy_c_buf_p
;
1708 void yyFlexLexer::yyrestart( istream
* input_file
)
1710 if ( ! yy_current_buffer
)
1711 yy_current_buffer
= yy_create_buffer( yyin
, YY_BUF_SIZE
);
1713 yy_init_buffer( yy_current_buffer
, input_file
);
1714 yy_load_buffer_state();
1718 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer
)
1720 if ( yy_current_buffer
== new_buffer
)
1723 if ( yy_current_buffer
)
1725 /* Flush out information for old buffer. */
1726 *yy_c_buf_p
= yy_hold_char
;
1727 yy_current_buffer
->yy_buf_pos
= yy_c_buf_p
;
1728 yy_current_buffer
->yy_n_chars
= yy_n_chars
;
1731 yy_current_buffer
= new_buffer
;
1732 yy_load_buffer_state();
1734 /* We don't actually know whether we did this switch during
1735 * EOF (yywrap()) processing, but the only time this flag
1736 * is looked at is after yywrap() is called, so it's safe
1737 * to go ahead and always set it.
1739 yy_did_buffer_switch_on_eof
= 1;
1743 void yyFlexLexer::yy_load_buffer_state()
1745 yy_n_chars
= yy_current_buffer
->yy_n_chars
;
1746 yytext_ptr
= yy_c_buf_p
= yy_current_buffer
->yy_buf_pos
;
1747 yyin
= yy_current_buffer
->yy_input_file
;
1748 yy_hold_char
= *yy_c_buf_p
;
1752 YY_BUFFER_STATE
yyFlexLexer::yy_create_buffer( istream
* file
, int size
)
1756 b
= (YY_BUFFER_STATE
) yy_flex_alloc( sizeof( struct yy_buffer_state
) );
1758 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1760 b
->yy_buf_size
= size
;
1762 /* yy_ch_buf has to be 2 characters longer than the size given because
1763 * we need to put in 2 end-of-buffer characters.
1765 b
->yy_ch_buf
= (char *) yy_flex_alloc( b
->yy_buf_size
+ 2 );
1766 if ( ! b
->yy_ch_buf
)
1767 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1769 b
->yy_is_our_buffer
= 1;
1771 yy_init_buffer( b
, file
);
1777 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b
)
1782 if ( b
== yy_current_buffer
)
1783 yy_current_buffer
= (YY_BUFFER_STATE
) 0;
1785 if ( b
->yy_is_our_buffer
)
1786 yy_flex_free( (void *) b
->yy_ch_buf
);
1788 yy_flex_free( (void *) b
);
1792 extern "C" int isatty
YY_PROTO(( int ));
1793 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b
, istream
* file
)
1796 yy_flush_buffer( b
);
1798 b
->yy_input_file
= file
;
1799 b
->yy_fill_buffer
= 1;
1801 b
->yy_is_interactive
= 0;
1805 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b
)
1812 /* We always need two end-of-buffer characters. The first causes
1813 * a transition to the end-of-buffer state. The second causes
1814 * a jam in that state.
1816 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1817 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1819 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1822 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1824 if ( b
== yy_current_buffer
)
1825 yy_load_buffer_state();
1829 #ifndef YY_NO_SCAN_BUFFER
1833 #ifndef YY_NO_SCAN_STRING
1837 #ifndef YY_NO_SCAN_BYTES
1841 #ifndef YY_NO_PUSH_STATE
1842 void yyFlexLexer::yy_push_state( int new_state
)
1844 if ( yy_start_stack_ptr
>= yy_start_stack_depth
)
1848 yy_start_stack_depth
+= YY_START_STACK_INCR
;
1849 new_size
= yy_start_stack_depth
* sizeof( int );
1851 if ( ! yy_start_stack
)
1852 yy_start_stack
= (int *) yy_flex_alloc( new_size
);
1855 yy_start_stack
= (int *) yy_flex_realloc(
1856 (void *) yy_start_stack
, new_size
);
1858 if ( ! yy_start_stack
)
1860 "out of memory expanding start-condition stack" );
1863 yy_start_stack
[yy_start_stack_ptr
++] = YY_START
;
1870 #ifndef YY_NO_POP_STATE
1871 void yyFlexLexer::yy_pop_state()
1873 if ( --yy_start_stack_ptr
< 0 )
1874 YY_FATAL_ERROR( "start-condition stack underflow" );
1876 BEGIN(yy_start_stack
[yy_start_stack_ptr
]);
1881 #ifndef YY_NO_TOP_STATE
1882 int yyFlexLexer::yy_top_state()
1884 return yy_start_stack
[yy_start_stack_ptr
- 1];
1888 #ifndef YY_EXIT_FAILURE
1889 #define YY_EXIT_FAILURE 2
1893 void yyFlexLexer::LexerError( yyconst
char msg
[] )
1895 cerr
<< msg
<< '\n';
1896 exit( YY_EXIT_FAILURE
);
1900 /* Redefine yyless() so it works in section 3 code. */
1906 /* Undo effects of setting up yytext. */ \
1907 yytext[yyleng] = yy_hold_char; \
1908 yy_c_buf_p = yytext + n; \
1909 yy_hold_char = *yy_c_buf_p; \
1910 *yy_c_buf_p = '\0'; \
1916 /* Internal utility routines. */
1919 #ifdef YY_USE_PROTOS
1920 static void yy_flex_strncpy( char *s1
, yyconst
char *s2
, int n
)
1922 static void yy_flex_strncpy( s1
, s2
, n
)
1929 for ( i
= 0; i
< n
; ++i
)
1934 #ifdef YY_NEED_STRLEN
1935 #ifdef YY_USE_PROTOS
1936 static int yy_flex_strlen( yyconst
char *s
)
1938 static int yy_flex_strlen( s
)
1943 for ( n
= 0; s
[n
]; ++n
)
1951 #ifdef YY_USE_PROTOS
1952 static void *yy_flex_alloc( yy_size_t size
)
1954 static void *yy_flex_alloc( size
)
1958 return (void *) malloc( size
);
1961 #ifdef YY_USE_PROTOS
1962 static void *yy_flex_realloc( void *ptr
, yy_size_t size
)
1964 static void *yy_flex_realloc( ptr
, size
)
1969 /* The cast to (char *) in the following accommodates both
1970 * implementations that use char* generic pointers, and those
1971 * that use void* generic pointers. It works with the latter
1972 * because both ANSI C and C++ allow castless assignment from
1973 * any pointer type to void*, and deal with argument conversions
1974 * as though doing an assignment.
1976 return (void *) realloc( (char *) ptr
, size
);
1979 #ifdef YY_USE_PROTOS
1980 static void yy_flex_free( void *ptr
)
1982 static void yy_flex_free( ptr
)
1996 #line 331 "lexer.ll"
2000 My_lily_lexer::push_note_state ()
2002 yy_push_state (notes
);
2006 My_lily_lexer::push_lyric_state ()
2008 yy_push_state (lyrics
);
2011 My_lily_lexer::pop_state ()
2017 My_lily_lexer::scan_escaped_word (String str
)
2019 DOUT
<< "\\word: `" << str
<<"'\n";
2020 int l
= lookup_keyword (str
);
2022 DOUT
<< "(keyword)\n";
2025 Identifier
* id
= lookup_identifier (str
);
2027 DOUT
<< "(identifier)\n";
2029 return id
->token_code_i_
;
2031 if (YYSTATE
!= notes
) {
2032 Melodic_req
* mel_l
= lookup_melodic_req_l (str
);
2034 DOUT
<< "(notename)\n";
2035 yylval
.melreq
= mel_l
;
2039 String
msg ("Unknown escaped string: `" + str
+ "'");
2040 LexerError (msg
.ch_C ());
2042 String
*sp
= new String (str
);
2048 My_lily_lexer::scan_bare_word (String str
)
2050 DOUT
<< "word: `" << str
<< "'\n";
2051 if (YYSTATE
== notes
){
2052 Melodic_req
* mel_l
= lookup_melodic_req_l (str
);
2054 DOUT
<< "(notename)\n";
2055 yylval
.melreq
= mel_l
;
2060 yylval
.string
=new String (str
);
2065 My_lily_lexer::note_state_b () const
2067 return YY_START
== notes
;
2071 My_lily_lexer::lyric_state_b () const
2073 return YY_START
== lyrics
;
2077 strip_trailing_white (String
&s
)
2080 for (; i
< s
.length_i (); i
++)
2081 if (!isspace (s
[i
]))
2084 s
= s
.nomid_str (0, i
);
2088 strip_leading_white (String
&s
)
2090 int i
=s
.length_i ();
2092 if (!isspace (s
[i
]))
2095 s
= s
.left_str (i
+1);