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