The Pedigree Project  0.1
lexer.c
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #line 2 "lexer.c"
21 
22 #line 4 "lexer.c"
23 
24 #define YY_INT_ALIGNED short int
25 
26 /* A lexical scanner generated by flex */
27 
28 #define FLEX_SCANNER
29 #define YY_FLEX_MAJOR_VERSION 2
30 #define YY_FLEX_MINOR_VERSION 5
31 #define YY_FLEX_SUBMINOR_VERSION 35
32 #if YY_FLEX_SUBMINOR_VERSION > 0
33 #define FLEX_BETA
34 #endif
35 
36 /* First, we deal with platform-specific or compiler-specific issues. */
37 
38 /* begin standard C headers. */
39 #include <errno.h>
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43 
44 /* end standard C headers. */
45 
46 /* flex integer type definitions */
47 
48 #ifndef FLEXINT_H
49 #define FLEXINT_H
50 
51 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52 
53 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54 
55 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56  * if you want the limit (max/min) macros for int types.
57  */
58 #ifndef __STDC_LIMIT_MACROS
59 #define __STDC_LIMIT_MACROS 1
60 #endif
61 
62 #include <inttypes.h>
63 typedef int8_t flex_int8_t;
64 typedef uint8_t flex_uint8_t;
65 typedef int16_t flex_int16_t;
66 typedef uint16_t flex_uint16_t;
67 typedef int32_t flex_int32_t;
68 typedef uint32_t flex_uint32_t;
69 #else
70 typedef signed char flex_int8_t;
71 typedef short int flex_int16_t;
72 typedef int flex_int32_t;
73 typedef unsigned char flex_uint8_t;
74 typedef unsigned short int flex_uint16_t;
75 typedef unsigned int flex_uint32_t;
76 
77 /* Limits of integral types. */
78 #ifndef INT8_MIN
79 #define INT8_MIN (-128)
80 #endif
81 #ifndef INT16_MIN
82 #define INT16_MIN (-32767 - 1)
83 #endif
84 #ifndef INT32_MIN
85 #define INT32_MIN (-2147483647 - 1)
86 #endif
87 #ifndef INT8_MAX
88 #define INT8_MAX (127)
89 #endif
90 #ifndef INT16_MAX
91 #define INT16_MAX (32767)
92 #endif
93 #ifndef INT32_MAX
94 #define INT32_MAX (2147483647)
95 #endif
96 #ifndef UINT8_MAX
97 #define UINT8_MAX (255U)
98 #endif
99 #ifndef UINT16_MAX
100 #define UINT16_MAX (65535U)
101 #endif
102 #ifndef UINT32_MAX
103 #define UINT32_MAX (4294967295U)
104 #endif
105 
106 #endif /* ! C99 */
107 
108 #endif /* ! FLEXINT_H */
109 
110 #ifdef __cplusplus
111 
112 /* The "const" storage-class-modifier is valid. */
113 #define YY_USE_CONST
114 
115 #else /* ! __cplusplus */
116 
117 /* C99 requires __STDC__ to be defined as 1. */
118 #if defined(__STDC__)
119 
120 #define YY_USE_CONST
121 
122 #endif /* defined (__STDC__) */
123 #endif /* ! __cplusplus */
124 
125 #ifdef YY_USE_CONST
126 #define yyconst const
127 #else
128 #define yyconst
129 #endif
130 
131 /* Returned upon end-of-file. */
132 #define YY_NULL 0
133 
134 /* Promotes a possibly negative, possibly signed char to an unsigned
135  * integer for use as an array index. If the signed char is negative,
136  * we want to instead treat it as an 8-bit unsigned char, hence the
137  * double cast.
138  */
139 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
140 
141 /* Enter a start condition. This macro really ought to take a parameter,
142  * but we do it the disgusting crufty way forced on us by the ()-less
143  * definition of BEGIN.
144  */
145 #define BEGIN (yy_start) = 1 + 2 *
146 
147 /* Translate the current start state into a value that can be later handed
148  * to BEGIN to return to the state. The YYSTATE alias is for lex
149  * compatibility.
150  */
151 #define YY_START (((yy_start) -1) / 2)
152 #define YYSTATE YY_START
153 
154 /* Action number for EOF rule of a given start state. */
155 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156 
157 /* Special action meaning "start processing a new file". */
158 #define YY_NEW_FILE yyrestart(yyin)
159 
160 #define YY_END_OF_BUFFER_CHAR 0
161 
162 /* Size of default input buffer. */
163 #ifndef YY_BUF_SIZE
164 #ifdef __ia64__
165 /* On IA-64, the buffer size is 16k, not 8k.
166  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167  * Ditto for the __ia64__ case accordingly.
168  */
169 #define YY_BUF_SIZE 32768
170 #else
171 #define YY_BUF_SIZE 16384
172 #endif /* __ia64__ */
173 #endif
174 
175 /* The state buf must be large enough to hold one state per character in the
176  * main buffer.
177  */
178 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
179 
180 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
181 #define YY_TYPEDEF_YY_BUFFER_STATE
182 typedef struct yy_buffer_state *YY_BUFFER_STATE;
183 #endif
184 
185 extern int yyleng;
186 
187 extern FILE *yyin, *yyout;
188 
189 #define EOB_ACT_CONTINUE_SCAN 0
190 #define EOB_ACT_END_OF_FILE 1
191 #define EOB_ACT_LAST_MATCH 2
192 
193 #define YY_LESS_LINENO(n)
194 
195 /* Return all but the first "n" matched characters back to the input stream. */
196 #define yyless(n) \
197  do \
198  { \
199  /* Undo effects of setting up yytext. */ \
200  int yyless_macro_arg = (n); \
201  YY_LESS_LINENO(yyless_macro_arg); \
202  *yy_cp = (yy_hold_char); \
203  YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = \
204  yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
205  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
206  } while (0)
207 
208 #define unput(c) yyunput(c, (yytext_ptr))
209 
210 #ifndef YY_TYPEDEF_YY_SIZE_T
211 #define YY_TYPEDEF_YY_SIZE_T
212 typedef size_t yy_size_t;
213 #endif
214 
215 #ifndef YY_STRUCT_YY_BUFFER_STATE
216 #define YY_STRUCT_YY_BUFFER_STATE
218 {
219  FILE *yy_input_file;
220 
221  char *yy_ch_buf; /* input buffer */
222  char *yy_buf_pos; /* current position in input buffer */
223 
224  /* Size of input buffer in bytes, not including room for EOB
225  * characters.
226  */
227  yy_size_t yy_buf_size;
228 
229  /* Number of characters read into yy_ch_buf, not including EOB
230  * characters.
231  */
232  int yy_n_chars;
233 
234  /* Whether we "own" the buffer - i.e., we know we created it,
235  * and can realloc() it to grow it, and should free() it to
236  * delete it.
237  */
238  int yy_is_our_buffer;
239 
240  /* Whether this is an "interactive" input source; if so, and
241  * if we're using stdio for input, then we want to use getc()
242  * instead of fread(), to make sure we stop fetching input after
243  * each newline.
244  */
245  int yy_is_interactive;
246 
247  /* Whether we're considered to be at the beginning of a line.
248  * If so, '^' rules will be active on the next match, otherwise
249  * not.
250  */
251  int yy_at_bol;
252 
256  /* Whether to try to fill the input buffer when we reach the
257  * end of it.
258  */
259  int yy_fill_buffer;
260 
261  int yy_buffer_status;
262 
263 #define YY_BUFFER_NEW 0
264 #define YY_BUFFER_NORMAL 1
265 /* When an EOF's been seen but there's still some text to process
266  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
267  * shouldn't try reading from the input source any more. We might
268  * still have a bunch of tokens to match, though, because of
269  * possible backing-up.
270  *
271  * When we actually see the EOF, we change the status to "new"
272  * (via yyrestart()), so that the user can continue scanning by
273  * just pointing yyin at a new input file.
274  */
275 #define YY_BUFFER_EOF_PENDING 2
276 };
277 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
278 
279 /* Stack of input buffers. */
280 static size_t yy_buffer_stack_top = 0;
281 static size_t yy_buffer_stack_max = 0;
282 static YY_BUFFER_STATE *yy_buffer_stack = 0;
284 /* We provide macros for accessing buffer states in case in the
285  * future we want to put the buffer states in a more general
286  * "scanner state".
287  *
288  * Returns the top of the stack, or NULL.
289  */
290 #define YY_CURRENT_BUFFER \
291  ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)
292 
293 /* Same as previous macro, but useful when we know that the buffer stack is not
294  * NULL or when we need an lvalue. For internal use only.
295  */
296 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
297 
298 /* yy_hold_char holds the character lost when yytext is formed. */
299 static char yy_hold_char;
300 static int yy_n_chars; /* number of characters read into yy_ch_buf */
301 int yyleng;
302 
303 /* Points to current character in buffer. */
304 static char *yy_c_buf_p = (char *) 0;
305 static int yy_init = 0; /* whether we need to initialize */
306 static int yy_start = 0; /* start state number */
307 
308 /* Flag which is used to allow yywrap()'s to do buffer switches
309  * instead of setting up a fresh yyin. A bit of a hack ...
310  */
311 static int yy_did_buffer_switch_on_eof;
312 
313 void yyrestart(FILE *input_file);
314 void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);
315 YY_BUFFER_STATE yy_create_buffer(FILE *file, int size);
316 void yy_delete_buffer(YY_BUFFER_STATE b);
317 void yy_flush_buffer(YY_BUFFER_STATE b);
318 void yypush_buffer_state(YY_BUFFER_STATE new_buffer);
319 void yypop_buffer_state(void);
320 
321 static void yyensure_buffer_stack(void);
322 static void yy_load_buffer_state(void);
323 static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file);
324 
325 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER)
326 
327 YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size);
328 YY_BUFFER_STATE yy_scan_string(yyconst char *yy_str);
329 YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, int len);
330 
331 void *yyalloc(yy_size_t);
332 void *yyrealloc(void *, yy_size_t);
333 void yyfree(void *);
334 
335 #define yy_new_buffer yy_create_buffer
336 
337 #define yy_set_interactive(is_interactive) \
338  { \
339  if (!YY_CURRENT_BUFFER) \
340  { \
341  yyensure_buffer_stack(); \
342  YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
343  } \
344  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
345  }
346 
347 #define yy_set_bol(at_bol) \
348  { \
349  if (!YY_CURRENT_BUFFER) \
350  { \
351  yyensure_buffer_stack(); \
352  YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
353  } \
354  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
355  }
356 
357 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
358 
359 /* Begin user sect3 */
360 
361 typedef unsigned char YY_CHAR;
362 
363 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
364 
365 typedef int yy_state_type;
366 
367 extern int yylineno;
368 
369 int yylineno = 1;
370 
371 extern char *yytext;
372 #define yytext_ptr yytext
373 
374 static yy_state_type yy_get_previous_state(void);
375 static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
376 static int yy_get_next_buffer(void);
377 static void yy_fatal_error(yyconst char msg[]);
378 
379 /* Done after the current pattern has been matched and before the
380  * corresponding action - sets up yytext.
381  */
382 #define YY_DO_BEFORE_ACTION \
383  (yytext_ptr) = yy_bp; \
384  yyleng = (size_t)(yy_cp - yy_bp); \
385  (yy_hold_char) = *yy_cp; \
386  *yy_cp = '\0'; \
387  (yy_c_buf_p) = yy_cp;
388 
389 #define YY_NUM_RULES 26
390 #define YY_END_OF_BUFFER 27
391 /* This struct is not used in this scanner,
392  but its presence is necessary. */
394 {
395  flex_int32_t yy_verify;
396  flex_int32_t yy_nxt;
397 };
398 static yyconst flex_int16_t yy_accept[85] = {
399  0, 0, 0, 27, 26, 25, 2, 4, 26, 24, 23, 23, 24, 24, 24, 24, 24,
400  20, 26, 21, 0, 1, 24, 23, 24, 24, 24, 24, 24, 24, 24, 0, 3, 22,
401  9, 24, 24, 24, 24, 24, 5, 24, 24, 6, 24, 24, 24, 10, 24, 24, 24,
402  24, 7, 24, 24, 24, 19, 24, 24, 17, 24, 24, 24, 24, 11, 24, 24, 24,
403  24, 24, 24, 12, 14, 8, 24, 24, 24, 18, 15, 24, 24, 13, 24, 16, 0};
404 
405 static yyconst flex_int32_t yy_ec[256] = {
406  0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1,
407  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 5, 1, 1,
408  1, 1, 1, 1, 1, 6, 1, 7, 1, 1, 8, 9, 9, 9, 9, 9, 9, 9, 9,
409  9, 1, 1, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19,
410  20, 21, 22, 23, 19, 19, 24, 25, 26, 27, 19, 19, 19, 19, 19, 28, 29, 30, 1,
411  19, 1, 31, 31, 31, 31,
412 
413  31, 31, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
414  32, 19, 19, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418  1, 1, 1, 1, 1,
419 
420  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
423 
424 static yyconst flex_int32_t yy_meta[33] = {0, 1, 1, 2, 1, 1, 1, 3, 4, 4, 4,
425  4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3,
426  3, 3, 3, 3, 3, 3, 1, 1, 1, 4, 3};
427 
428 static yyconst flex_int16_t yy_base[89] = {
429  0, 0, 0, 117, 118, 118, 118, 118, 113, 0, 25, 27, 95, 14, 100,
430  24, 107, 118, 0, 118, 109, 118, 0, 34, 50, 85, 89, 85, 93, 81,
431  88, 0, 118, 0, 89, 93, 83, 84, 94, 85, 0, 75, 80, 90, 74,
432  83, 68, 0, 71, 29, 78, 66, 73, 65, 58, 60, 0, 55, 65, 0,
433  48, 55, 61, 51, 54, 54, 50, 41, 42, 30, 33, 37, 0, 45, 37,
434  26, 39, 0, 0, 28, 21, 30, 21, 0, 118, 81, 83, 87, 40};
435 
436 static yyconst flex_int16_t yy_def[89] = {
437  0, 84, 1, 84, 84, 84, 84, 84, 85, 86, 86, 86, 86, 86, 86, 86, 86, 84,
438  87, 84, 85, 84, 86, 86, 86, 86, 86, 86, 86, 86, 86, 88, 84, 24, 86, 86,
439  86, 86, 86, 86, 88, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
440  86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
441  86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0, 84, 84, 84, 84};
442 
443 static yyconst flex_int16_t yy_nxt[151] = {
444  0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, 9, 13, 14, 9, 9, 9,
445  9, 9, 9, 9, 9, 9, 9, 9, 15, 9, 16, 17, 18, 19, 9, 9, 23,
446  23, 23, 23, 26, 29, 54, 27, 30, 23, 23, 40, 83, 82, 81, 80, 79, 78,
447  77, 76, 75, 55, 74, 73, 24, 33, 33, 33, 33, 33, 33, 33, 33, 72, 71,
448  70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 33, 20, 20, 20,
449  20, 22, 22, 32, 57, 32, 32, 56, 53, 52, 51, 50, 49, 48, 47, 46,
450 
451  45, 44, 43, 42, 41, 39, 38, 37, 36, 35, 34, 21, 31, 28, 25, 21, 84,
452  3, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
453  84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84};
454 
455 static yyconst flex_int16_t yy_chk[151] = {
456  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
457  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10,
458  10, 11, 11, 13, 15, 49, 13, 15, 23, 23, 88, 82, 81, 80, 79, 76, 75,
459  74, 73, 71, 49, 70, 69, 10, 24, 24, 24, 24, 24, 24, 24, 24, 68, 67,
460  66, 65, 64, 63, 62, 61, 60, 58, 57, 55, 54, 53, 52, 24, 85, 85, 85,
461  85, 86, 86, 87, 51, 87, 87, 50, 48, 46, 45, 44, 43, 42, 41, 39,
462 
463  38, 37, 36, 35, 34, 30, 29, 28, 27, 26, 25, 20, 16, 14, 12, 8, 3,
464  84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
465  84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84};
466 
467 static yy_state_type yy_last_accepting_state;
468 static char *yy_last_accepting_cpos;
469 
470 extern int yy_flex_debug;
471 int yy_flex_debug = 0;
472 
473 /* The intent behind this definition is that it'll catch
474  * any uses of REJECT which flex missed.
475  */
476 #define REJECT reject_used_but_not_detected
477 #define yymore() yymore_used_but_not_detected
478 #define YY_MORE_ADJ 0
479 #define YY_RESTORE_YY_MORE_OFFSET
480 char *yytext;
481 #line 1 "lexer.l"
482 #line 2 "lexer.l"
483 
484 #include "cmd.h"
485 #include "parser.h"
486 #include <stdio.h>
487 #include <unistd.h>
488 
489 typedef YYSTYPE type_t;
490 
491 type_t text_var();
492 type_t num_var();
493 type_t unicode_var();
494 type_t hex_var();
495 
496 #line 530 "lexer.c"
497 
498 #define INITIAL 0
499 
500 #ifndef YY_NO_UNISTD_H
501 /* Special case for "unistd.h", since it is non-ANSI. We include it way
502  * down here because we want the user's section 1 to have been scanned first.
503  * The user has a chance to override it with an option.
504  */
505 #include <unistd.h>
506 #endif
507 
508 #ifndef YY_EXTRA_TYPE
509 #define YY_EXTRA_TYPE void *
510 #endif
511 
512 static int yy_init_globals(void);
513 
514 /* Accessor methods to globals.
515  These are made visible to non-reentrant scanners for convenience. */
516 
517 int yylex_destroy(void);
518 
519 int yyget_debug(void);
520 
521 void yyset_debug(int debug_flag);
522 
523 YY_EXTRA_TYPE yyget_extra(void);
524 
525 void yyset_extra(YY_EXTRA_TYPE user_defined);
526 
527 FILE *yyget_in(void);
528 
529 void yyset_in(FILE *in_str);
530 
531 FILE *yyget_out(void);
532 
533 void yyset_out(FILE *out_str);
534 
535 int yyget_leng(void);
536 
537 char *yyget_text(void);
538 
539 int yyget_lineno(void);
540 
541 void yyset_lineno(int line_number);
542 
543 /* Macros after this point can all be overridden by user definitions in
544  * section 1.
545  */
546 
547 #ifndef YY_SKIP_YYWRAP
548 #ifdef __cplusplus
549 extern "C" int yywrap(void);
550 #else
551 extern int yywrap(void);
552 #endif
553 #endif
554 
555 static void yyunput(int c, char *buf_ptr);
556 
557 #ifndef yytext_ptr
558 static void yy_flex_strncpy(char *, yyconst char *, int);
559 #endif
560 
561 #ifdef YY_NEED_STRLEN
562 static int yy_flex_strlen(yyconst char *);
563 #endif
564 
565 #ifndef YY_NO_INPUT
566 
567 #ifdef __cplusplus
568 static int yyinput(void);
569 #else
570 static int input(void);
571 #endif
572 
573 #endif
574 
575 /* Amount of stuff to slurp up with each read. */
576 #ifndef YY_READ_BUF_SIZE
577 #ifdef __ia64__
578 /* On IA-64, the buffer size is 16k, not 8k */
579 #define YY_READ_BUF_SIZE 16384
580 #else
581 #define YY_READ_BUF_SIZE 8192
582 #endif /* __ia64__ */
583 #endif
584 
585 /* Copy whatever the last rule matched to the standard output. */
586 #ifndef ECHO
587 /* This used to be an fputs(), but since the string might contain NUL's,
588  * we now use fwrite().
589  */
590 #define ECHO \
591  do \
592  { \
593  if (fwrite(yytext, yyleng, 1, yyout)) \
594  { \
595  } \
596  } while (0)
597 #endif
598 
599 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
600  * is returned in "result".
601  */
602 #ifndef YY_INPUT
603 #define YY_INPUT(buf, result, max_size) \
604  if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \
605  { \
606  int c = '*'; \
607  size_t n; \
608  for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
609  buf[n] = (char) c; \
610  if (c == '\n') \
611  buf[n++] = (char) c; \
612  if (c == EOF && ferror(yyin)) \
613  YY_FATAL_ERROR("input in flex scanner failed"); \
614  result = n; \
615  } \
616  else \
617  { \
618  errno = 0; \
619  while ((result = fread(buf, 1, max_size, yyin)) == 0 && ferror(yyin)) \
620  { \
621  if (errno != EINTR) \
622  { \
623  YY_FATAL_ERROR("input in flex scanner failed"); \
624  break; \
625  } \
626  errno = 0; \
627  clearerr(yyin); \
628  } \
629  }
630 
631 #endif
632 
633 /* No semi-colon after return; correct usage is to write "yyterminate();" -
634  * we don't want an extra ';' after the "return" because that will cause
635  * some compilers to complain about unreachable statements.
636  */
637 #ifndef yyterminate
638 #define yyterminate() return YY_NULL
639 #endif
640 
641 /* Number of entries by which start-condition stack grows. */
642 #ifndef YY_START_STACK_INCR
643 #define YY_START_STACK_INCR 25
644 #endif
645 
646 /* Report a fatal error. */
647 #ifndef YY_FATAL_ERROR
648 #define YY_FATAL_ERROR(msg) yy_fatal_error(msg)
649 #endif
650 
651 /* end tables serialization structures and prototypes */
652 
653 /* Default declaration of generated scanner - a define so the user can
654  * easily add parameters.
655  */
656 #ifndef YY_DECL
657 #define YY_DECL_IS_OURS 1
658 
659 extern int yylex(void);
660 
661 #define YY_DECL int yylex(void)
662 #endif /* !YY_DECL */
663 
664 /* Code executed at the beginning of each rule, after yytext and yyleng
665  * have been set up.
666  */
667 #ifndef YY_USER_ACTION
668 #define YY_USER_ACTION
669 #endif
670 
671 /* Code executed at the end of each rule. */
672 #ifndef YY_BREAK
673 #define YY_BREAK break;
674 #endif
675 
676 #define YY_RULE_SETUP YY_USER_ACTION
677 
680 YY_DECL
681 {
682  register yy_state_type yy_current_state;
683  register char *yy_cp, *yy_bp;
684  register int yy_act;
685 
686 #line 17 "lexer.l"
687 
688 #line 720 "lexer.c"
689 
690  if (!(yy_init))
691  {
692  (yy_init) = 1;
693 
694 #ifdef YY_USER_INIT
695  YY_USER_INIT;
696 #endif
697 
698  if (!(yy_start))
699  (yy_start) = 1; /* first start state */
700 
701  if (!yyin)
702  yyin = stdin;
703 
704  if (!yyout)
705  yyout = stdout;
706 
707  if (!YY_CURRENT_BUFFER)
708  {
709  yyensure_buffer_stack();
710  YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
711  }
712 
713  yy_load_buffer_state();
714  }
715 
716  while (1) /* loops until end-of-file is reached */
717  {
718  yy_cp = (yy_c_buf_p);
719 
720  /* Support of yytext. */
721  *yy_cp = (yy_hold_char);
722 
723  /* yy_bp points to the position in yy_ch_buf of the start of
724  * the current run.
725  */
726  yy_bp = yy_cp;
727 
728  yy_current_state = (yy_start);
729  yy_match:
730  do
731  {
732  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
733  if (yy_accept[yy_current_state])
734  {
735  (yy_last_accepting_state) = yy_current_state;
736  (yy_last_accepting_cpos) = yy_cp;
737  }
738  while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
739  {
740  yy_current_state = (int) yy_def[yy_current_state];
741  if (yy_current_state >= 85)
742  yy_c = yy_meta[(unsigned int) yy_c];
743  }
744  yy_current_state =
745  yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
746  ++yy_cp;
747  } while (yy_base[yy_current_state] != 118);
748 
749  yy_find_action:
750  yy_act = yy_accept[yy_current_state];
751  if (yy_act == 0)
752  { /* have to back up */
753  yy_cp = (yy_last_accepting_cpos);
754  yy_current_state = (yy_last_accepting_state);
755  yy_act = yy_accept[yy_current_state];
756  }
757 
758  YY_DO_BEFORE_ACTION;
759 
760  do_action: /* This label is used only to access EOF actions. */
761 
762  switch (yy_act)
763  { /* beginning of action switch */
764  case 0: /* must back up */
765  /* undo the effects of YY_DO_BEFORE_ACTION */
766  *yy_cp = (yy_hold_char);
767  yy_cp = (yy_last_accepting_cpos);
768  yy_current_state = (yy_last_accepting_state);
769  goto yy_find_action;
770 
771  case 1:
772  *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
773  (yy_c_buf_p) = yy_cp -= 1;
774  YY_DO_BEFORE_ACTION; /* set up yytext again */
775  YY_RULE_SETUP
776 #line 19 "lexer.l"
777  {
778  }
779  YY_BREAK
780  case 2:
781  /* rule 2 can match eol */
782  YY_RULE_SETUP
783 #line 20 "lexer.l"
784  {
785  return NEWLINE;
786  }
787  YY_BREAK
788  case 3:
789  YY_RULE_SETUP
790 #line 21 "lexer.l"
791  {
792  yylval.c = yytext[1];
793  return QUOTED_CHAR;
794  }
795  YY_BREAK
796  case 4:
797  YY_RULE_SETUP
798 #line 22 "lexer.l"
799  {
800  return QUOTE;
801  }
802  YY_BREAK
803  case 5:
804  YY_RULE_SETUP
805 #line 23 "lexer.l"
806  {
807  yylval = unicode_var();
808  return CODE_POINT;
809  }
810  YY_BREAK
811  case 6:
812  YY_RULE_SETUP
813 #line 24 "lexer.l"
814  {
815  return CTRL;
816  }
817  YY_BREAK
818  case 7:
819  YY_RULE_SETUP
820 #line 25 "lexer.l"
821  {
822  return SHIFT;
823  }
824  YY_BREAK
825  case 8:
826  YY_RULE_SETUP
827 #line 26 "lexer.l"
828  {
829  return CTRL_SHIFT;
830  }
831  YY_BREAK
832  case 9:
833  YY_RULE_SETUP
834 #line 27 "lexer.l"
835  {
836  return ALT;
837  }
838  YY_BREAK
839  case 10:
840  YY_RULE_SETUP
841 #line 28 "lexer.l"
842  {
843  return ALTGR;
844  }
845  YY_BREAK
846  case 11:
847  YY_RULE_SETUP
848 #line 29 "lexer.l"
849  {
850  return CTRL_ALT;
851  }
852  YY_BREAK
853  case 12:
854  YY_RULE_SETUP
855 #line 30 "lexer.l"
856  {
857  return SHIFT_ALT;
858  }
859  YY_BREAK
860  case 13:
861  YY_RULE_SETUP
862 #line 31 "lexer.l"
863  {
864  return CTRL_SHIFT_ALT;
865  }
866  YY_BREAK
867  case 14:
868  YY_RULE_SETUP
869 #line 32 "lexer.l"
870  {
871  return CTRL_ALTGR;
872  }
873  YY_BREAK
874  case 15:
875  YY_RULE_SETUP
876 #line 33 "lexer.l"
877  {
878  return SHIFT_ALTGR;
879  }
880  YY_BREAK
881  case 16:
882  YY_RULE_SETUP
883 #line 34 "lexer.l"
884  {
885  return CTRL_SHIFT_ALTGR;
886  }
887  YY_BREAK
888  case 17:
889  YY_RULE_SETUP
890 #line 35 "lexer.l"
891  {
892  return COMBINE;
893  }
894  YY_BREAK
895  case 18:
896  YY_RULE_SETUP
897 #line 36 "lexer.l"
898  {
899  return SET_COMBINE;
900  }
901  YY_BREAK
902  case 19:
903  YY_RULE_SETUP
904 #line 37 "lexer.l"
905  {
906  return DEFINE;
907  }
908  YY_BREAK
909  case 20:
910  YY_RULE_SETUP
911 #line 38 "lexer.l"
912  {
913  return OPEN_SQ;
914  }
915  YY_BREAK
916  case 21:
917  YY_RULE_SETUP
918 #line 39 "lexer.l"
919  {
920  return CLOSE_SQ;
921  }
922  YY_BREAK
923  case 22:
924  YY_RULE_SETUP
925 #line 40 "lexer.l"
926  {
927  yylval = hex_var();
928  return NUM;
929  }
930  YY_BREAK
931  case 23:
932  YY_RULE_SETUP
933 #line 41 "lexer.l"
934  {
935  yylval = num_var();
936  return NUM;
937  }
938  YY_BREAK
939  case 24:
940  YY_RULE_SETUP
941 #line 42 "lexer.l"
942  {
943  yylval = text_var();
944  return STRING;
945  }
946  YY_BREAK
947  case 25:
948  YY_RULE_SETUP
949 #line 43 "lexer.l"
950  {
951  }
952  YY_BREAK
953  case YY_STATE_EOF(INITIAL):
954 #line 44 "lexer.l"
955  {
956  return END;
957  }
958  YY_BREAK
959  case 26:
960  YY_RULE_SETUP
961 #line 46 "lexer.l"
962  ECHO;
963  YY_BREAK
964 #line 941 "lexer.c"
965 
966  case YY_END_OF_BUFFER:
967  {
968  /* Amount of text matched not including the EOB char. */
969  int yy_amount_of_matched_text =
970  (int) (yy_cp - (yytext_ptr)) - 1;
971 
972  /* Undo the effects of YY_DO_BEFORE_ACTION. */
973  *yy_cp = (yy_hold_char);
974  YY_RESTORE_YY_MORE_OFFSET
975 
976  if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW)
977  {
978  /* We're scanning a new file or input source. It's
979  * possible that this happened because the user
980  * just pointed yyin at a new source and called
981  * yylex(). If so, then we have to assure
982  * consistency between YY_CURRENT_BUFFER and our
983  * globals. Here is the right place to do so, because
984  * this is the first action (other than possibly a
985  * back-up) that will match for the new input source.
986  */
987  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
988  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
989  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
990  YY_BUFFER_NORMAL;
991  }
992 
993  /* Note that here we test for yy_c_buf_p "<=" to the position
994  * of the first EOB in the buffer, since yy_c_buf_p will
995  * already have been incremented past the NUL character
996  * (since all states make transitions on EOB to the
997  * end-of-buffer state). Contrast this with the test
998  * in input().
999  */
1000  if ((yy_c_buf_p) <=
1001  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
1002  { /* This was really a NUL. */
1003  yy_state_type yy_next_state;
1004 
1005  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1006 
1007  yy_current_state = yy_get_previous_state();
1008 
1009  /* Okay, we're now positioned to make the NUL
1010  * transition. We couldn't have
1011  * yy_get_previous_state() go ahead and do it
1012  * for us because it doesn't know how to deal
1013  * with the possibility of jamming (and we don't
1014  * want to build jamming into it because then it
1015  * will run more slowly).
1016  */
1017 
1018  yy_next_state = yy_try_NUL_trans(yy_current_state);
1019 
1020  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1021 
1022  if (yy_next_state)
1023  {
1024  /* Consume the NUL. */
1025  yy_cp = ++(yy_c_buf_p);
1026  yy_current_state = yy_next_state;
1027  goto yy_match;
1028  }
1029 
1030  else
1031  {
1032  yy_cp = (yy_c_buf_p);
1033  goto yy_find_action;
1034  }
1035  }
1036 
1037  else
1038  switch (yy_get_next_buffer())
1039  {
1040  case EOB_ACT_END_OF_FILE:
1041  {
1042  (yy_did_buffer_switch_on_eof) = 0;
1043 
1044  if (yywrap())
1045  {
1046  /* Note: because we've taken care in
1047  * yy_get_next_buffer() to have set up
1048  * yytext, we can now set up
1049  * yy_c_buf_p so that if some total
1050  * hoser (like flex itself) wants to
1051  * call the scanner after we return the
1052  * YY_NULL, it'll still work - another
1053  * YY_NULL will get returned.
1054  */
1055  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1056 
1057  yy_act = YY_STATE_EOF(YY_START);
1058  goto do_action;
1059  }
1060 
1061  else
1062  {
1063  if (!(yy_did_buffer_switch_on_eof))
1064  YY_NEW_FILE;
1065  }
1066  break;
1067  }
1068 
1069  case EOB_ACT_CONTINUE_SCAN:
1070  (yy_c_buf_p) =
1071  (yytext_ptr) + yy_amount_of_matched_text;
1072 
1073  yy_current_state = yy_get_previous_state();
1074 
1075  yy_cp = (yy_c_buf_p);
1076  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1077  goto yy_match;
1078 
1079  case EOB_ACT_LAST_MATCH:
1080  (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE
1081  ->yy_ch_buf[(yy_n_chars)];
1082 
1083  yy_current_state = yy_get_previous_state();
1084 
1085  yy_cp = (yy_c_buf_p);
1086  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1087  goto yy_find_action;
1088  }
1089  break;
1090  }
1091 
1092  default:
1093  YY_FATAL_ERROR(
1094  "fatal flex scanner internal error--no action found");
1095  } /* end of action switch */
1096  } /* end of scanning one token */
1097 } /* end of yylex */
1098 
1099 /* yy_get_next_buffer - try to read in a new buffer
1100  *
1101  * Returns a code representing an action:
1102  * EOB_ACT_LAST_MATCH -
1103  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1104  * EOB_ACT_END_OF_FILE - end of file
1105  */
1106 static int yy_get_next_buffer(void)
1107 {
1108  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1109  register char *source = (yytext_ptr);
1110  register int number_to_move, i;
1111  int ret_val;
1112 
1113  if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
1114  YY_FATAL_ERROR(
1115  "fatal flex scanner internal error--end of buffer missed");
1116 
1117  if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0)
1118  { /* Don't try to fill the buffer, so this is an EOF. */
1119  if ((yy_c_buf_p) - (yytext_ptr) -YY_MORE_ADJ == 1)
1120  {
1121  /* We matched a single character, the EOB, so
1122  * treat this as a final EOF.
1123  */
1124  return EOB_ACT_END_OF_FILE;
1125  }
1126 
1127  else
1128  {
1129  /* We matched some text prior to the EOB, first
1130  * process it.
1131  */
1132  return EOB_ACT_LAST_MATCH;
1133  }
1134  }
1135 
1136  /* Try to read more data. */
1137 
1138  /* First move last chars to start of buffer. */
1139  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1140 
1141  for (i = 0; i < number_to_move; ++i)
1142  *(dest++) = *(source++);
1143 
1144  if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
1145  /* don't do the read, it's not guaranteed to return an EOF,
1146  * just force an EOF
1147  */
1148  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1149 
1150  else
1151  {
1152  int num_to_read =
1153  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1154 
1155  while (num_to_read <= 0)
1156  { /* Not enough room in the buffer - grow it. */
1157 
1158  /* just a shorter name for the current buffer */
1159  YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1160 
1161  int yy_c_buf_p_offset = (int) ((yy_c_buf_p) -b->yy_ch_buf);
1162 
1163  if (b->yy_is_our_buffer)
1164  {
1165  int new_size = b->yy_buf_size * 2;
1166 
1167  if (new_size <= 0)
1168  b->yy_buf_size += b->yy_buf_size / 8;
1169  else
1170  b->yy_buf_size *= 2;
1171 
1172  b->yy_ch_buf = (char *)
1173  /* Include room in for 2 EOB chars. */
1174  yyrealloc((void *) b->yy_ch_buf, b->yy_buf_size + 2);
1175  }
1176  else
1177  /* Can't grow it, we don't own it. */
1178  b->yy_ch_buf = 0;
1179 
1180  if (!b->yy_ch_buf)
1181  YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
1182 
1183  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1184 
1185  num_to_read =
1186  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1187  }
1188 
1189  if (num_to_read > YY_READ_BUF_SIZE)
1190  num_to_read = YY_READ_BUF_SIZE;
1191 
1192  /* Read in more data. */
1193  YY_INPUT(
1194  (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1195  (yy_n_chars), (size_t) num_to_read);
1196 
1197  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1198  }
1199 
1200  if ((yy_n_chars) == 0)
1201  {
1202  if (number_to_move == YY_MORE_ADJ)
1203  {
1204  ret_val = EOB_ACT_END_OF_FILE;
1205  yyrestart(yyin);
1206  }
1207 
1208  else
1209  {
1210  ret_val = EOB_ACT_LAST_MATCH;
1211  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
1212  }
1213  }
1214 
1215  else
1216  ret_val = EOB_ACT_CONTINUE_SCAN;
1217 
1218  if ((yy_size_t)((yy_n_chars) + number_to_move) >
1219  YY_CURRENT_BUFFER_LVALUE->yy_buf_size)
1220  {
1221  /* Extend the array by 50%, plus the number we really need. */
1222  yy_size_t new_size =
1223  (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1224  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1225  (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size);
1226  if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
1227  YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
1228  }
1229 
1230  (yy_n_chars) += number_to_move;
1231  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1232  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] =
1233  YY_END_OF_BUFFER_CHAR;
1234 
1235  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1236 
1237  return ret_val;
1238 }
1239 
1240 /* yy_get_previous_state - get the state just before the EOB char was reached */
1241 
1242 static yy_state_type yy_get_previous_state(void)
1243 {
1244  register yy_state_type yy_current_state;
1245  register char *yy_cp;
1246 
1247  yy_current_state = (yy_start);
1248 
1249  for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp)
1250  {
1251  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1252  if (yy_accept[yy_current_state])
1253  {
1254  (yy_last_accepting_state) = yy_current_state;
1255  (yy_last_accepting_cpos) = yy_cp;
1256  }
1257  while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
1258  {
1259  yy_current_state = (int) yy_def[yy_current_state];
1260  if (yy_current_state >= 85)
1261  yy_c = yy_meta[(unsigned int) yy_c];
1262  }
1263  yy_current_state =
1264  yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1265  }
1266 
1267  return yy_current_state;
1268 }
1269 
1270 /* yy_try_NUL_trans - try to make a transition on the NUL character
1271  *
1272  * synopsis
1273  * next_state = yy_try_NUL_trans( current_state );
1274  */
1275 static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
1276 {
1277  register int yy_is_jam;
1278  register char *yy_cp = (yy_c_buf_p);
1279 
1280  register YY_CHAR yy_c = 1;
1281  if (yy_accept[yy_current_state])
1282  {
1283  (yy_last_accepting_state) = yy_current_state;
1284  (yy_last_accepting_cpos) = yy_cp;
1285  }
1286  while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
1287  {
1288  yy_current_state = (int) yy_def[yy_current_state];
1289  if (yy_current_state >= 85)
1290  yy_c = yy_meta[(unsigned int) yy_c];
1291  }
1292  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1293  yy_is_jam = (yy_current_state == 84);
1294 
1295  return yy_is_jam ? 0 : yy_current_state;
1296 }
1297 
1298 static void yyunput(int c, register char *yy_bp)
1299 {
1300  register char *yy_cp;
1301 
1302  yy_cp = (yy_c_buf_p);
1303 
1304  /* undo effects of setting up yytext */
1305  *yy_cp = (yy_hold_char);
1306 
1307  if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2)
1308  { /* need to shift things up to make room */
1309  /* +2 for EOB chars. */
1310  register int number_to_move = (yy_n_chars) + 2;
1311  register char *dest =
1312  &YY_CURRENT_BUFFER_LVALUE
1313  ->yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1314  register char *source =
1315  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1316 
1317  while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
1318  *--dest = *--source;
1319 
1320  yy_cp += (int) (dest - source);
1321  yy_bp += (int) (dest - source);
1322  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) =
1323  YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1324 
1325  if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2)
1326  YY_FATAL_ERROR("flex scanner push-back overflow");
1327  }
1328 
1329  *--yy_cp = (char) c;
1330 
1331  (yytext_ptr) = yy_bp;
1332  (yy_hold_char) = *yy_cp;
1333  (yy_c_buf_p) = yy_cp;
1334 }
1335 
1336 #ifndef YY_NO_INPUT
1337 #ifdef __cplusplus
1338 static int yyinput(void)
1339 #else
1340 static int input(void)
1341 #endif
1342 
1343 {
1344  int c;
1345 
1346  *(yy_c_buf_p) = (yy_hold_char);
1347 
1348  if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR)
1349  {
1350  /* yy_c_buf_p now points to the character we want to return.
1351  * If this occurs *before* the EOB characters, then it's a
1352  * valid NUL; if not, then we've hit the end of the buffer.
1353  */
1354  if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
1355  /* This was really a NUL. */
1356  *(yy_c_buf_p) = '\0';
1357 
1358  else
1359  { /* need more input */
1360  int offset = (yy_c_buf_p) - (yytext_ptr);
1361  ++(yy_c_buf_p);
1362 
1363  switch (yy_get_next_buffer())
1364  {
1365  case EOB_ACT_LAST_MATCH:
1366  /* This happens because yy_g_n_b()
1367  * sees that we've accumulated a
1368  * token and flags that we need to
1369  * try matching the token before
1370  * proceeding. But for input(),
1371  * there's no matching to consider.
1372  * So convert the EOB_ACT_LAST_MATCH
1373  * to EOB_ACT_END_OF_FILE.
1374  */
1375 
1376  /* Reset buffer status. */
1377  yyrestart(yyin);
1378 
1379  /*FALLTHROUGH*/
1380 
1381  case EOB_ACT_END_OF_FILE:
1382  {
1383  if (yywrap())
1384  return EOF;
1385 
1386  if (!(yy_did_buffer_switch_on_eof))
1387  YY_NEW_FILE;
1388 #ifdef __cplusplus
1389  return yyinput();
1390 #else
1391  return input();
1392 #endif
1393  }
1394 
1395  case EOB_ACT_CONTINUE_SCAN:
1396  (yy_c_buf_p) = (yytext_ptr) + offset;
1397  break;
1398  }
1399  }
1400  }
1401 
1402  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1403  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1404  (yy_hold_char) = *++(yy_c_buf_p);
1405 
1406  return c;
1407 }
1408 #endif /* ifndef YY_NO_INPUT */
1409 
1415 void yyrestart(FILE *input_file)
1416 {
1417  if (!YY_CURRENT_BUFFER)
1418  {
1419  yyensure_buffer_stack();
1420  YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
1421  }
1422 
1423  yy_init_buffer(YY_CURRENT_BUFFER, input_file);
1424  yy_load_buffer_state();
1425 }
1426 
1431 void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
1432 {
1433  /* TODO. We should be able to replace this entire function body
1434  * with
1435  * yypop_buffer_state();
1436  * yypush_buffer_state(new_buffer);
1437  */
1438  yyensure_buffer_stack();
1439  if (YY_CURRENT_BUFFER == new_buffer)
1440  return;
1441 
1442  if (YY_CURRENT_BUFFER)
1443  {
1444  /* Flush out information for old buffer. */
1445  *(yy_c_buf_p) = (yy_hold_char);
1446  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1447  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1448  }
1449 
1450  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1451  yy_load_buffer_state();
1452 
1453  /* We don't actually know whether we did this switch during
1454  * EOF (yywrap()) processing, but the only time this flag
1455  * is looked at is after yywrap() is called, so it's safe
1456  * to go ahead and always set it.
1457  */
1458  (yy_did_buffer_switch_on_eof) = 1;
1459 }
1460 
1461 static void yy_load_buffer_state(void)
1462 {
1463  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1464  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1465  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1466  (yy_hold_char) = *(yy_c_buf_p);
1467 }
1468 
1476 YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
1477 {
1478  YY_BUFFER_STATE b;
1479 
1480  b = (YY_BUFFER_STATE) yyalloc(sizeof(struct yy_buffer_state));
1481  if (!b)
1482  YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1483 
1484  b->yy_buf_size = size;
1485 
1486  /* yy_ch_buf has to be 2 characters longer than the size given because
1487  * we need to put in 2 end-of-buffer characters.
1488  */
1489  b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2);
1490  if (!b->yy_ch_buf)
1491  YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1492 
1493  b->yy_is_our_buffer = 1;
1494 
1495  yy_init_buffer(b, file);
1496 
1497  return b;
1498 }
1499 
1504 void yy_delete_buffer(YY_BUFFER_STATE b)
1505 {
1506  if (!b)
1507  return;
1508 
1509  if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
1510  YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1511 
1512  if (b->yy_is_our_buffer)
1513  yyfree((void *) b->yy_ch_buf);
1514 
1515  yyfree((void *) b);
1516 }
1517 
1518 #ifndef __cplusplus
1519 extern int isatty(int);
1520 #endif /* __cplusplus */
1521 
1522 /* Initializes or reinitializes a buffer.
1523  * This function is sometimes called more than once on the same buffer,
1524  * such as during a yyrestart() or at EOF.
1525  */
1526 static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file)
1527 
1528 {
1529  int oerrno = errno;
1530 
1531  yy_flush_buffer(b);
1532 
1533  b->yy_input_file = file;
1534  b->yy_fill_buffer = 1;
1535 
1536  /* If b is the current buffer, then yy_init_buffer was _probably_
1537  * called from yyrestart() or through yy_get_next_buffer.
1538  * In that case, we don't want to reset the lineno or column.
1539  */
1540  if (b != YY_CURRENT_BUFFER)
1541  {
1542  b->yy_bs_lineno = 1;
1543  b->yy_bs_column = 0;
1544  }
1545 
1546  b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
1547 
1548  errno = oerrno;
1549 }
1550 
1555 void yy_flush_buffer(YY_BUFFER_STATE b)
1556 {
1557  if (!b)
1558  return;
1559 
1560  b->yy_n_chars = 0;
1561 
1562  /* We always need two end-of-buffer characters. The first causes
1563  * a transition to the end-of-buffer state. The second causes
1564  * a jam in that state.
1565  */
1566  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1567  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1568 
1569  b->yy_buf_pos = &b->yy_ch_buf[0];
1570 
1571  b->yy_at_bol = 1;
1572  b->yy_buffer_status = YY_BUFFER_NEW;
1573 
1574  if (b == YY_CURRENT_BUFFER)
1575  yy_load_buffer_state();
1576 }
1577 
1584 void yypush_buffer_state(YY_BUFFER_STATE new_buffer)
1585 {
1586  if (new_buffer == NULL)
1587  return;
1588 
1589  yyensure_buffer_stack();
1590 
1591  /* This block is copied from yy_switch_to_buffer. */
1592  if (YY_CURRENT_BUFFER)
1593  {
1594  /* Flush out information for old buffer. */
1595  *(yy_c_buf_p) = (yy_hold_char);
1596  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1597  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1598  }
1599 
1600  /* Only push if top exists. Otherwise, replace top. */
1601  if (YY_CURRENT_BUFFER)
1602  (yy_buffer_stack_top)++;
1603  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1604 
1605  /* copied from yy_switch_to_buffer. */
1606  yy_load_buffer_state();
1607  (yy_did_buffer_switch_on_eof) = 1;
1608 }
1609 
1614 void yypop_buffer_state(void)
1615 {
1616  if (!YY_CURRENT_BUFFER)
1617  return;
1618 
1619  yy_delete_buffer(YY_CURRENT_BUFFER);
1620  YY_CURRENT_BUFFER_LVALUE = NULL;
1621  if ((yy_buffer_stack_top) > 0)
1622  --(yy_buffer_stack_top);
1623 
1624  if (YY_CURRENT_BUFFER)
1625  {
1626  yy_load_buffer_state();
1627  (yy_did_buffer_switch_on_eof) = 1;
1628  }
1629 }
1630 
1631 /* Allocates the stack if it does not exist.
1632  * Guarantees space for at least one push.
1633  */
1634 static void yyensure_buffer_stack(void)
1635 {
1636  int num_to_alloc;
1637 
1638  if (!(yy_buffer_stack))
1639  {
1640  /* First allocation is just for 2 elements, since we don't know if this
1641  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1642  * immediate realloc on the next call.
1643  */
1644  num_to_alloc = 1;
1645  (yy_buffer_stack) = (struct yy_buffer_state **) yyalloc(
1646  num_to_alloc * sizeof(struct yy_buffer_state *));
1647  if (!(yy_buffer_stack))
1648  YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
1649 
1650  memset(
1651  (yy_buffer_stack), 0,
1652  num_to_alloc * sizeof(struct yy_buffer_state *));
1653 
1654  (yy_buffer_stack_max) = num_to_alloc;
1655  (yy_buffer_stack_top) = 0;
1656  return;
1657  }
1658 
1659  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1)
1660  {
1661  /* Increase the buffer to prepare for a possible push. */
1662  int grow_size = 8 /* arbitrary grow size */;
1663 
1664  num_to_alloc = (yy_buffer_stack_max) + grow_size;
1665  (yy_buffer_stack) = (struct yy_buffer_state **) yyrealloc(
1666  (yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *));
1667  if (!(yy_buffer_stack))
1668  YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
1669 
1670  /* zero only the new slots.*/
1671  memset(
1672  (yy_buffer_stack) + (yy_buffer_stack_max), 0,
1673  grow_size * sizeof(struct yy_buffer_state *));
1674  (yy_buffer_stack_max) = num_to_alloc;
1675  }
1676 }
1677 
1685 YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size)
1686 {
1687  YY_BUFFER_STATE b;
1688 
1689  if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR ||
1690  base[size - 1] != YY_END_OF_BUFFER_CHAR)
1691  /* They forgot to leave room for the EOB's. */
1692  return 0;
1693 
1694  b = (YY_BUFFER_STATE) yyalloc(sizeof(struct yy_buffer_state));
1695  if (!b)
1696  YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
1697 
1698  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1699  b->yy_buf_pos = b->yy_ch_buf = base;
1700  b->yy_is_our_buffer = 0;
1701  b->yy_input_file = 0;
1702  b->yy_n_chars = b->yy_buf_size;
1703  b->yy_is_interactive = 0;
1704  b->yy_at_bol = 1;
1705  b->yy_fill_buffer = 0;
1706  b->yy_buffer_status = YY_BUFFER_NEW;
1707 
1708  yy_switch_to_buffer(b);
1709 
1710  return b;
1711 }
1712 
1721 YY_BUFFER_STATE yy_scan_string(yyconst char *yystr)
1722 {
1723  return yy_scan_bytes(yystr, strlen(yystr));
1724 }
1725 
1733 YY_BUFFER_STATE yy_scan_bytes(yyconst char *yybytes, int _yybytes_len)
1734 {
1735  YY_BUFFER_STATE b;
1736  char *buf;
1737  yy_size_t n;
1738  int i;
1739 
1740  /* Get memory for full buffer, including space for trailing EOB's. */
1741  n = _yybytes_len + 2;
1742  buf = (char *) yyalloc(n);
1743  if (!buf)
1744  YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
1745 
1746  for (i = 0; i < _yybytes_len; ++i)
1747  buf[i] = yybytes[i];
1748 
1749  buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
1750 
1751  b = yy_scan_buffer(buf, n);
1752  if (!b)
1753  YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
1754 
1755  /* It's okay to grow etc. this buffer, and we should throw it
1756  * away when we're done.
1757  */
1758  b->yy_is_our_buffer = 1;
1759 
1760  return b;
1761 }
1762 
1763 #ifndef YY_EXIT_FAILURE
1764 #define YY_EXIT_FAILURE 2
1765 #endif
1766 
1767 static void yy_fatal_error(yyconst char *msg)
1768 {
1769  (void) fprintf(stderr, "%s\n", msg);
1770  exit(YY_EXIT_FAILURE);
1771 }
1772 
1773 /* Redefine yyless() so it works in section 3 code. */
1774 
1775 #undef yyless
1776 #define yyless(n) \
1777  do \
1778  { \
1779  /* Undo effects of setting up yytext. */ \
1780  int yyless_macro_arg = (n); \
1781  YY_LESS_LINENO(yyless_macro_arg); \
1782  yytext[yyleng] = (yy_hold_char); \
1783  (yy_c_buf_p) = yytext + yyless_macro_arg; \
1784  (yy_hold_char) = *(yy_c_buf_p); \
1785  *(yy_c_buf_p) = '\0'; \
1786  yyleng = yyless_macro_arg; \
1787  } while (0)
1788 
1789 /* Accessor methods (get/set functions) to struct members. */
1790 
1794 int yyget_lineno(void)
1795 {
1796  return yylineno;
1797 }
1798 
1802 FILE *yyget_in(void)
1803 {
1804  return yyin;
1805 }
1806 
1810 FILE *yyget_out(void)
1811 {
1812  return yyout;
1813 }
1814 
1818 int yyget_leng(void)
1819 {
1820  return yyleng;
1821 }
1822 
1827 char *yyget_text(void)
1828 {
1829  return yytext;
1830 }
1831 
1836 void yyset_lineno(int line_number)
1837 {
1838  yylineno = line_number;
1839 }
1840 
1847 void yyset_in(FILE *in_str)
1848 {
1849  yyin = in_str;
1850 }
1851 
1852 void yyset_out(FILE *out_str)
1853 {
1854  yyout = out_str;
1855 }
1856 
1857 int yyget_debug(void)
1858 {
1859  return yy_flex_debug;
1860 }
1861 
1862 void yyset_debug(int bdebug)
1863 {
1864  yy_flex_debug = bdebug;
1865 }
1866 
1867 static int yy_init_globals(void)
1868 {
1869  /* Initialization is the same as for the non-reentrant scanner.
1870  * This function is called from yylex_destroy(), so don't allocate here.
1871  */
1872 
1873  (yy_buffer_stack) = 0;
1874  (yy_buffer_stack_top) = 0;
1875  (yy_buffer_stack_max) = 0;
1876  (yy_c_buf_p) = (char *) 0;
1877  (yy_init) = 0;
1878  (yy_start) = 0;
1879 
1880 /* Defined in main.c */
1881 #ifdef YY_STDINIT
1882  yyin = stdin;
1883  yyout = stdout;
1884 #else
1885  yyin = (FILE *) 0;
1886  yyout = (FILE *) 0;
1887 #endif
1888 
1889  /* For future reference: Set errno on error, since we are called by
1890  * yylex_init()
1891  */
1892  return 0;
1893 }
1894 
1895 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1896 int yylex_destroy(void)
1897 {
1898  /* Pop the buffer stack, destroying each element. */
1899  while (YY_CURRENT_BUFFER)
1900  {
1901  yy_delete_buffer(YY_CURRENT_BUFFER);
1902  YY_CURRENT_BUFFER_LVALUE = NULL;
1903  yypop_buffer_state();
1904  }
1905 
1906  /* Destroy the stack itself. */
1907  yyfree((yy_buffer_stack));
1908  (yy_buffer_stack) = NULL;
1909 
1910  /* Reset the globals. This is important in a non-reentrant scanner so the
1911  * next time yylex() is called, initialization will occur. */
1912  yy_init_globals();
1913 
1914  return 0;
1915 }
1916 
1917 /*
1918  * Internal utility routines.
1919  */
1920 
1921 #ifndef yytext_ptr
1922 static void yy_flex_strncpy(char *s1, yyconst char *s2, int n)
1923 {
1924  register int i;
1925  for (i = 0; i < n; ++i)
1926  s1[i] = s2[i];
1927 }
1928 #endif
1929 
1930 #ifdef YY_NEED_STRLEN
1931 static int yy_flex_strlen(yyconst char *s)
1932 {
1933  register int n;
1934  for (n = 0; s[n]; ++n)
1935  ;
1936 
1937  return n;
1938 }
1939 #endif
1940 
1941 void *yyalloc(yy_size_t size)
1942 {
1943  return (void *) malloc(size);
1944 }
1945 
1946 void *yyrealloc(void *ptr, yy_size_t size)
1947 {
1948  /* The cast to (char *) in the following accommodates both
1949  * implementations that use char* generic pointers, and those
1950  * that use void* generic pointers. It works with the latter
1951  * because both ANSI C and C++ allow castless assignment from
1952  * any pointer type to void*, and deal with argument conversions
1953  * as though doing an assignment.
1954  */
1955  return (void *) realloc((char *) ptr, size);
1956 }
1957 
1958 void yyfree(void *ptr)
1959 {
1960  free((char *) ptr); /* see yyrealloc() for (char *) cast */
1961 }
1962 
1963 #define YYTABLES_NAME "yytables"
1964 
1965 #line 46 "lexer.l"
1966 
1967 type_t text_var()
1968 {
1969  type_t toRet;
1970  strncpy(toRet.str, yytext, yyleng);
1971  toRet.str[yyleng] = '\0';
1972  return toRet;
1973 }
1974 
1975 type_t num_var()
1976 {
1977  type_t toRet;
1978  toRet.n = atoi(yytext);
1979  return toRet;
1980 }
1981 
1982 type_t unicode_var()
1983 {
1984  type_t toRet;
1985  toRet.n = strtoul(yytext + 2, 0, 16);
1986  return toRet;
1987 }
1988 
1989 type_t hex_var()
1990 {
1991  type_t toRet;
1992  toRet.n = strtoul(yytext, 0, 16);
1993  return toRet;
1994 }
int yy_bs_lineno
Definition: lexer.c:253
int yy_bs_column
Definition: lexer.c:254