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