1 #line 2 "lxr/script.lex.c"
3 #line 4 "lxr/script.lex.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 6
12 #define YY_FLEX_SUBMINOR_VERSION 0
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t
;
45 typedef uint8_t flex_uint8_t
;
46 typedef int16_t flex_int16_t
;
47 typedef uint16_t flex_uint16_t
;
48 typedef int32_t flex_int32_t
;
49 typedef uint32_t flex_uint32_t
;
51 typedef signed char flex_int8_t
;
52 typedef short int flex_int16_t
;
53 typedef int flex_int32_t
;
54 typedef unsigned char flex_uint8_t
;
55 typedef unsigned short int flex_uint16_t
;
56 typedef unsigned int flex_uint32_t
;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
126 #define BEGIN (yy_start) = 1 + 2 *
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
146 /* On IA-64, the buffer size is 16k, not 8k.
147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148 * Ditto for the __ia64__ case accordingly.
150 #define YY_BUF_SIZE 32768
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
156 /* The state buf must be large enough to hold one state per character in the main buffer.
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
165 #ifndef YY_TYPEDEF_YY_SIZE_T
166 #define YY_TYPEDEF_YY_SIZE_T
167 typedef size_t yy_size_t
;
170 extern yy_size_t yyleng
;
172 extern FILE *yyin
, *yyout
;
174 #define EOB_ACT_CONTINUE_SCAN 0
175 #define EOB_ACT_END_OF_FILE 1
176 #define EOB_ACT_LAST_MATCH 2
178 #define YY_LESS_LINENO(n)
179 #define YY_LINENO_REWIND_TO(ptr)
181 /* Return all but the first "n" matched characters back to the input stream. */
185 /* Undo effects of setting up yytext. */ \
186 int yyless_macro_arg = (n); \
187 YY_LESS_LINENO(yyless_macro_arg);\
188 *yy_cp = (yy_hold_char); \
189 YY_RESTORE_YY_MORE_OFFSET \
190 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
191 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
195 #define unput(c) yyunput( c, (yytext_ptr) )
197 #ifndef YY_STRUCT_YY_BUFFER_STATE
198 #define YY_STRUCT_YY_BUFFER_STATE
199 struct yy_buffer_state
203 char *yy_ch_buf
; /* input buffer */
204 char *yy_buf_pos
; /* current position in input buffer */
206 /* Size of input buffer in bytes, not including room for EOB
209 yy_size_t yy_buf_size
;
211 /* Number of characters read into yy_ch_buf, not including EOB
216 /* Whether we "own" the buffer - i.e., we know we created it,
217 * and can realloc() it to grow it, and should free() it to
220 int yy_is_our_buffer
;
222 /* Whether this is an "interactive" input source; if so, and
223 * if we're using stdio for input, then we want to use getc()
224 * instead of fread(), to make sure we stop fetching input after
227 int yy_is_interactive
;
229 /* Whether we're considered to be at the beginning of a line.
230 * If so, '^' rules will be active on the next match, otherwise
235 int yy_bs_lineno
; /**< The line count. */
236 int yy_bs_column
; /**< The column count. */
238 /* Whether to try to fill the input buffer when we reach the
243 int yy_buffer_status
;
245 #define YY_BUFFER_NEW 0
246 #define YY_BUFFER_NORMAL 1
247 /* When an EOF's been seen but there's still some text to process
248 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
249 * shouldn't try reading from the input source any more. We might
250 * still have a bunch of tokens to match, though, because of
251 * possible backing-up.
253 * When we actually see the EOF, we change the status to "new"
254 * (via yyrestart()), so that the user can continue scanning by
255 * just pointing yyin at a new input file.
257 #define YY_BUFFER_EOF_PENDING 2
260 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
262 /* Stack of input buffers. */
263 static size_t yy_buffer_stack_top
= 0; /**< index of top of stack. */
264 static size_t yy_buffer_stack_max
= 0; /**< capacity of stack. */
265 static YY_BUFFER_STATE
* yy_buffer_stack
= 0; /**< Stack as an array. */
267 /* We provide macros for accessing buffer states in case in the
268 * future we want to put the buffer states in a more general
271 * Returns the top of the stack, or NULL.
273 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
274 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
277 /* Same as previous macro, but useful when we know that the buffer stack is not
278 * NULL or when we need an lvalue. For internal use only.
280 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
282 /* yy_hold_char holds the character lost when yytext is formed. */
283 static char yy_hold_char
;
284 static int yy_n_chars
; /* number of characters read into yy_ch_buf */
287 /* Points to current character in buffer. */
288 static char *yy_c_buf_p
= (char *) 0;
289 static int yy_init
= 0; /* whether we need to initialize */
290 static int yy_start
= 0; /* start state number */
292 /* Flag which is used to allow yywrap()'s to do buffer switches
293 * instead of setting up a fresh yyin. A bit of a hack ...
295 static int yy_did_buffer_switch_on_eof
;
297 void yyrestart (FILE *input_file
);
298 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
);
299 YY_BUFFER_STATE
yy_create_buffer (FILE *file
,int size
);
300 void yy_delete_buffer (YY_BUFFER_STATE b
);
301 void yy_flush_buffer (YY_BUFFER_STATE b
);
302 void yypush_buffer_state (YY_BUFFER_STATE new_buffer
);
303 void yypop_buffer_state (void );
305 static void yyensure_buffer_stack (void );
306 static void yy_load_buffer_state (void );
307 static void yy_init_buffer (YY_BUFFER_STATE b
,FILE *file
);
309 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
311 YY_BUFFER_STATE
yy_scan_buffer (char *base
,yy_size_t size
);
312 YY_BUFFER_STATE
yy_scan_string (yyconst
char *yy_str
);
313 YY_BUFFER_STATE
yy_scan_bytes (yyconst
char *bytes
,yy_size_t len
);
315 void *yyalloc (yy_size_t
);
316 void *yyrealloc (void *,yy_size_t
);
317 void yyfree (void * );
319 #define yy_new_buffer yy_create_buffer
321 #define yy_set_interactive(is_interactive) \
323 if ( ! YY_CURRENT_BUFFER ){ \
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer(yyin,YY_BUF_SIZE ); \
328 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
331 #define yy_set_bol(at_bol) \
333 if ( ! YY_CURRENT_BUFFER ){\
334 yyensure_buffer_stack (); \
335 YY_CURRENT_BUFFER_LVALUE = \
336 yy_create_buffer(yyin,YY_BUF_SIZE ); \
338 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
341 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
343 /* Begin user sect3 */
345 typedef unsigned char YY_CHAR
;
347 FILE *yyin
= (FILE *) 0, *yyout
= (FILE *) 0;
349 typedef int yy_state_type
;
359 #define yytext_ptr yytext
361 static yy_state_type
yy_get_previous_state (void );
362 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
);
363 static int yy_get_next_buffer (void );
364 #if defined(__GNUC__) && __GNUC__ >= 3
365 __attribute__((__noreturn__
))
367 static void yy_fatal_error (yyconst
char msg
[] );
369 /* Done after the current pattern has been matched and before the
370 * corresponding action - sets up yytext.
372 #define YY_DO_BEFORE_ACTION \
373 (yytext_ptr) = yy_bp; \
374 yyleng = (size_t) (yy_cp - yy_bp); \
375 (yy_hold_char) = *yy_cp; \
377 (yy_c_buf_p) = yy_cp;
379 #define YY_NUM_RULES 59
380 #define YY_END_OF_BUFFER 60
381 /* This struct is not used in this scanner,
382 but its presence is necessary. */
385 flex_int32_t yy_verify
;
388 static yyconst flex_int16_t yy_accept
[190] =
390 24, 24, 30, 30, 3, 3, 19, 19, 12, 12,
391 0, 0, 0, 0, 0, 0, 10, 10, 0, 0,
392 0, 0, 60, 58, 24, 25, 25, 32, 26, 11,
393 32, 32, 32, 32, 42, 42, 42, 46, 32, 32,
394 32, 30, 31, 29, 31, 28, 3, 5, 59, 19,
395 21, 59, 18, 20, 59, 12, 13, 48, 48, 51,
396 49, 10, 10, 36, 36, 36, 35, 36, 36, 35,
397 53, 53, 56, 54, 24, 25, 9, 2, 33, 0,
398 0, 0, 6, 42, 42, 15, 0, 0, 43, 43,
399 47, 44, 47, 45, 42, 42, 47, 42, 42, 46,
401 1, 23, 1, 0, 8, 30, 27, 3, 4, 19,
402 18, 22, 17, 16, 12, 48, 48, 51, 0, 50,
403 49, 10, 10, 39, 40, 35, 37, 38, 53, 53,
404 56, 0, 55, 54, 33, 0, 7, 0, 0, 0,
405 0, 43, 0, 45, 42, 42, 42, 14, 45, 43,
406 43, 0, 45, 41, 0, 52, 50, 0, 57, 55,
407 0, 34, 0, 34, 0, 0, 0, 0, 34, 43,
408 43, 45, 14, 41, 0, 0, 0, 0, 34, 0,
409 0, 0, 0, 34, 0, 0, 0, 34, 0
412 static yyconst YY_CHAR yy_ec
[256] =
414 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
415 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417 1, 5, 6, 7, 8, 9, 6, 6, 10, 11,
418 12, 13, 14, 6, 14, 15, 16, 17, 18, 19,
419 19, 19, 19, 19, 19, 19, 19, 6, 6, 6,
420 6, 6, 6, 6, 20, 21, 20, 20, 22, 23,
421 24, 24, 24, 24, 24, 25, 24, 24, 24, 24,
422 24, 24, 24, 24, 26, 24, 24, 27, 24, 24,
423 28, 29, 30, 6, 31, 32, 20, 33, 34, 34,
425 35, 36, 37, 37, 37, 37, 37, 38, 37, 37,
426 37, 37, 37, 37, 37, 37, 39, 37, 37, 40,
427 37, 37, 41, 6, 42, 6, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
440 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444 static yyconst YY_CHAR yy_meta
[43] =
446 1, 2, 3, 4, 2, 5, 5, 5, 5, 6,
447 5, 5, 7, 5, 5, 7, 8, 8, 8, 9,
448 9, 9, 9, 9, 9, 9, 9, 5, 10, 5,
449 11, 12, 8, 8, 8, 8, 8, 8, 8, 8,
453 static yyconst flex_uint16_t yy_base
[228] =
455 0, 0, 42, 0, 75, 76, 84, 86, 88, 90,
456 104, 114, 0, 0, 0, 0, 118, 122, 127, 0,
457 168, 172, 327, 857, 176, 857, 857, 857, 857, 0,
458 172, 316, 93, 82, 199, 166, 169, 0, 185, 0,
459 279, 0, 857, 857, 0, 857, 0, 857, 0, 0,
460 857, 857, 178, 857, 198, 0, 857, 0, 0, 195,
461 0, 0, 190, 857, 299, 263, 0, 246, 220, 0,
462 0, 0, 207, 0, 238, 857, 0, 857, 0, 214,
463 202, 219, 857, 230, 240, 857, 223, 243, 245, 246,
464 0, 0, 259, 0, 0, 0, 269, 0, 280, 0,
466 857, 857, 857, 176, 857, 0, 857, 0, 857, 0,
467 238, 857, 857, 857, 0, 0, 0, 312, 319, 0,
468 0, 0, 323, 857, 857, 0, 857, 857, 0, 0,
469 327, 334, 0, 0, 0, 175, 857, 315, 72, 316,
470 270, 308, 334, 857, 857, 857, 0, 0, 342, 0,
471 0, 263, 364, 316, 366, 857, 0, 370, 857, 0,
472 337, 314, 320, 321, 381, 382, 167, 357, 74, 857,
473 857, 408, 0, 0, 387, 359, 362, 67, 857, 363,
474 364, 392, 393, 409, 365, 386, 388, 410, 857, 452,
475 464, 476, 488, 500, 512, 524, 529, 535, 547, 552,
477 563, 575, 587, 596, 608, 620, 632, 644, 656, 668,
478 680, 692, 697, 708, 720, 732, 737, 748, 760, 765,
479 775, 786, 797, 808, 820, 832, 844
482 static yyconst flex_int16_t yy_def
[228] =
484 189, 1, 189, 3, 190, 190, 191, 191, 192, 192,
485 193, 193, 194, 194, 194, 194, 195, 195, 189, 19,
486 196, 196, 189, 189, 189, 189, 189, 189, 189, 197,
487 198, 199, 189, 189, 189, 35, 36, 200, 201, 200,
488 202, 203, 189, 189, 204, 189, 205, 189, 206, 207,
489 189, 189, 189, 189, 189, 208, 189, 209, 210, 189,
490 211, 212, 212, 189, 189, 189, 213, 189, 189, 213,
491 214, 215, 189, 216, 189, 189, 197, 189, 217, 218,
492 219, 199, 189, 189, 84, 189, 189, 189, 35, 89,
493 220, 220, 220, 220, 220, 220, 189, 36, 36, 200,
495 189, 189, 189, 202, 189, 203, 189, 205, 189, 207,
496 189, 189, 189, 189, 208, 209, 210, 189, 221, 222,
497 211, 212, 212, 189, 189, 213, 189, 189, 214, 215,
498 189, 223, 224, 216, 217, 218, 189, 219, 225, 219,
499 226, 84, 189, 189, 189, 189, 85, 227, 189, 220,
500 220, 189, 220, 97, 189, 189, 222, 189, 189, 224,
501 219, 226, 225, 189, 219, 219, 226, 226, 226, 189,
502 189, 189, 227, 220, 219, 225, 189, 189, 189, 226,
503 226, 219, 219, 219, 189, 226, 226, 219, 0, 189,
504 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
506 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
507 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
508 189, 189, 189, 189, 189, 189, 189
511 static yyconst flex_uint16_t yy_nxt
[900] =
513 24, 25, 26, 27, 25, 28, 29, 30, 31, 32,
514 28, 28, 28, 33, 28, 34, 35, 36, 37, 38,
515 38, 38, 38, 38, 38, 38, 38, 28, 39, 28,
516 40, 41, 38, 38, 38, 38, 38, 38, 38, 38,
517 28, 28, 42, 42, 42, 42, 42, 43, 44, 43,
518 43, 43, 43, 43, 43, 43, 43, 43, 42, 42,
519 42, 42, 42, 42, 42, 42, 42, 42, 42, 43,
520 45, 43, 43, 46, 42, 42, 42, 42, 42, 42,
521 42, 42, 43, 43, 48, 48, 51, 52, 51, 52,
522 57, 57, 57, 57, 86, 185, 53, 87, 53, 54,
524 163, 54, 180, 49, 49, 59, 60, 60, 61, 84,
525 85, 85, 55, 164, 55, 59, 60, 60, 61, 63,
526 52, 52, 63, 63, 52, 52, 63, 52, 52, 52,
527 52, 52, 64, 64, 64, 64, 64, 65, 66, 64,
528 64, 64, 64, 52, 52, 52, 67, 67, 67, 67,
529 67, 67, 67, 67, 68, 64, 69, 70, 64, 52,
530 52, 52, 52, 52, 52, 52, 52, 64, 64, 72,
531 73, 73, 74, 72, 73, 73, 74, 75, 76, 76,
532 75, 78, 98, 98, 99, 99, 99, 102, 103, 91,
533 111, 123, 91, 112, 123, 180, 118, 119, 119, 118,
535 113, 91, 120, 80, 139, 91, 137, 105, 131, 132,
536 132, 131, 81, 88, 133, 89, 89, 90, 91, 92,
537 93, 94, 91, 95, 96, 97, 114, 148, 83, 91,
538 140, 92, 91, 93, 94, 91, 95, 96, 97, 75,
539 76, 76, 75, 141, 88, 137, 142, 142, 142, 128,
540 111, 143, 144, 112, 145, 146, 147, 147, 147, 149,
541 149, 149, 90, 90, 143, 144, 91, 145, 146, 150,
542 151, 91, 152, 127, 125, 153, 153, 153, 91, 172,
543 172, 172, 150, 151, 91, 154, 154, 154, 154, 154,
544 154, 154, 91, 91, 91, 91, 99, 99, 168, 91,
546 91, 154, 154, 154, 154, 91, 91, 91, 91, 124,
547 105, 169, 91, 118, 119, 119, 118, 139, 139, 120,
548 155, 119, 119, 155, 123, 83, 189, 123, 131, 132,
549 132, 131, 170, 171, 133, 158, 132, 132, 158, 139,
550 174, 174, 168, 161, 165, 170, 171, 152, 176, 178,
551 172, 172, 172, 174, 174, 169, 162, 166, 149, 149,
552 149, 177, 179, 143, 144, 175, 144, 155, 119, 119,
553 155, 158, 132, 132, 158, 189, 143, 144, 166, 144,
554 153, 153, 153, 139, 139, 181, 94, 163, 94, 139,
555 178, 186, 187, 178, 139, 139, 189, 189, 182, 94,
557 164, 94, 189, 179, 182, 188, 179, 189, 189, 165,
558 161, 139, 139, 189, 186, 183, 181, 189, 189, 189,
559 140, 175, 166, 162, 172, 172, 172, 182, 184, 182,
560 144, 189, 144, 141, 166, 189, 189, 161, 140, 189,
561 189, 189, 189, 144, 189, 144, 189, 189, 189, 189,
562 162, 141, 47, 47, 47, 47, 47, 47, 47, 47,
563 47, 47, 47, 47, 50, 50, 50, 50, 50, 50,
564 50, 50, 50, 50, 50, 50, 56, 56, 56, 56,
565 56, 56, 56, 56, 56, 56, 56, 56, 58, 58,
566 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
568 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
569 52, 52, 62, 62, 62, 62, 62, 62, 62, 62,
570 62, 62, 62, 62, 71, 71, 71, 71, 71, 71,
571 71, 71, 71, 71, 71, 71, 77, 77, 189, 77,
572 79, 189, 189, 79, 189, 79, 79, 82, 82, 82,
573 82, 82, 82, 82, 82, 82, 82, 82, 82, 100,
574 100, 189, 100, 101, 101, 101, 101, 101, 101, 101,
575 101, 101, 101, 101, 101, 104, 104, 104, 104, 104,
576 104, 104, 104, 104, 104, 104, 104, 106, 106, 106,
577 106, 189, 189, 189, 106, 106, 107, 107, 189, 107,
579 107, 107, 107, 107, 107, 107, 107, 107, 108, 108,
580 108, 108, 108, 189, 108, 108, 108, 189, 108, 108,
581 109, 109, 189, 109, 109, 109, 109, 109, 109, 109,
582 109, 109, 110, 110, 189, 189, 110, 110, 189, 110,
583 110, 189, 110, 110, 115, 115, 189, 189, 115, 115,
584 115, 115, 115, 115, 115, 115, 116, 116, 189, 189,
585 116, 116, 116, 116, 116, 116, 116, 116, 117, 117,
586 189, 189, 117, 117, 117, 117, 117, 117, 117, 117,
587 121, 121, 189, 189, 121, 121, 121, 121, 121, 121,
588 121, 121, 122, 122, 189, 189, 122, 122, 122, 122,
590 122, 122, 122, 122, 126, 126, 189, 126, 129, 129,
591 189, 189, 129, 129, 129, 129, 129, 129, 129, 129,
592 130, 130, 189, 189, 130, 130, 130, 130, 130, 130,
593 130, 130, 134, 134, 189, 189, 134, 134, 134, 134,
594 134, 134, 134, 134, 135, 135, 189, 135, 136, 136,
595 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
596 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
597 138, 138, 91, 91, 189, 91, 156, 156, 156, 189,
598 189, 189, 156, 156, 189, 156, 157, 157, 189, 189,
599 157, 157, 157, 157, 157, 157, 157, 157, 159, 159,
601 159, 189, 189, 189, 159, 159, 189, 159, 160, 160,
602 189, 189, 160, 160, 160, 160, 160, 160, 160, 160,
603 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
604 139, 139, 167, 167, 189, 167, 167, 167, 167, 167,
605 167, 167, 167, 167, 173, 173, 189, 189, 173, 173,
606 173, 173, 173, 173, 173, 173, 23, 189, 189, 189,
607 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
608 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
609 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
610 189, 189, 189, 189, 189, 189, 189, 189, 189
614 static yyconst flex_int16_t yy_chk
[900] =
616 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
617 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
618 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
619 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
620 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
621 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
622 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
623 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
624 3, 3, 3, 3, 5, 6, 7, 7, 8, 8,
625 9, 9, 10, 10, 34, 178, 7, 34, 8, 7,
627 139, 8, 169, 5, 6, 11, 11, 11, 11, 33,
628 33, 33, 7, 139, 8, 12, 12, 12, 12, 17,
629 17, 17, 17, 18, 18, 18, 18, 19, 19, 19,
630 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
631 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
632 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
633 19, 19, 19, 19, 19, 19, 19, 19, 19, 21,
634 21, 21, 21, 22, 22, 22, 22, 25, 25, 25,
635 25, 31, 36, 36, 36, 37, 37, 39, 39, 37,
636 53, 63, 36, 53, 63, 167, 60, 60, 60, 60,
638 55, 37, 60, 31, 81, 36, 136, 104, 73, 73,
639 73, 73, 31, 35, 73, 35, 35, 35, 35, 35,
640 35, 35, 35, 35, 35, 35, 55, 87, 82, 35,
641 81, 35, 35, 35, 35, 35, 35, 35, 35, 75,
642 75, 75, 75, 81, 84, 80, 84, 84, 84, 69,
643 111, 84, 84, 111, 84, 84, 85, 85, 85, 88,
644 88, 88, 90, 90, 84, 84, 90, 84, 84, 89,
645 89, 89, 93, 68, 66, 93, 93, 93, 90, 152,
646 152, 152, 89, 89, 89, 97, 97, 97, 97, 97,
647 97, 97, 97, 97, 97, 97, 99, 99, 141, 97,
649 99, 97, 97, 97, 97, 97, 97, 97, 97, 65,
650 41, 141, 99, 118, 118, 118, 118, 138, 140, 118,
651 119, 119, 119, 119, 123, 32, 23, 123, 131, 131,
652 131, 131, 142, 142, 131, 132, 132, 132, 132, 161,
653 154, 154, 162, 138, 140, 142, 142, 143, 163, 164,
654 143, 143, 143, 154, 154, 162, 138, 140, 149, 149,
655 149, 163, 164, 149, 149, 161, 149, 155, 155, 155,
656 155, 158, 158, 158, 158, 0, 149, 149, 161, 149,
657 153, 153, 153, 165, 166, 168, 153, 176, 153, 175,
658 177, 180, 181, 185, 182, 183, 0, 0, 168, 153,
660 176, 153, 0, 177, 180, 181, 185, 0, 0, 165,
661 166, 184, 188, 0, 186, 175, 187, 0, 0, 0,
662 182, 183, 165, 166, 172, 172, 172, 186, 175, 187,
663 172, 0, 172, 182, 183, 0, 0, 184, 188, 0,
664 0, 0, 0, 172, 0, 172, 0, 0, 0, 0,
665 184, 188, 190, 190, 190, 190, 190, 190, 190, 190,
666 190, 190, 190, 190, 191, 191, 191, 191, 191, 191,
667 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
668 192, 192, 192, 192, 192, 192, 192, 192, 193, 193,
669 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
671 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
672 194, 194, 195, 195, 195, 195, 195, 195, 195, 195,
673 195, 195, 195, 195, 196, 196, 196, 196, 196, 196,
674 196, 196, 196, 196, 196, 196, 197, 197, 0, 197,
675 198, 0, 0, 198, 0, 198, 198, 199, 199, 199,
676 199, 199, 199, 199, 199, 199, 199, 199, 199, 200,
677 200, 0, 200, 201, 201, 201, 201, 201, 201, 201,
678 201, 201, 201, 201, 201, 202, 202, 202, 202, 202,
679 202, 202, 202, 202, 202, 202, 202, 203, 203, 203,
680 203, 0, 0, 0, 203, 203, 204, 204, 0, 204,
682 204, 204, 204, 204, 204, 204, 204, 204, 205, 205,
683 205, 205, 205, 0, 205, 205, 205, 0, 205, 205,
684 206, 206, 0, 206, 206, 206, 206, 206, 206, 206,
685 206, 206, 207, 207, 0, 0, 207, 207, 0, 207,
686 207, 0, 207, 207, 208, 208, 0, 0, 208, 208,
687 208, 208, 208, 208, 208, 208, 209, 209, 0, 0,
688 209, 209, 209, 209, 209, 209, 209, 209, 210, 210,
689 0, 0, 210, 210, 210, 210, 210, 210, 210, 210,
690 211, 211, 0, 0, 211, 211, 211, 211, 211, 211,
691 211, 211, 212, 212, 0, 0, 212, 212, 212, 212,
693 212, 212, 212, 212, 213, 213, 0, 213, 214, 214,
694 0, 0, 214, 214, 214, 214, 214, 214, 214, 214,
695 215, 215, 0, 0, 215, 215, 215, 215, 215, 215,
696 215, 215, 216, 216, 0, 0, 216, 216, 216, 216,
697 216, 216, 216, 216, 217, 217, 0, 217, 218, 218,
698 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
699 219, 219, 219, 219, 219, 219, 219, 219, 219, 219,
700 219, 219, 220, 220, 0, 220, 221, 221, 221, 0,
701 0, 0, 221, 221, 0, 221, 222, 222, 0, 0,
702 222, 222, 222, 222, 222, 222, 222, 222, 223, 223,
704 223, 0, 0, 0, 223, 223, 0, 223, 224, 224,
705 0, 0, 224, 224, 224, 224, 224, 224, 224, 224,
706 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
707 225, 225, 226, 226, 0, 226, 226, 226, 226, 226,
708 226, 226, 226, 226, 227, 227, 0, 0, 227, 227,
709 227, 227, 227, 227, 227, 227, 189, 189, 189, 189,
710 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
711 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
712 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
713 189, 189, 189, 189, 189, 189, 189, 189, 189
717 static yy_state_type yy_last_accepting_state
;
718 static char *yy_last_accepting_cpos
;
720 extern int yy_flex_debug
;
721 int yy_flex_debug
= 0;
723 /* The intent behind this definition is that it'll catch
724 * any uses of REJECT which flex missed.
726 #define REJECT reject_used_but_not_detected
727 #define yymore() yymore_used_but_not_detected
728 #define YY_MORE_ADJ 0
729 #define YY_RESTORE_YY_MORE_OFFSET
731 #line 1 "lxr/script.l"
732 /**********************************************************************
733 @ read charpter of "1.lex define for general txt" in lxr-doc.md.
734 **********************************************************************/
739 #line 12 "lxr/script.l"
740 // flex -o script.lex.c script.l
741 #include "../lxr/token_id.h"
742 #include "../gmr/parser.tab.h"
752 int g_cpreproc_flag
= 0;
753 int g_cmnt_state
= EN_CMNT_NONE
;
756 char cmnt_buff
[1024]={0};
760 /** set content flag automatically. **/
761 #define RETURN(token) g_content_before_cmnt=1; return token;
764 ** script.lexXXX.c is extension for general script.l.
765 ** config.lexXXX.c is extension for script.l with menuconfig
768 //#include "script.lexdecl.c"
770 #include "config.lexdecl.c"
771 //#include "../lexer.lexdecl.c"
773 /**********************************************************************
774 @ read charpter of "2.char set" in lxr-doc.md
775 **********************************************************************/
776 /** char set defination **/
779 ** @ BEGIN(<STATE>);, set state. use BEGIN(INITIAL); and return XXX; to recover to previous state.
780 ** @ return <TOKEN_ID>;, return a non-zero value, it's the token id output to grammar program.
781 ** @ without return, it steal stay in yylex(), and analyze text continiously.
783 #line 784 "lxr/script.lex.c"
787 #define DOLLR_QUOTE 2
788 #define C_CMNT_STATE 3
789 #define SH_CMNT_STATE 4
797 #ifndef YY_NO_UNISTD_H
798 /* Special case for "unistd.h", since it is non-ANSI. We include it way
799 * down here because we want the user's section 1 to have been scanned first.
800 * The user has a chance to override it with an option.
805 #ifndef YY_EXTRA_TYPE
806 #define YY_EXTRA_TYPE void *
809 static int yy_init_globals (void );
811 /* Accessor methods to globals.
812 These are made visible to non-reentrant scanners for convenience. */
814 int yylex_destroy (void );
816 int yyget_debug (void );
818 void yyset_debug (int debug_flag
);
820 YY_EXTRA_TYPE
yyget_extra (void );
822 void yyset_extra (YY_EXTRA_TYPE user_defined
);
824 FILE *yyget_in (void );
826 void yyset_in (FILE * _in_str
);
828 FILE *yyget_out (void );
830 void yyset_out (FILE * _out_str
);
832 yy_size_t
yyget_leng (void );
834 char *yyget_text (void );
836 int yyget_lineno (void );
838 void yyset_lineno (int _line_number
);
840 /* Macros after this point can all be overridden by user definitions in
844 #ifndef YY_SKIP_YYWRAP
846 extern "C" int yywrap (void );
848 extern int yywrap (void );
854 static void yyunput (int c
,char *buf_ptr
);
859 static void yy_flex_strncpy (char *,yyconst
char *,int );
862 #ifdef YY_NEED_STRLEN
863 static int yy_flex_strlen (yyconst
char * );
869 static int yyinput (void );
871 static int input (void );
876 /* Amount of stuff to slurp up with each read. */
877 #ifndef YY_READ_BUF_SIZE
879 /* On IA-64, the buffer size is 16k, not 8k */
880 #define YY_READ_BUF_SIZE 16384
882 #define YY_READ_BUF_SIZE 8192
883 #endif /* __ia64__ */
886 /* Copy whatever the last rule matched to the standard output. */
888 /* This used to be an fputs(), but since the string might contain NUL's,
889 * we now use fwrite().
891 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
894 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
895 * is returned in "result".
898 #define YY_INPUT(buf,result,max_size) \
899 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
903 for ( n = 0; n < max_size && \
904 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
907 buf[n++] = (char) c; \
908 if ( c == EOF && ferror( yyin ) ) \
909 YY_FATAL_ERROR( "input in flex scanner failed" ); \
915 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
917 if( errno != EINTR) \
919 YY_FATAL_ERROR( "input in flex scanner failed" ); \
930 /* No semi-colon after return; correct usage is to write "yyterminate();" -
931 * we don't want an extra ';' after the "return" because that will cause
932 * some compilers to complain about unreachable statements.
935 #define yyterminate() return YY_NULL
938 /* Number of entries by which start-condition stack grows. */
939 #ifndef YY_START_STACK_INCR
940 #define YY_START_STACK_INCR 25
943 /* Report a fatal error. */
944 #ifndef YY_FATAL_ERROR
945 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
948 /* end tables serialization structures and prototypes */
950 /* Default declaration of generated scanner - a define so the user can
951 * easily add parameters.
954 #define YY_DECL_IS_OURS 1
956 extern int yylex (void);
958 #define YY_DECL int yylex (void)
959 #endif /* !YY_DECL */
961 /* Code executed at the beginning of each rule, after yytext and yyleng
964 #ifndef YY_USER_ACTION
965 #define YY_USER_ACTION
968 /* Code executed at the end of each rule. */
970 #define YY_BREAK /*LINTED*/break;
973 #define YY_RULE_SETUP \
976 /** The main scanner function which does all the work.
980 yy_state_type yy_current_state
;
993 (yy_start
) = 1; /* first start state */
1001 if ( ! YY_CURRENT_BUFFER
) {
1002 yyensure_buffer_stack ();
1003 YY_CURRENT_BUFFER_LVALUE
=
1004 yy_create_buffer(yyin
,YY_BUF_SIZE
);
1007 yy_load_buffer_state( );
1011 #line 76 "lxr/script.l"
1015 /*****************************************************
1016 ** mask, quoted string
1018 ** trans-byte char used as a normal string char. it will
1019 ** be combined to T_WORD and T_WORD_QUOTE.
1020 *****************************************************/
1022 #line 1023 "lxr/script.lex.c"
1024 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1026 yy_cp
= (yy_c_buf_p
);
1028 /* Support of yytext. */
1029 *yy_cp
= (yy_hold_char
);
1031 /* yy_bp points to the position in yy_ch_buf of the start of
1036 yy_current_state
= (yy_start
);
1040 YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)] ;
1041 if ( yy_accept
[yy_current_state
] )
1043 (yy_last_accepting_state
) = yy_current_state
;
1044 (yy_last_accepting_cpos
) = yy_cp
;
1046 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1048 yy_current_state
= (int) yy_def
[yy_current_state
];
1049 if ( yy_current_state
>= 190 )
1050 yy_c
= yy_meta
[(unsigned int) yy_c
];
1052 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1055 while ( yy_base
[yy_current_state
] != 857 );
1058 yy_act
= yy_accept
[yy_current_state
];
1060 { /* have to back up */
1061 yy_cp
= (yy_last_accepting_cpos
);
1062 yy_current_state
= (yy_last_accepting_state
);
1063 yy_act
= yy_accept
[yy_current_state
];
1066 YY_DO_BEFORE_ACTION
;
1068 do_action
: /* This label is used only to access EOF actions. */
1071 { /* beginning of action switch */
1072 case 0: /* must back up */
1073 /* undo the effects of YY_DO_BEFORE_ACTION */
1074 *yy_cp
= (yy_hold_char
);
1075 yy_cp
= (yy_last_accepting_cpos
);
1076 yy_current_state
= (yy_last_accepting_state
);
1077 goto yy_find_action
;
1081 #line 86 "lxr/script.l"
1082 { append_string(&strbuff
, &yytext
[1], 1); }
1084 /** '', single quote string **/
1087 #line 89 "lxr/script.l"
1088 { append_string(&strbuff
, &yytext
[1], 1); BEGIN(DOLLR_QUOTE
); }
1092 /* rule 3 can match eol */
1094 #line 91 "lxr/script.l"
1095 { append_string(&strbuff
, yytext
, yyleng
); }
1099 #line 92 "lxr/script.l"
1100 { append_string(&strbuff
, yytext
, yyleng
); /* TBD: append trans-byte func */ }
1104 #line 93 "lxr/script.l"
1105 { append_string(&strbuff
, yytext
, yyleng
); BEGIN(INITIAL
); return T_WORD_QUOTE
; }
1109 /* rule 6 can match eol */
1111 #line 95 "lxr/script.l"
1112 { append_string(&strbuff
, yytext
, yyleng
); return T_WORD_QUOTE
; }
1115 ** $``, append. get executing script text, after string expanded, append
1116 ** '$' before $1. or append '\$' before string expanded.
1119 /* rule 7 can match eol */
1121 #line 100 "lxr/script.l"
1123 printf(":: string content:\n%s\n", yytext
);
1126 // str=$(echo "$yytext" | bash)
1127 // append_string "$str" ${#str}
1131 /** ``, command executing string quote. **/
1133 /* rule 8 can match eol */
1135 #line 109 "lxr/script.l"
1137 printf(":: string content:\n%s\n", yytext
);
1140 // str=$(echo "$yytext" | bash)
1141 // append_string "$str" ${#str}
1145 /*****************************************************
1147 ** @ C-PREPROC-CMD begin with '#', with token matching.
1148 ** @ SH-CMNT begin with '#'.
1150 ** @ C89-CMNT, and compatible with sh cmdline.
1151 ** @ C89-EXT-CMNT, compatible with sh cmdline, and it
1152 ** can include C89-CMNT in it.
1153 ** @ comment token proc. eg: CmntStub, apidoc-gen.
1154 *****************************************************/
1156 ** c pre-proc define
1159 ** @ C_PREPROC_CMD token recognizing after '#', to compatible with c-lang(#include or #if).
1160 ** @ modify comment expr, and do not use SH_CMNT_STATE state.
1161 ** @ append OnCPreProc() invoking.
1162 ** @ process C_PREPROC_CMD in C_PREPROC state.
1166 #line 137 "lxr/script.l"
1167 { if (retval
= lex_c_preproc_hdr ()) return retval
; }
1169 /* this state should be defined in grammar extend. */
1171 /* XXX: use this expr for tmp. */
1174 #line 141 "lxr/script.l"
1175 { if (retval
= lex_c_preproc_param ()) return retval
; }
1180 ** to compatible with c-lang, insert a ' ' space after comment char.
1185 #line 148 "lxr/script.l"
1186 { printf("SH-CMNT:\n%s", yytext
); BEGIN(SH_CMNT_STATE
); }
1191 #line 150 "lxr/script.l"
1192 { /* printf("%s", yytext); */ }
1195 /* rule 13 can match eol */
1197 #line 151 "lxr/script.l"
1198 { if (retval
= lex_sh_cmnt ()) return retval
; }
1204 ** this will be mixed with cmd dir. append a ' ' after '//'.
1205 ** or, char before '//' is a newline signature. eg: '\n', ',', ';'
1209 #line 159 "lxr/script.l"
1211 // printf("last_token=%d; g_content_before_cmnt=%d;\n", last_token, g_content_before_cmnt);
1212 // if (last_token == 0 || g_content_before_cmnt == 0)
1213 /* TBD: '//' will be mixed with command line parameter. */
1215 printf("C99-CMNT:\n%s\n", yytext
);
1217 // return T_CMNT_STR;
1222 ** C89 normal style comment.
1223 ** TBD: append a C_CMNT_STATE2, process comment without punct and token
1224 ** processing, in order to decreas cpu cost.
1225 ** TBD: use xxx_string() as a string for comment.
1229 #line 175 "lxr/script.l"
1231 g_cmnt_state
=EN_CMNT_BEGIN
;
1233 strcpy(cmnt_buff
, "/*");
1235 BEGIN(C_CMNT_STATE
);
1236 // return T_CMNT_STR;
1240 /* only process newline mask */
1243 #line 185 "lxr/script.l"
1245 /* dual-mask treated as one splash */
1246 cmnt_buff
[cmnt_idx
]='\\';
1248 cmnt_buff
[cmnt_idx
]=0;
1252 /* rule 17 can match eol */
1254 #line 191 "lxr/script.l"
1256 cmnt_buff
[cmnt_idx
]='\n';
1258 cmnt_buff
[cmnt_idx
]=0;
1263 #line 196 "lxr/script.l"
1266 * this means a char after /*, set with extended comment state.
1267 * process '\n' as a normal char in comment.
1268 * or, if it's a standard comment after content, '\n' is a termination char for comment.
1270 if (g_cmnt_state
== EN_CMNT_BEGIN
)
1271 g_cmnt_state
=EN_CMNT_EXTEND
;
1273 memcpy(&cmnt_buff
[cmnt_idx
], yytext
, yyleng
);
1275 cmnt_buff
[cmnt_idx
]=0;
1278 * C89 extend comment. use /@ instead of "/**" in cmdline.
1279 * or use '/**' as '/*', it's compactiable with c comment in shell script.
1280 * and does not conflect with string wildcast feature in CLI.
1286 #line 215 "lxr/script.l"
1288 if (g_cmnt_state
== EN_CMNT_BEGIN
)
1289 g_cmnt_state
=EN_CMNT
;
1290 strcat(&cmnt_buff
[cmnt_idx
], yytext
);
1292 /* append_string(&strbuff, yytext, yyleng); */
1297 #line 222 "lxr/script.l"
1299 cmnt_buff
[cmnt_idx
]='/';
1301 cmnt_buff
[cmnt_idx
]=0;
1305 /* rule 21 can match eol */
1307 #line 227 "lxr/script.l"
1314 #line 230 "lxr/script.l"
1316 lex_c89_cmnt_tail ();
1321 * TBD: append this code for comment grammar.
1322 // punct proc in comment state
1324 const struct token_id *id = punct_look_up_token(yytext, yyleng);
1325 printf(": %s\n", yytext);
1328 // token proc in comment state
1330 const struct token_id *id = token_id_lookup(yytext, yyleng);
1332 if (id && id->flags & TF_COMMAND)
1335 RETURN( id->token );
1337 alloc_string(&strbuff, yytext, yyleng);
1338 yylval.string = strbuff.text;
1342 /*****************************************************
1344 *****************************************************/
1346 /* rule 23 can match eol */
1348 #line 261 "lxr/script.l"
1351 // printf("NL-CONTINUE:\n");
1356 #line 265 "lxr/script.l"
1358 if (!is_unallocated_string(&strbuff
))
1362 yylval
.string
= strbuff
.text
;
1363 // printf(".WORD: %s\n", strbuff.text);
1370 * TBD: multi-nl can be combined into one nl.
1371 * it is processed by grammar.
1374 /* rule 25 can match eol */
1376 #line 280 "lxr/script.l"
1378 if (!is_unallocated_string(&strbuff
))
1380 // printf("^WORD: %s\n", strbuff.text);
1381 yylval
.string
= strbuff
.text
;
1383 g_content_before_cmnt
=0;
1388 /*****************************************************
1390 *****************************************************/
1391 /** ", dual quote string. **/
1394 #line 296 "lxr/script.l"
1396 if (is_unallocated_string(&strbuff
))
1397 new_string(&strbuff
);
1405 ** append nest implement with $() and ``.
1410 #line 308 "lxr/script.l"
1412 // c=translation(yytext[1]);
1413 // if (c == 0 && yytext[1] != 0)
1414 // unput(yytext[1]);
1416 // append_string(&strbuff, &c, 1);
1417 append_string(&strbuff
, &yytext
[1], 1);
1422 #line 316 "lxr/script.l"
1423 { append_string(&strbuff
, &yytext
[1], 1); /* BEGIN(QUOTE_EXEC); */ }
1427 #line 317 "lxr/script.l"
1429 // printf("T_WORD_QUOTE\n");
1430 // state=pop_state();
1431 yylval
.string
= strbuff
.text
;
1433 return T_WORD_QUOTE
;
1437 /* rule 30 can match eol */
1439 #line 324 "lxr/script.l"
1440 { append_string(&strbuff
, yytext
, yyleng
); }
1444 #line 325 "lxr/script.l"
1446 // printf("%s", yytext);
1447 append_string(&strbuff
, yytext
, yyleng
);
1449 * '\', '$', '@', '`', process.
1454 /*****************************************************
1455 ** punct and env var.
1456 *****************************************************/
1458 ** [[:punct:]] char filter, get special char like $, ", entering relative
1459 ** state. as the special char can be used nestly, use stack to store it.
1460 ** for others, unput() back to buffer.
1463 ** do not recognize punct in INITIAL state.
1464 ** recognize it in received word state.
1468 #line 347 "lxr/script.l"
1469 { if (retval
= lex_punct(INITIAL
)) return retval
; }
1471 /** put those conent into state of ¡¯DOLLOR¡® **/
1474 #line 350 "lxr/script.l"
1475 { if (retval
= const_string(&strbuff
, T_SUBST_ENVAR
)) { g_content_before_cmnt
=1; return retval
; } }
1478 /* rule 34 can match eol */
1480 #line 351 "lxr/script.l"
1481 { if (retval
= const_string(&strbuff
, T_SUBST_ENVAR
)) { g_content_before_cmnt
=1; return retval
; } }
1486 #line 353 "lxr/script.l"
1494 #line 357 "lxr/script.l"
1497 if (yytext
[0] == '{')
1499 env_state
= ENV_BRACE
;
1501 else if (yytext
[0] == '}')
1503 env_state
= ENV_NONE
;
1505 else if (yytext
[0] == '(')
1507 env_state
= ENV_PAREN
;
1509 else if (yytext
[0] == ')')
1511 env_state
= ENV_NONE
;
1513 else if (yytext
[0] == '[')
1515 env_state
= ENV_BRACKET
;
1517 else if (yytext
[0] == ']')
1519 env_state
= ENV_NONE
;
1526 #line 385 "lxr/script.l"
1528 env_state
= ENV_DBRACKET
;
1533 #line 388 "lxr/script.l"
1536 env_state
= ENV_NONE
;
1542 #line 393 "lxr/script.l"
1544 env_state
= ENV_DPAREN
;
1549 #line 396 "lxr/script.l"
1552 env_state
= ENV_NONE
;
1556 /*****************************************************
1557 ** const value word.
1558 *****************************************************/
1561 * hex, digit, oct, bin, float
1562 * @ the difference from c-lang is, it append signature
1563 * before digit/oct/float as a const word.
1564 * @ l/L sfx at the float value means it's a double flout,
1565 * here append d/D for the same meaning.
1566 * @ it append binary const word.
1570 #line 414 "lxr/script.l"
1571 { if (retval
= const_string(&strbuff
, T_HEX_WORD
)) { g_content_before_cmnt
=1; return retval
; } }
1575 #line 415 "lxr/script.l"
1576 { if (retval
= const_string(&strbuff
, T_DIGIT_WORD
)) { g_content_before_cmnt
=1; return retval
; } }
1579 * oct string recognized as digital string.
1583 #line 419 "lxr/script.l"
1584 { if (retval
= const_string(&strbuff
, T_OCT_WORD
)) { g_content_before_cmnt
=1; return retval
; } }
1589 #line 421 "lxr/script.l"
1590 { if (retval
= const_string(&strbuff
, T_BIN_WORD
)) { g_content_before_cmnt
=1; return retval
; } }
1595 #line 423 "lxr/script.l"
1596 { if (retval
= const_string(&strbuff
, T_FLOAT_WORD
)) { g_content_before_cmnt
=1; return retval
; } }
1599 [+-]?{D}+\.{D}+({E})?{FS}? {
1600 printf("FLOAT: %s\n", yytext);
1602 // alloc_string(&strbuff, yytext, yyleng);
1603 // yylval.string = strbuff.text;
1604 // last="T_STR_LITERAL";
1605 // return T_STR_LITERAL;
1608 /*****************************************************
1610 *****************************************************/
1612 ** symbol word or rsv-word.
1613 ** if rsv-word not matching, it's a symbol
1617 #line 442 "lxr/script.l"
1618 { if (retval
= lex_token_word()) return retval
; }
1622 ** this stage can be combined with symbol.
1626 #line 447 "lxr/script.l"
1628 // printf("WORD: %s\n", yytext);
1630 append_string(&strbuff
, yytext
, yyleng
);
1632 yylval
.string
= strbuff
.text
;
1638 ** text without blanks, and include none-blank display char.
1639 ** it's a WORD with SIGNATURES. normally, it can be a regex string.
1642 ** STRWORD is not used in INITIAL state.
1644 printf("STRWORD: %s\n", yytext);
1648 /*****************************************************
1650 ** this state is invoked in 'help' reserved-word proc.
1652 *****************************************************/
1654 /** general string append. **/
1657 #line 475 "lxr/script.l"
1658 { append_string(&strbuff
, yytext
, strlen(yytext
)); }
1660 /** ignore string after reserved-word 'help'. **/
1663 #line 477 "lxr/script.l"
1664 { /* do nothing here. */ }
1666 /** comment info in help txt, it will be treated as a new line **/
1668 /* rule 50 can match eol */
1670 #line 480 "lxr/script.l"
1671 { if (strbuff
.text_size
) append_string(&strbuff
, "\n", 1); }
1673 /** multiple new lines treated as one new line **/
1675 /* rule 51 can match eol */
1677 #line 482 "lxr/script.l"
1679 if (strbuff
.text_size
)
1680 append_string(&strbuff
, "\n", 1);
1683 /* at the beginning of help_text doc */
1688 /** new line with a word char. exit help doc state. **/
1690 /* rule 52 can match eol */
1692 #line 493 "lxr/script.l"
1694 unput(yytext
[yyleng
-1]);
1695 //append_string(&strbuff, "\n", 1);
1696 ln_string(&strbuff
);
1697 yylval
.string
= strbuff
.text
;
1702 case YY_STATE_EOF(HELP_TXT
):
1703 #line 501 "lxr/script.l"
1705 ln_string(&strbuff
);
1706 yylval
.string
= strbuff
.text
;
1722 /** general string append. **/
1725 #line 519 "lxr/script.l"
1727 /* first word is used for ending token. */
1729 append_string(&strbuff
, yytext
, strlen(yytext
));
1732 /** ignore string after reserved-word 'help'. **/
1735 #line 525 "lxr/script.l"
1736 { /* do nothing here. */ }
1738 /** comment info in help txt, it will be treated as a new line **/
1740 /* rule 55 can match eol */
1742 #line 528 "lxr/script.l"
1743 { if (strbuff
.text_size
) append_string(&strbuff
, "\n", 1); }
1745 /** multiple new lines treated as one new line **/
1747 /* rule 56 can match eol */
1749 #line 530 "lxr/script.l"
1750 { if (strbuff
.text_size
) append_string(&strbuff
, "\n", 1); }
1752 /** new line with a word char. exit help doc state. **/
1754 /* rule 57 can match eol */
1756 #line 533 "lxr/script.l"
1758 unput(yytext
[yyleng
-1]);
1759 append_string(&strbuff
, "\n", 1);
1760 yylval
.string
= strbuff
.text
;
1765 case YY_STATE_EOF(THIS_DOC
):
1766 #line 540 "lxr/script.l"
1773 /*****************************************************
1775 *****************************************************/
1776 case YY_STATE_EOF(INITIAL
):
1777 case YY_STATE_EOF(DUALQUOTE
):
1778 case YY_STATE_EOF(DOLLR_QUOTE
):
1779 case YY_STATE_EOF(C_CMNT_STATE
):
1780 case YY_STATE_EOF(SH_CMNT_STATE
):
1781 case YY_STATE_EOF(COMMAND
):
1782 case YY_STATE_EOF(PARAM
):
1783 case YY_STATE_EOF(C_PREPROC
):
1784 case YY_STATE_EOF(ENV_VAR
):
1785 #line 549 "lxr/script.l"
1795 /*****************************************************
1797 *****************************************************/
1800 #line 562 "lxr/script.l"
1801 {} /** For others, do nothing **/
1805 #line 564 "lxr/script.l"
1808 #line 1809 "lxr/script.lex.c"
1810 case YY_END_OF_BUFFER
:
1812 /* Amount of text matched not including the EOB char. */
1813 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
1815 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1816 *yy_cp
= (yy_hold_char
);
1817 YY_RESTORE_YY_MORE_OFFSET
1819 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1821 /* We're scanning a new file or input source. It's
1822 * possible that this happened because the user
1823 * just pointed yyin at a new source and called
1824 * yylex(). If so, then we have to assure
1825 * consistency between YY_CURRENT_BUFFER and our
1826 * globals. Here is the right place to do so, because
1827 * this is the first action (other than possibly a
1828 * back-up) that will match for the new input source.
1830 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1831 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
1832 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1835 /* Note that here we test for yy_c_buf_p "<=" to the position
1836 * of the first EOB in the buffer, since yy_c_buf_p will
1837 * already have been incremented past the NUL character
1838 * (since all states make transitions on EOB to the
1839 * end-of-buffer state). Contrast this with the test
1842 if ( (yy_c_buf_p
) <= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1843 { /* This was really a NUL. */
1844 yy_state_type yy_next_state
;
1846 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
1848 yy_current_state
= yy_get_previous_state( );
1850 /* Okay, we're now positioned to make the NUL
1851 * transition. We couldn't have
1852 * yy_get_previous_state() go ahead and do it
1853 * for us because it doesn't know how to deal
1854 * with the possibility of jamming (and we don't
1855 * want to build jamming into it because then it
1856 * will run more slowly).
1859 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1861 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1863 if ( yy_next_state
)
1865 /* Consume the NUL. */
1866 yy_cp
= ++(yy_c_buf_p
);
1867 yy_current_state
= yy_next_state
;
1873 yy_cp
= (yy_c_buf_p
);
1874 goto yy_find_action
;
1878 else switch ( yy_get_next_buffer( ) )
1880 case EOB_ACT_END_OF_FILE
:
1882 (yy_did_buffer_switch_on_eof
) = 0;
1886 /* Note: because we've taken care in
1887 * yy_get_next_buffer() to have set up
1888 * yytext, we can now set up
1889 * yy_c_buf_p so that if some total
1890 * hoser (like flex itself) wants to
1891 * call the scanner after we return the
1892 * YY_NULL, it'll still work - another
1893 * YY_NULL will get returned.
1895 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
1897 yy_act
= YY_STATE_EOF(YY_START
);
1903 if ( ! (yy_did_buffer_switch_on_eof
) )
1909 case EOB_ACT_CONTINUE_SCAN
:
1911 (yytext_ptr
) + yy_amount_of_matched_text
;
1913 yy_current_state
= yy_get_previous_state( );
1915 yy_cp
= (yy_c_buf_p
);
1916 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1919 case EOB_ACT_LAST_MATCH
:
1921 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1923 yy_current_state
= yy_get_previous_state( );
1925 yy_cp
= (yy_c_buf_p
);
1926 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1927 goto yy_find_action
;
1934 "fatal flex scanner internal error--no action found" );
1935 } /* end of action switch */
1936 } /* end of scanning one token */
1937 } /* end of user's declarations */
1938 } /* end of yylex */
1940 /* yy_get_next_buffer - try to read in a new buffer
1942 * Returns a code representing an action:
1943 * EOB_ACT_LAST_MATCH -
1944 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1945 * EOB_ACT_END_OF_FILE - end of file
1947 static int yy_get_next_buffer (void)
1949 char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1950 char *source
= (yytext_ptr
);
1951 yy_size_t number_to_move
, i
;
1954 if ( (yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] )
1956 "fatal flex scanner internal error--end of buffer missed" );
1958 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1959 { /* Don't try to fill the buffer, so this is an EOF. */
1960 if ( (yy_c_buf_p
) - (yytext_ptr
) - YY_MORE_ADJ
== 1 )
1962 /* We matched a single character, the EOB, so
1963 * treat this as a final EOF.
1965 return EOB_ACT_END_OF_FILE
;
1970 /* We matched some text prior to the EOB, first
1973 return EOB_ACT_LAST_MATCH
;
1977 /* Try to read more data. */
1979 /* First move last chars to start of buffer. */
1980 number_to_move
= (yy_size_t
) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1982 for ( i
= 0; i
< number_to_move
; ++i
)
1983 *(dest
++) = *(source
++);
1985 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1986 /* don't do the read, it's not guaranteed to return an EOF,
1989 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1993 yy_size_t num_to_read
=
1994 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1996 while ( num_to_read
<= 0 )
1997 { /* Not enough room in the buffer - grow it. */
1999 /* just a shorter name for the current buffer */
2000 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER_LVALUE
;
2002 int yy_c_buf_p_offset
=
2003 (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
2005 if ( b
->yy_is_our_buffer
)
2007 yy_size_t new_size
= b
->yy_buf_size
* 2;
2009 if ( new_size
<= 0 )
2010 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
2012 b
->yy_buf_size
*= 2;
2014 b
->yy_ch_buf
= (char *)
2015 /* Include room in for 2 EOB chars. */
2016 yyrealloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 );
2019 /* Can't grow it, we don't own it. */
2022 if ( ! b
->yy_ch_buf
)
2024 "fatal error - scanner input buffer overflow" );
2026 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
2028 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
2033 if ( num_to_read
> YY_READ_BUF_SIZE
)
2034 num_to_read
= YY_READ_BUF_SIZE
;
2036 /* Read in more data. */
2037 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
2038 (yy_n_chars
), num_to_read
);
2040 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
2043 if ( (yy_n_chars
) == 0 )
2045 if ( number_to_move
== YY_MORE_ADJ
)
2047 ret_val
= EOB_ACT_END_OF_FILE
;
2053 ret_val
= EOB_ACT_LAST_MATCH
;
2054 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
2055 YY_BUFFER_EOF_PENDING
;
2060 ret_val
= EOB_ACT_CONTINUE_SCAN
;
2062 if ((int) ((yy_n_chars
) + number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
2063 /* Extend the array by 50%, plus the number we really need. */
2064 int new_size
= (yy_n_chars
) + number_to_move
+ ((yy_n_chars
) >> 1);
2065 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
);
2066 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
2067 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2070 (yy_n_chars
) += number_to_move
;
2071 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] = YY_END_OF_BUFFER_CHAR
;
2072 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] = YY_END_OF_BUFFER_CHAR
;
2074 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
2079 /* yy_get_previous_state - get the state just before the EOB char was reached */
2081 static yy_state_type
yy_get_previous_state (void)
2083 yy_state_type yy_current_state
;
2086 yy_current_state
= (yy_start
);
2088 for ( yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
)
2090 YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
2091 if ( yy_accept
[yy_current_state
] )
2093 (yy_last_accepting_state
) = yy_current_state
;
2094 (yy_last_accepting_cpos
) = yy_cp
;
2096 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
2098 yy_current_state
= (int) yy_def
[yy_current_state
];
2099 if ( yy_current_state
>= 190 )
2100 yy_c
= yy_meta
[(unsigned int) yy_c
];
2102 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
2105 return yy_current_state
;
2108 /* yy_try_NUL_trans - try to make a transition on the NUL character
2111 * next_state = yy_try_NUL_trans( current_state );
2113 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
)
2116 char *yy_cp
= (yy_c_buf_p
);
2119 if ( yy_accept
[yy_current_state
] )
2121 (yy_last_accepting_state
) = yy_current_state
;
2122 (yy_last_accepting_cpos
) = yy_cp
;
2124 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
2126 yy_current_state
= (int) yy_def
[yy_current_state
];
2127 if ( yy_current_state
>= 190 )
2128 yy_c
= yy_meta
[(unsigned int) yy_c
];
2130 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
2131 yy_is_jam
= (yy_current_state
== 189);
2133 return yy_is_jam
? 0 : yy_current_state
;
2138 static void yyunput (int c
, char * yy_bp
)
2142 yy_cp
= (yy_c_buf_p
);
2144 /* undo effects of setting up yytext */
2145 *yy_cp
= (yy_hold_char
);
2147 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
2148 { /* need to shift things up to make room */
2149 /* +2 for EOB chars. */
2150 yy_size_t number_to_move
= (yy_n_chars
) + 2;
2151 char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
2152 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
2154 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
2156 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
2157 *--dest
= *--source
;
2159 yy_cp
+= (int) (dest
- source
);
2160 yy_bp
+= (int) (dest
- source
);
2161 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
2162 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
2164 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
2165 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2168 *--yy_cp
= (char) c
;
2170 (yytext_ptr
) = yy_bp
;
2171 (yy_hold_char
) = *yy_cp
;
2172 (yy_c_buf_p
) = yy_cp
;
2179 static int yyinput (void)
2181 static int input (void)
2187 *(yy_c_buf_p
) = (yy_hold_char
);
2189 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
2191 /* yy_c_buf_p now points to the character we want to return.
2192 * If this occurs *before* the EOB characters, then it's a
2193 * valid NUL; if not, then we've hit the end of the buffer.
2195 if ( (yy_c_buf_p
) < &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
2196 /* This was really a NUL. */
2197 *(yy_c_buf_p
) = '\0';
2200 { /* need more input */
2201 yy_size_t offset
= (yy_c_buf_p
) - (yytext_ptr
);
2204 switch ( yy_get_next_buffer( ) )
2206 case EOB_ACT_LAST_MATCH
:
2207 /* This happens because yy_g_n_b()
2208 * sees that we've accumulated a
2209 * token and flags that we need to
2210 * try matching the token before
2211 * proceeding. But for input(),
2212 * there's no matching to consider.
2213 * So convert the EOB_ACT_LAST_MATCH
2214 * to EOB_ACT_END_OF_FILE.
2217 /* Reset buffer status. */
2222 case EOB_ACT_END_OF_FILE
:
2227 if ( ! (yy_did_buffer_switch_on_eof
) )
2236 case EOB_ACT_CONTINUE_SCAN
:
2237 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
2243 c
= *(unsigned char *) (yy_c_buf_p
); /* cast for 8-bit char's */
2244 *(yy_c_buf_p
) = '\0'; /* preserve yytext */
2245 (yy_hold_char
) = *++(yy_c_buf_p
);
2249 #endif /* ifndef YY_NO_INPUT */
2251 /** Immediately switch to a different input stream.
2252 * @param input_file A readable stream.
2254 * @note This function does not reset the start condition to @c INITIAL .
2256 void yyrestart (FILE * input_file
)
2259 if ( ! YY_CURRENT_BUFFER
){
2260 yyensure_buffer_stack ();
2261 YY_CURRENT_BUFFER_LVALUE
=
2262 yy_create_buffer(yyin
,YY_BUF_SIZE
);
2265 yy_init_buffer(YY_CURRENT_BUFFER
,input_file
);
2266 yy_load_buffer_state( );
2269 /** Switch to a different input buffer.
2270 * @param new_buffer The new input buffer.
2273 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
)
2276 /* TODO. We should be able to replace this entire function body
2278 * yypop_buffer_state();
2279 * yypush_buffer_state(new_buffer);
2281 yyensure_buffer_stack ();
2282 if ( YY_CURRENT_BUFFER
== new_buffer
)
2285 if ( YY_CURRENT_BUFFER
)
2287 /* Flush out information for old buffer. */
2288 *(yy_c_buf_p
) = (yy_hold_char
);
2289 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
2290 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
2293 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2294 yy_load_buffer_state( );
2296 /* We don't actually know whether we did this switch during
2297 * EOF (yywrap()) processing, but the only time this flag
2298 * is looked at is after yywrap() is called, so it's safe
2299 * to go ahead and always set it.
2301 (yy_did_buffer_switch_on_eof
) = 1;
2304 static void yy_load_buffer_state (void)
2306 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
2307 (yytext_ptr
) = (yy_c_buf_p
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
2308 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
2309 (yy_hold_char
) = *(yy_c_buf_p
);
2312 /** Allocate and initialize an input buffer state.
2313 * @param file A readable stream.
2314 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2316 * @return the allocated buffer state.
2318 YY_BUFFER_STATE
yy_create_buffer (FILE * file
, int size
)
2322 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
2324 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2326 b
->yy_buf_size
= (yy_size_t
)size
;
2328 /* yy_ch_buf has to be 2 characters longer than the size given because
2329 * we need to put in 2 end-of-buffer characters.
2331 b
->yy_ch_buf
= (char *) yyalloc(b
->yy_buf_size
+ 2 );
2332 if ( ! b
->yy_ch_buf
)
2333 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2335 b
->yy_is_our_buffer
= 1;
2337 yy_init_buffer(b
,file
);
2342 /** Destroy the buffer.
2343 * @param b a buffer created with yy_create_buffer()
2346 void yy_delete_buffer (YY_BUFFER_STATE b
)
2352 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
2353 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
2355 if ( b
->yy_is_our_buffer
)
2356 yyfree((void *) b
->yy_ch_buf
);
2358 yyfree((void *) b
);
2361 /* Initializes or reinitializes a buffer.
2362 * This function is sometimes called more than once on the same buffer,
2363 * such as during a yyrestart() or at EOF.
2365 static void yy_init_buffer (YY_BUFFER_STATE b
, FILE * file
)
2370 yy_flush_buffer(b
);
2372 b
->yy_input_file
= file
;
2373 b
->yy_fill_buffer
= 1;
2375 /* If b is the current buffer, then yy_init_buffer was _probably_
2376 * called from yyrestart() or through yy_get_next_buffer.
2377 * In that case, we don't want to reset the lineno or column.
2379 if (b
!= YY_CURRENT_BUFFER
){
2380 b
->yy_bs_lineno
= 1;
2381 b
->yy_bs_column
= 0;
2384 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
2389 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2390 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2393 void yy_flush_buffer (YY_BUFFER_STATE b
)
2400 /* We always need two end-of-buffer characters. The first causes
2401 * a transition to the end-of-buffer state. The second causes
2402 * a jam in that state.
2404 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
2405 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
2407 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
2410 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2412 if ( b
== YY_CURRENT_BUFFER
)
2413 yy_load_buffer_state( );
2416 /** Pushes the new state onto the stack. The new state becomes
2417 * the current state. This function will allocate the stack
2419 * @param new_buffer The new state.
2422 void yypush_buffer_state (YY_BUFFER_STATE new_buffer
)
2424 if (new_buffer
== NULL
)
2427 yyensure_buffer_stack();
2429 /* This block is copied from yy_switch_to_buffer. */
2430 if ( YY_CURRENT_BUFFER
)
2432 /* Flush out information for old buffer. */
2433 *(yy_c_buf_p
) = (yy_hold_char
);
2434 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
2435 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
2438 /* Only push if top exists. Otherwise, replace top. */
2439 if (YY_CURRENT_BUFFER
)
2440 (yy_buffer_stack_top
)++;
2441 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2443 /* copied from yy_switch_to_buffer. */
2444 yy_load_buffer_state( );
2445 (yy_did_buffer_switch_on_eof
) = 1;
2448 /** Removes and deletes the top of the stack, if present.
2449 * The next element becomes the new top.
2452 void yypop_buffer_state (void)
2454 if (!YY_CURRENT_BUFFER
)
2457 yy_delete_buffer(YY_CURRENT_BUFFER
);
2458 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2459 if ((yy_buffer_stack_top
) > 0)
2460 --(yy_buffer_stack_top
);
2462 if (YY_CURRENT_BUFFER
) {
2463 yy_load_buffer_state( );
2464 (yy_did_buffer_switch_on_eof
) = 1;
2468 /* Allocates the stack if it does not exist.
2469 * Guarantees space for at least one push.
2471 static void yyensure_buffer_stack (void)
2473 yy_size_t num_to_alloc
;
2475 if (!(yy_buffer_stack
)) {
2477 /* First allocation is just for 2 elements, since we don't know if this
2478 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2479 * immediate realloc on the next call.
2481 num_to_alloc
= 1; /* After all that talk, this was set to 1 anyways... */
2482 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyalloc
2483 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2485 if ( ! (yy_buffer_stack
) )
2486 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2488 memset((yy_buffer_stack
), 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2490 (yy_buffer_stack_max
) = num_to_alloc
;
2491 (yy_buffer_stack_top
) = 0;
2495 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1){
2497 /* Increase the buffer to prepare for a possible push. */
2498 yy_size_t grow_size
= 8 /* arbitrary grow size */;
2500 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
2501 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyrealloc
2503 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2505 if ( ! (yy_buffer_stack
) )
2506 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2508 /* zero only the new slots.*/
2509 memset((yy_buffer_stack
) + (yy_buffer_stack_max
), 0, grow_size
* sizeof(struct yy_buffer_state
*));
2510 (yy_buffer_stack_max
) = num_to_alloc
;
2514 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2515 * @param base the character buffer
2516 * @param size the size in bytes of the character buffer
2518 * @return the newly allocated buffer state object.
2520 YY_BUFFER_STATE
yy_scan_buffer (char * base
, yy_size_t size
)
2525 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2526 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2527 /* They forgot to leave room for the EOB's. */
2530 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
2532 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2534 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
2535 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2536 b
->yy_is_our_buffer
= 0;
2537 b
->yy_input_file
= 0;
2538 b
->yy_n_chars
= b
->yy_buf_size
;
2539 b
->yy_is_interactive
= 0;
2541 b
->yy_fill_buffer
= 0;
2542 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2544 yy_switch_to_buffer(b
);
2549 /** Setup the input buffer state to scan a string. The next call to yylex() will
2550 * scan from a @e copy of @a str.
2551 * @param yystr a NUL-terminated string to scan
2553 * @return the newly allocated buffer state object.
2554 * @note If you want to scan bytes that may contain NUL values, then use
2555 * yy_scan_bytes() instead.
2557 YY_BUFFER_STATE
yy_scan_string (yyconst
char * yystr
)
2560 return yy_scan_bytes(yystr
,strlen(yystr
) );
2563 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2564 * scan from a @e copy of @a bytes.
2565 * @param yybytes the byte buffer to scan
2566 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2568 * @return the newly allocated buffer state object.
2570 YY_BUFFER_STATE
yy_scan_bytes (yyconst
char * yybytes
, yy_size_t _yybytes_len
)
2577 /* Get memory for full buffer, including space for trailing EOB's. */
2578 n
= _yybytes_len
+ 2;
2579 buf
= (char *) yyalloc(n
);
2581 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2583 for ( i
= 0; i
< _yybytes_len
; ++i
)
2584 buf
[i
] = yybytes
[i
];
2586 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
2588 b
= yy_scan_buffer(buf
,n
);
2590 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2592 /* It's okay to grow etc. this buffer, and we should throw it
2593 * away when we're done.
2595 b
->yy_is_our_buffer
= 1;
2600 #ifndef YY_EXIT_FAILURE
2601 #define YY_EXIT_FAILURE 2
2604 static void yy_fatal_error (yyconst
char* msg
)
2606 (void) fprintf( stderr
, "%s\n", msg
);
2607 exit( YY_EXIT_FAILURE
);
2610 /* Redefine yyless() so it works in section 3 code. */
2616 /* Undo effects of setting up yytext. */ \
2617 int yyless_macro_arg = (n); \
2618 YY_LESS_LINENO(yyless_macro_arg);\
2619 yytext[yyleng] = (yy_hold_char); \
2620 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2621 (yy_hold_char) = *(yy_c_buf_p); \
2622 *(yy_c_buf_p) = '\0'; \
2623 yyleng = yyless_macro_arg; \
2627 /* Accessor methods (get/set functions) to struct members. */
2629 /** Get the current line number.
2632 int yyget_lineno (void)
2638 /** Get the input stream.
2641 FILE *yyget_in (void)
2646 /** Get the output stream.
2649 FILE *yyget_out (void)
2654 /** Get the length of the current token.
2657 yy_size_t
yyget_leng (void)
2662 /** Get the current token.
2666 char *yyget_text (void)
2671 /** Set the current line number.
2672 * @param _line_number line number
2675 void yyset_lineno (int _line_number
)
2678 yylineno
= _line_number
;
2681 /** Set the input stream. This does not discard the current
2683 * @param _in_str A readable stream.
2685 * @see yy_switch_to_buffer
2687 void yyset_in (FILE * _in_str
)
2692 void yyset_out (FILE * _out_str
)
2697 int yyget_debug (void)
2699 return yy_flex_debug
;
2702 void yyset_debug (int _bdebug
)
2704 yy_flex_debug
= _bdebug
;
2707 static int yy_init_globals (void)
2709 /* Initialization is the same as for the non-reentrant scanner.
2710 * This function is called from yylex_destroy(), so don't allocate here.
2713 (yy_buffer_stack
) = 0;
2714 (yy_buffer_stack_top
) = 0;
2715 (yy_buffer_stack_max
) = 0;
2716 (yy_c_buf_p
) = (char *) 0;
2720 /* Defined in main.c */
2729 /* For future reference: Set errno on error, since we are called by
2735 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2736 int yylex_destroy (void)
2739 /* Pop the buffer stack, destroying each element. */
2740 while(YY_CURRENT_BUFFER
){
2741 yy_delete_buffer(YY_CURRENT_BUFFER
);
2742 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2743 yypop_buffer_state();
2746 /* Destroy the stack itself. */
2747 yyfree((yy_buffer_stack
) );
2748 (yy_buffer_stack
) = NULL
;
2750 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2751 * yylex() is called, initialization will occur. */
2758 * Internal utility routines.
2762 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
)
2766 for ( i
= 0; i
< n
; ++i
)
2771 #ifdef YY_NEED_STRLEN
2772 static int yy_flex_strlen (yyconst
char * s
)
2775 for ( n
= 0; s
[n
]; ++n
)
2782 void *yyalloc (yy_size_t size
)
2784 return (void *) malloc( size
);
2787 void *yyrealloc (void * ptr
, yy_size_t size
)
2790 /* The cast to (char *) in the following accommodates both
2791 * implementations that use char* generic pointers, and those
2792 * that use void* generic pointers. It works with the latter
2793 * because both ANSI C and C++ allow castless assignment from
2794 * any pointer type to void*, and deal with argument conversions
2795 * as though doing an assignment.
2797 return (void *) realloc( (char *) ptr
, size
);
2800 void yyfree (void * ptr
)
2802 free( (char *) ptr
); /* see yyrealloc() for (char *) cast */
2805 #define YYTABLES_NAME "yytables"
2807 #line 564 "lxr/script.l"
2811 #include "config.lexproc.c"
2812 //#include "../lexer.lexproc.c"
2814 //#include "script.lexproc.c"
2818 /*****************************************************
2820 ** this state is invoked in reserved-word proc.
2821 *****************************************************/
2825 const struct token_id *id = token_id_lookup(yytext, yyleng);
2827 current_pos.file = current_file;
2828 current_pos.lineno = yylineno;
2829 if (id && id->flags & TF_COMMAND) {
2833 alloc_string(&strbuff, yytext, yyleng);
2834 yylval.string = text;
2838 // warn_ignored_character(*yytext);
2850 "!=" return T_UNEQUAL;
2852 "<=" return T_LESS_EQUAL;
2853 ">" return T_GREATER;
2854 ">=" return T_GREATER_EQUAL;
2856 "(" return T_OPEN_PAREN;
2857 ")" return T_CLOSE_PAREN;
2858 ":=" { return T_COLON_EQUAL; }
2859 "+=" { return T_PLUS_EQUAL; }
2861 // char str = yytext[0];
2862 new_string(&strbuff);
2865 \n BEGIN(INITIAL); return T_EOL;
2867 const struct token_id *id = token_id_lookup(yytext, yyleng);
2868 if (id && id->flags & TF_PARAM) {
2872 alloc_string(&strbuff, yytext, yyleng);
2873 yylval.string = text;
2879 . warn_ignored_character(*yytext);