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