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