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