Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5563 | serge | 1 | #line 2 "glcpp/glcpp-lex.c" |
2 | |||
3 | #line 4 "glcpp/glcpp-lex.c" |
||
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 35 |
||
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 |
||
21 | #include |
||
22 | #include |
||
23 | #include |
||
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 |
||
33 | |||
34 | #if defined (__STDC_VERSION__) && __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 |
||
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 | |||
58 | /* Limits of integral types. */ |
||
59 | #ifndef INT8_MIN |
||
60 | #define INT8_MIN (-128) |
||
61 | #endif |
||
62 | #ifndef INT16_MIN |
||
63 | #define INT16_MIN (-32767-1) |
||
64 | #endif |
||
65 | #ifndef INT32_MIN |
||
66 | #define INT32_MIN (-2147483647-1) |
||
67 | #endif |
||
68 | #ifndef INT8_MAX |
||
69 | #define INT8_MAX (127) |
||
70 | #endif |
||
71 | #ifndef INT16_MAX |
||
72 | #define INT16_MAX (32767) |
||
73 | #endif |
||
74 | #ifndef INT32_MAX |
||
75 | #define INT32_MAX (2147483647) |
||
76 | #endif |
||
77 | #ifndef UINT8_MAX |
||
78 | #define UINT8_MAX (255U) |
||
79 | #endif |
||
80 | #ifndef UINT16_MAX |
||
81 | #define UINT16_MAX (65535U) |
||
82 | #endif |
||
83 | #ifndef UINT32_MAX |
||
84 | #define UINT32_MAX (4294967295U) |
||
85 | #endif |
||
86 | |||
87 | #endif /* ! C99 */ |
||
88 | |||
89 | #endif /* ! FLEXINT_H */ |
||
90 | |||
91 | #ifdef __cplusplus |
||
92 | |||
93 | /* The "const" storage-class-modifier is valid. */ |
||
94 | #define YY_USE_CONST |
||
95 | |||
96 | #else /* ! __cplusplus */ |
||
97 | |||
98 | /* C99 requires __STDC__ to be defined as 1. */ |
||
99 | #if defined (__STDC__) |
||
100 | |||
101 | #define YY_USE_CONST |
||
102 | |||
103 | #endif /* defined (__STDC__) */ |
||
104 | #endif /* ! __cplusplus */ |
||
105 | |||
106 | #ifdef YY_USE_CONST |
||
107 | #define yyconst const |
||
108 | #else |
||
109 | #define yyconst |
||
110 | #endif |
||
111 | |||
112 | /* Returned upon end-of-file. */ |
||
113 | #define YY_NULL 0 |
||
114 | |||
115 | /* Promotes a possibly negative, possibly signed char to an unsigned |
||
116 | * integer for use as an array index. If the signed char is negative, |
||
117 | * we want to instead treat it as an 8-bit unsigned char, hence the |
||
118 | * double cast. |
||
119 | */ |
||
120 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
||
121 | |||
122 | /* An opaque pointer. */ |
||
123 | #ifndef YY_TYPEDEF_YY_SCANNER_T |
||
124 | #define YY_TYPEDEF_YY_SCANNER_T |
||
125 | typedef void* yyscan_t; |
||
126 | #endif |
||
127 | |||
128 | /* For convenience, these vars (plus the bison vars far below) |
||
129 | are macros in the reentrant scanner. */ |
||
130 | #define yyin yyg->yyin_r |
||
131 | #define yyout yyg->yyout_r |
||
132 | #define yyextra yyg->yyextra_r |
||
133 | #define yyleng yyg->yyleng_r |
||
134 | #define yytext yyg->yytext_r |
||
135 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
||
136 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
||
137 | #define yy_flex_debug yyg->yy_flex_debug_r |
||
138 | |||
139 | /* Enter a start condition. This macro really ought to take a parameter, |
||
140 | * but we do it the disgusting crufty way forced on us by the ()-less |
||
141 | * definition of BEGIN. |
||
142 | */ |
||
143 | #define BEGIN yyg->yy_start = 1 + 2 * |
||
144 | |||
145 | /* Translate the current start state into a value that can be later handed |
||
146 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
||
147 | * compatibility. |
||
148 | */ |
||
149 | #define YY_START ((yyg->yy_start - 1) / 2) |
||
150 | #define YYSTATE YY_START |
||
151 | |||
152 | /* Action number for EOF rule of a given start state. */ |
||
153 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
||
154 | |||
155 | /* Special action meaning "start processing a new file". */ |
||
156 | #define YY_NEW_FILE glcpp_restart(yyin ,yyscanner ) |
||
157 | |||
158 | #define YY_END_OF_BUFFER_CHAR 0 |
||
159 | |||
160 | /* Size of default input buffer. */ |
||
161 | #ifndef YY_BUF_SIZE |
||
162 | #ifdef __ia64__ |
||
163 | /* On IA-64, the buffer size is 16k, not 8k. |
||
164 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
||
165 | * Ditto for the __ia64__ case accordingly. |
||
166 | */ |
||
167 | #define YY_BUF_SIZE 32768 |
||
168 | #else |
||
169 | #define YY_BUF_SIZE 16384 |
||
170 | #endif /* __ia64__ */ |
||
171 | #endif |
||
172 | |||
173 | /* The state buf must be large enough to hold one state per character in the main buffer. |
||
174 | */ |
||
175 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
||
176 | |||
177 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
||
178 | #define YY_TYPEDEF_YY_BUFFER_STATE |
||
179 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
||
180 | #endif |
||
181 | |||
182 | #define EOB_ACT_CONTINUE_SCAN 0 |
||
183 | #define EOB_ACT_END_OF_FILE 1 |
||
184 | #define EOB_ACT_LAST_MATCH 2 |
||
185 | |||
186 | #define YY_LESS_LINENO(n) |
||
187 | |||
188 | /* Return all but the first "n" matched characters back to the input stream. */ |
||
189 | #define yyless(n) \ |
||
190 | do \ |
||
191 | { \ |
||
192 | /* Undo effects of setting up yytext. */ \ |
||
193 | int yyless_macro_arg = (n); \ |
||
194 | YY_LESS_LINENO(yyless_macro_arg);\ |
||
195 | *yy_cp = yyg->yy_hold_char; \ |
||
196 | YY_RESTORE_YY_MORE_OFFSET \ |
||
197 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
||
198 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
||
199 | } \ |
||
200 | while ( 0 ) |
||
201 | |||
202 | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) |
||
203 | |||
204 | #ifndef YY_TYPEDEF_YY_SIZE_T |
||
205 | #define YY_TYPEDEF_YY_SIZE_T |
||
206 | typedef size_t yy_size_t; |
||
207 | #endif |
||
208 | |||
209 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
||
210 | #define YY_STRUCT_YY_BUFFER_STATE |
||
211 | struct yy_buffer_state |
||
212 | { |
||
213 | FILE *yy_input_file; |
||
214 | |||
215 | char *yy_ch_buf; /* input buffer */ |
||
216 | char *yy_buf_pos; /* current position in input buffer */ |
||
217 | |||
218 | /* Size of input buffer in bytes, not including room for EOB |
||
219 | * characters. |
||
220 | */ |
||
221 | yy_size_t yy_buf_size; |
||
222 | |||
223 | /* Number of characters read into yy_ch_buf, not including EOB |
||
224 | * characters. |
||
225 | */ |
||
226 | int yy_n_chars; |
||
227 | |||
228 | /* Whether we "own" the buffer - i.e., we know we created it, |
||
229 | * and can realloc() it to grow it, and should free() it to |
||
230 | * delete it. |
||
231 | */ |
||
232 | int yy_is_our_buffer; |
||
233 | |||
234 | /* Whether this is an "interactive" input source; if so, and |
||
235 | * if we're using stdio for input, then we want to use getc() |
||
236 | * instead of fread(), to make sure we stop fetching input after |
||
237 | * each newline. |
||
238 | */ |
||
239 | int yy_is_interactive; |
||
240 | |||
241 | /* Whether we're considered to be at the beginning of a line. |
||
242 | * If so, '^' rules will be active on the next match, otherwise |
||
243 | * not. |
||
244 | */ |
||
245 | int yy_at_bol; |
||
246 | |||
247 | int yy_bs_lineno; /**< The line count. */ |
||
248 | int yy_bs_column; /**< The column count. */ |
||
249 | |||
250 | /* Whether to try to fill the input buffer when we reach the |
||
251 | * end of it. |
||
252 | */ |
||
253 | int yy_fill_buffer; |
||
254 | |||
255 | int yy_buffer_status; |
||
256 | |||
257 | #define YY_BUFFER_NEW 0 |
||
258 | #define YY_BUFFER_NORMAL 1 |
||
259 | /* When an EOF's been seen but there's still some text to process |
||
260 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
||
261 | * shouldn't try reading from the input source any more. We might |
||
262 | * still have a bunch of tokens to match, though, because of |
||
263 | * possible backing-up. |
||
264 | * |
||
265 | * When we actually see the EOF, we change the status to "new" |
||
266 | * (via glcpp_restart()), so that the user can continue scanning by |
||
267 | * just pointing yyin at a new input file. |
||
268 | */ |
||
269 | #define YY_BUFFER_EOF_PENDING 2 |
||
270 | |||
271 | }; |
||
272 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
||
273 | |||
274 | /* We provide macros for accessing buffer states in case in the |
||
275 | * future we want to put the buffer states in a more general |
||
276 | * "scanner state". |
||
277 | * |
||
278 | * Returns the top of the stack, or NULL. |
||
279 | */ |
||
280 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ |
||
281 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ |
||
282 | : NULL) |
||
283 | |||
284 | /* Same as previous macro, but useful when we know that the buffer stack is not |
||
285 | * NULL or when we need an lvalue. For internal use only. |
||
286 | */ |
||
287 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
||
288 | |||
289 | void glcpp_restart (FILE *input_file ,yyscan_t yyscanner ); |
||
290 | void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); |
||
291 | YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); |
||
292 | void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); |
||
293 | void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); |
||
294 | void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); |
||
295 | void glcpp_pop_buffer_state (yyscan_t yyscanner ); |
||
296 | |||
297 | static void glcpp_ensure_buffer_stack (yyscan_t yyscanner ); |
||
298 | static void glcpp__load_buffer_state (yyscan_t yyscanner ); |
||
299 | static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); |
||
300 | |||
301 | #define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) |
||
302 | |||
303 | YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); |
||
304 | YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); |
||
305 | YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); |
||
306 | |||
307 | void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner ); |
||
308 | void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); |
||
309 | void glcpp_free (void * ,yyscan_t yyscanner ); |
||
310 | |||
311 | #define yy_new_buffer glcpp__create_buffer |
||
312 | |||
313 | #define yy_set_interactive(is_interactive) \ |
||
314 | { \ |
||
315 | if ( ! YY_CURRENT_BUFFER ){ \ |
||
316 | glcpp_ensure_buffer_stack (yyscanner); \ |
||
317 | YY_CURRENT_BUFFER_LVALUE = \ |
||
318 | glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ |
||
319 | } \ |
||
320 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
||
321 | } |
||
322 | |||
323 | #define yy_set_bol(at_bol) \ |
||
324 | { \ |
||
325 | if ( ! YY_CURRENT_BUFFER ){\ |
||
326 | glcpp_ensure_buffer_stack (yyscanner); \ |
||
327 | YY_CURRENT_BUFFER_LVALUE = \ |
||
328 | glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ |
||
329 | } \ |
||
330 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
||
331 | } |
||
332 | |||
333 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
||
334 | |||
335 | /* Begin user sect3 */ |
||
336 | |||
337 | #define glcpp_wrap(n) 1 |
||
338 | #define YY_SKIP_YYWRAP |
||
339 | |||
340 | typedef unsigned char YY_CHAR; |
||
341 | |||
342 | typedef int yy_state_type; |
||
343 | |||
344 | #define yytext_ptr yytext_r |
||
345 | |||
346 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); |
||
347 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); |
||
348 | static int yy_get_next_buffer (yyscan_t yyscanner ); |
||
349 | static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); |
||
350 | |||
351 | /* Done after the current pattern has been matched and before the |
||
352 | * corresponding action - sets up yytext. |
||
353 | */ |
||
354 | #define YY_DO_BEFORE_ACTION \ |
||
355 | yyg->yytext_ptr = yy_bp; \ |
||
356 | yyleng = (size_t) (yy_cp - yy_bp); \ |
||
357 | yyg->yy_hold_char = *yy_cp; \ |
||
358 | *yy_cp = '\0'; \ |
||
359 | yyg->yy_c_buf_p = yy_cp; |
||
360 | |||
361 | #define YY_NUM_RULES 43 |
||
362 | #define YY_END_OF_BUFFER 44 |
||
363 | /* This struct is not used in this scanner, |
||
364 | but its presence is necessary. */ |
||
365 | struct yy_trans_info |
||
366 | { |
||
367 | flex_int32_t yy_verify; |
||
368 | flex_int32_t yy_nxt; |
||
369 | }; |
||
370 | static yyconst flex_int16_t yy_accept[150] = |
||
371 | { 0, |
||
372 | 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, |
||
373 | 0, 0, 44, 39, 40, 41, 43, 38, 43, 38, |
||
374 | 38, 38, 25, 24, 38, 38, 38, 37, 37, 38, |
||
375 | 40, 23, 3, 4, 5, 42, 17, 17, 17, 21, |
||
376 | 39, 40, 32, 35, 33, 2, 1, 25, 25, 0, |
||
377 | 24, 24, 27, 29, 31, 30, 28, 37, 37, 34, |
||
378 | 40, 23, 23, 0, 0, 0, 0, 0, 0, 0, |
||
379 | 3, 4, 5, 6, 5, 7, 0, 0, 0, 0, |
||
380 | 20, 21, 1, 26, 37, 0, 0, 0, 0, 0, |
||
381 | 0, 0, 0, 0, 0, 26, 37, 0, 0, 0, |
||
382 | |||
383 | 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, |
||
384 | 37, 0, 0, 15, 0, 0, 0, 0, 0, 0, |
||
385 | 0, 0, 0, 37, 0, 14, 16, 18, 0, 11, |
||
386 | 0, 10, 0, 22, 0, 36, 0, 18, 0, 12, |
||
387 | 0, 0, 19, 0, 9, 0, 0, 8, 0 |
||
388 | } ; |
||
389 | |||
390 | static yyconst flex_int32_t yy_ec[256] = |
||
391 | { 0, |
||
392 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
||
393 | 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, |
||
394 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
395 | 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, |
||
396 | 7, 10, 7, 7, 7, 7, 11, 12, 13, 13, |
||
397 | 13, 13, 13, 13, 13, 14, 14, 1, 7, 15, |
||
398 | 16, 17, 1, 1, 18, 18, 18, 18, 18, 18, |
||
399 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, |
||
400 | 19, 19, 19, 19, 20, 19, 19, 21, 19, 19, |
||
401 | 7, 1, 7, 7, 19, 1, 22, 18, 18, 23, |
||
402 | |||
403 | 24, 25, 26, 19, 27, 19, 19, 28, 29, 30, |
||
404 | 31, 32, 19, 33, 34, 35, 36, 37, 19, 38, |
||
405 | 19, 19, 7, 39, 7, 7, 1, 1, 1, 1, |
||
406 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
407 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
408 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
410 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
411 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
412 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
413 | |||
414 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
416 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
418 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
419 | 1, 1, 1, 1, 1 |
||
420 | } ; |
||
421 | |||
422 | static yyconst flex_int32_t yy_meta[40] = |
||
423 | { 0, |
||
424 | 1, 1, 2, 1, 1, 1, 1, 1, 3, 4, |
||
425 | 1, 5, 5, 5, 1, 1, 1, 5, 6, 6, |
||
426 | 6, 5, 7, 5, 5, 6, 6, 6, 6, 8, |
||
427 | 6, 6, 6, 6, 6, 6, 6, 6, 1 |
||
428 | } ; |
||
429 | |||
430 | static yyconst flex_int16_t yy_base[164] = |
||
431 | { 0, |
||
432 | 0, 38, 0, 0, 38, 39, 321, 320, 319, 44, |
||
433 | 50, 0, 321, 319, 317, 325, 325, 302, 311, 325, |
||
434 | 308, 80, 80, 83, 83, 299, 88, 0, 290, 274, |
||
435 | 100, 118, 309, 325, 104, 325, 325, 106, 107, 302, |
||
436 | 309, 307, 325, 325, 325, 325, 0, 113, 325, 0, |
||
437 | 115, 325, 325, 325, 325, 325, 325, 0, 283, 325, |
||
438 | 111, 301, 300, 281, 110, 279, 276, 269, 271, 276, |
||
439 | 296, 325, 149, 325, 153, 325, 130, 120, 151, 15, |
||
440 | 325, 289, 0, 74, 270, 271, 96, 272, 261, 258, |
||
441 | 135, 262, 269, 267, 256, 325, 258, 260, 261, 261, |
||
442 | |||
443 | 257, 252, 258, 325, 257, 257, 255, 252, 253, 242, |
||
444 | 245, 231, 0, 325, 228, 219, 216, 213, 208, 216, |
||
445 | 148, 151, 147, 150, 148, 325, 325, 0, 137, 325, |
||
446 | 145, 167, 146, 325, 136, 0, 164, 0, 135, 325, |
||
447 | 0, 131, 155, 108, 0, 135, 91, 109, 325, 178, |
||
448 | 186, 194, 202, 206, 214, 222, 228, 236, 240, 247, |
||
449 | 255, 259, 267 |
||
450 | } ; |
||
451 | |||
452 | static yyconst flex_int16_t yy_def[164] = |
||
453 | { 0, |
||
454 | 149, 1, 150, 150, 151, 151, 152, 152, 153, 153, |
||
455 | 149, 11, 149, 149, 149, 149, 149, 149, 149, 149, |
||
456 | 149, 149, 149, 149, 149, 149, 149, 154, 154, 149, |
||
457 | 149, 149, 155, 149, 156, 149, 149, 149, 149, 157, |
||
458 | 149, 149, 149, 149, 149, 149, 158, 149, 149, 159, |
||
459 | 149, 149, 149, 149, 149, 149, 149, 154, 154, 149, |
||
460 | 149, 32, 32, 149, 149, 149, 149, 149, 149, 149, |
||
461 | 155, 149, 156, 149, 156, 149, 149, 149, 149, 149, |
||
462 | 149, 157, 158, 159, 154, 149, 149, 149, 149, 149, |
||
463 | 160, 149, 149, 149, 149, 149, 154, 149, 149, 149, |
||
464 | |||
465 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
466 | 154, 149, 161, 149, 149, 149, 149, 149, 149, 149, |
||
467 | 149, 149, 149, 154, 149, 149, 149, 162, 149, 149, |
||
468 | 149, 149, 149, 149, 149, 154, 149, 162, 149, 149, |
||
469 | 163, 149, 149, 149, 163, 149, 149, 149, 0, 149, |
||
470 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
471 | 149, 149, 149 |
||
472 | } ; |
||
473 | |||
474 | static yyconst flex_int16_t yy_nxt[365] = |
||
475 | { 0, |
||
476 | 14, 15, 16, 17, 18, 19, 20, 21, 20, 20, |
||
477 | 22, 23, 24, 24, 25, 26, 27, 28, 28, 28, |
||
478 | 28, 28, 29, 28, 28, 28, 28, 28, 28, 28, |
||
479 | 28, 28, 28, 28, 28, 28, 28, 28, 30, 31, |
||
480 | 34, 34, 87, 32, 88, 38, 16, 35, 35, 39, |
||
481 | 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, |
||
482 | 17, 17, 17, 17, 17, 17, 17, 40, 40, 40, |
||
483 | 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, |
||
484 | 40, 40, 40, 40, 40, 40, 40, 40, 17, 46, |
||
485 | 47, 48, 48, 96, 51, 51, 51, 53, 54, 49, |
||
486 | |||
487 | 50, 61, 52, 56, 57, 62, 74, 77, 79, 96, |
||
488 | 148, 78, 61, 75, 76, 49, 62, 50, 52, 63, |
||
489 | 141, 79, 99, 44, 48, 48, 51, 51, 51, 100, |
||
490 | 80, 77, 49, 66, 52, 78, 148, 87, 147, 88, |
||
491 | 64, 65, 89, 80, 66, 67, 66, 90, 49, 68, |
||
492 | 52, 74, 79, 69, 70, 74, 143, 105, 149, 149, |
||
493 | 146, 144, 75, 76, 106, 143, 142, 141, 132, 140, |
||
494 | 139, 137, 136, 135, 80, 134, 133, 66, 17, 17, |
||
495 | 17, 17, 17, 17, 17, 17, 33, 33, 33, 33, |
||
496 | 33, 33, 33, 33, 36, 36, 36, 36, 36, 36, |
||
497 | |||
498 | 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, |
||
499 | 58, 58, 58, 58, 71, 71, 71, 132, 71, 71, |
||
500 | 71, 71, 73, 73, 73, 73, 73, 73, 73, 73, |
||
501 | 82, 131, 82, 82, 82, 82, 83, 130, 83, 83, |
||
502 | 83, 83, 83, 83, 84, 129, 84, 104, 104, 104, |
||
503 | 104, 128, 127, 104, 104, 126, 126, 126, 126, 138, |
||
504 | 125, 138, 138, 138, 138, 138, 138, 145, 124, 145, |
||
505 | 145, 145, 145, 145, 145, 123, 122, 121, 120, 119, |
||
506 | 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, |
||
507 | 108, 107, 103, 102, 101, 98, 97, 81, 72, 95, |
||
508 | |||
509 | 94, 93, 92, 91, 86, 149, 149, 85, 42, 41, |
||
510 | 81, 72, 60, 59, 55, 45, 44, 43, 42, 41, |
||
511 | 149, 16, 17, 17, 13, 149, 149, 149, 149, 149, |
||
512 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
513 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
514 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
515 | 149, 149, 149, 149 |
||
516 | } ; |
||
517 | |||
518 | static yyconst flex_int16_t yy_chk[365] = |
||
519 | { 0, |
||
520 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
521 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
522 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
523 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, |
||
524 | 5, 6, 80, 2, 80, 10, 10, 5, 6, 10, |
||
525 | 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
||
526 | 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
||
527 | 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
||
528 | 11, 11, 11, 11, 11, 11, 11, 11, 11, 22, |
||
529 | 22, 23, 23, 84, 24, 24, 24, 25, 25, 23, |
||
530 | |||
531 | 23, 31, 24, 27, 27, 31, 35, 38, 39, 84, |
||
532 | 148, 38, 61, 35, 35, 23, 61, 23, 24, 32, |
||
533 | 147, 78, 87, 32, 48, 48, 51, 51, 51, 87, |
||
534 | 39, 77, 48, 39, 51, 77, 146, 65, 144, 65, |
||
535 | 32, 32, 65, 78, 32, 32, 78, 65, 48, 32, |
||
536 | 51, 73, 79, 32, 32, 75, 143, 91, 73, 73, |
||
537 | 142, 139, 75, 75, 91, 137, 135, 133, 132, 131, |
||
538 | 129, 125, 124, 123, 79, 122, 121, 79, 150, 150, |
||
539 | 150, 150, 150, 150, 150, 150, 151, 151, 151, 151, |
||
540 | 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, |
||
541 | |||
542 | 152, 152, 153, 153, 153, 153, 153, 153, 153, 153, |
||
543 | 154, 154, 154, 154, 155, 155, 155, 120, 155, 155, |
||
544 | 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, |
||
545 | 157, 119, 157, 157, 157, 157, 158, 118, 158, 158, |
||
546 | 158, 158, 158, 158, 159, 117, 159, 160, 160, 160, |
||
547 | 160, 116, 115, 160, 160, 161, 161, 161, 161, 162, |
||
548 | 112, 162, 162, 162, 162, 162, 162, 163, 111, 163, |
||
549 | 163, 163, 163, 163, 163, 110, 109, 108, 107, 106, |
||
550 | 105, 103, 102, 101, 100, 99, 98, 97, 95, 94, |
||
551 | 93, 92, 90, 89, 88, 86, 85, 82, 71, 70, |
||
552 | |||
553 | 69, 68, 67, 66, 64, 63, 62, 59, 42, 41, |
||
554 | 40, 33, 30, 29, 26, 21, 19, 18, 15, 14, |
||
555 | 13, 9, 8, 7, 149, 149, 149, 149, 149, 149, |
||
556 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
557 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
558 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, |
||
559 | 149, 149, 149, 149 |
||
560 | } ; |
||
561 | |||
562 | /* The intent behind this definition is that it'll catch |
||
563 | * any uses of REJECT which flex missed. |
||
564 | */ |
||
565 | #define REJECT reject_used_but_not_detected |
||
566 | #define yymore() yymore_used_but_not_detected |
||
567 | #define YY_MORE_ADJ 0 |
||
568 | #define YY_RESTORE_YY_MORE_OFFSET |
||
569 | #line 1 "glcpp/glcpp-lex.l" |
||
570 | #line 2 "glcpp/glcpp-lex.l" |
||
571 | /* |
||
572 | * Copyright © 2010 Intel Corporation |
||
573 | * |
||
574 | * Permission is hereby granted, free of charge, to any person obtaining a |
||
575 | * copy of this software and associated documentation files (the "Software"), |
||
576 | * to deal in the Software without restriction, including without limitation |
||
577 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||
578 | * and/or sell copies of the Software, and to permit persons to whom the |
||
579 | * Software is furnished to do so, subject to the following conditions: |
||
580 | * |
||
581 | * The above copyright notice and this permission notice (including the next |
||
582 | * paragraph) shall be included in all copies or substantial portions of the |
||
583 | * Software. |
||
584 | * |
||
585 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
586 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
587 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||
588 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||
589 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||
590 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||
591 | * DEALINGS IN THE SOFTWARE. |
||
592 | */ |
||
593 | |||
594 | #include |
||
595 | #include |
||
596 | #include |
||
597 | |||
598 | #include "glcpp.h" |
||
599 | #include "glcpp-parse.h" |
||
600 | |||
601 | /* Flex annoyingly generates some functions without making them |
||
602 | * static. Let's declare them here. */ |
||
603 | int glcpp_get_column (yyscan_t yyscanner); |
||
604 | void glcpp_set_column (int column_no , yyscan_t yyscanner); |
||
605 | |||
606 | #ifdef _MSC_VER |
||
607 | #define YY_NO_UNISTD_H |
||
608 | #endif |
||
609 | |||
610 | #define YY_NO_INPUT |
||
611 | |||
612 | #define YY_USER_ACTION \ |
||
613 | do { \ |
||
614 | if (parser->has_new_line_number) \ |
||
615 | yylineno = parser->new_line_number; \ |
||
616 | if (parser->has_new_source_number) \ |
||
617 | yylloc->source = parser->new_source_number; \ |
||
618 | yylloc->first_column = yycolumn + 1; \ |
||
619 | yylloc->first_line = yylineno; \ |
||
620 | yycolumn += yyleng; \ |
||
621 | parser->has_new_line_number = 0; \ |
||
622 | parser->has_new_source_number = 0; \ |
||
623 | } while(0); |
||
624 | |||
625 | #define YY_USER_INIT \ |
||
626 | do { \ |
||
627 | yylineno = 1; \ |
||
628 | yycolumn = 1; \ |
||
629 | yylloc->source = 0; \ |
||
630 | } while(0) |
||
631 | |||
632 | /* The OTHER class is simply a catch-all for things that the CPP |
||
633 | parser just doesn't care about. Since flex regular expressions that |
||
634 | match longer strings take priority over those matching shorter |
||
635 | strings, we have to be careful to avoid OTHER matching and hiding |
||
636 | something that CPP does care about. So we simply exclude all |
||
637 | characters that appear in any other expressions. */ |
||
638 | #line 639 "glcpp/glcpp-lex.c" |
||
639 | |||
640 | #define INITIAL 0 |
||
641 | #define DONE 1 |
||
642 | #define COMMENT 2 |
||
643 | #define UNREACHABLE 3 |
||
644 | #define SKIP 4 |
||
645 | #define DEFINE 5 |
||
646 | |||
647 | #ifndef YY_NO_UNISTD_H |
||
648 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
||
649 | * down here because we want the user's section 1 to have been scanned first. |
||
650 | * The user has a chance to override it with an option. |
||
651 | */ |
||
652 | #include |
||
653 | #endif |
||
654 | |||
655 | #define YY_EXTRA_TYPE glcpp_parser_t * |
||
656 | |||
657 | /* Holds the entire state of the reentrant scanner. */ |
||
658 | struct yyguts_t |
||
659 | { |
||
660 | |||
661 | /* User-defined. Not touched by flex. */ |
||
662 | YY_EXTRA_TYPE yyextra_r; |
||
663 | |||
664 | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
||
665 | FILE *yyin_r, *yyout_r; |
||
666 | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
||
667 | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
||
668 | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ |
||
669 | char yy_hold_char; |
||
670 | int yy_n_chars; |
||
671 | int yyleng_r; |
||
672 | char *yy_c_buf_p; |
||
673 | int yy_init; |
||
674 | int yy_start; |
||
675 | int yy_did_buffer_switch_on_eof; |
||
676 | int yy_start_stack_ptr; |
||
677 | int yy_start_stack_depth; |
||
678 | int *yy_start_stack; |
||
679 | yy_state_type yy_last_accepting_state; |
||
680 | char* yy_last_accepting_cpos; |
||
681 | |||
682 | int yylineno_r; |
||
683 | int yy_flex_debug_r; |
||
684 | |||
685 | char *yytext_r; |
||
686 | int yy_more_flag; |
||
687 | int yy_more_len; |
||
688 | |||
689 | YYSTYPE * yylval_r; |
||
690 | |||
691 | YYLTYPE * yylloc_r; |
||
692 | |||
693 | }; /* end struct yyguts_t */ |
||
694 | |||
695 | static int yy_init_globals (yyscan_t yyscanner ); |
||
696 | |||
697 | /* This must go here because YYSTYPE and YYLTYPE are included |
||
698 | * from bison output in section 1.*/ |
||
699 | # define yylval yyg->yylval_r |
||
700 | |||
701 | # define yylloc yyg->yylloc_r |
||
702 | |||
703 | int glcpp_lex_init (yyscan_t* scanner); |
||
704 | |||
705 | int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); |
||
706 | |||
707 | /* Accessor methods to globals. |
||
708 | These are made visible to non-reentrant scanners for convenience. */ |
||
709 | |||
710 | int glcpp_lex_destroy (yyscan_t yyscanner ); |
||
711 | |||
712 | int glcpp_get_debug (yyscan_t yyscanner ); |
||
713 | |||
714 | void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner ); |
||
715 | |||
716 | YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner ); |
||
717 | |||
718 | void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); |
||
719 | |||
720 | FILE *glcpp_get_in (yyscan_t yyscanner ); |
||
721 | |||
722 | void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner ); |
||
723 | |||
724 | FILE *glcpp_get_out (yyscan_t yyscanner ); |
||
725 | |||
726 | void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner ); |
||
727 | |||
728 | int glcpp_get_leng (yyscan_t yyscanner ); |
||
729 | |||
730 | char *glcpp_get_text (yyscan_t yyscanner ); |
||
731 | |||
732 | int glcpp_get_lineno (yyscan_t yyscanner ); |
||
733 | |||
734 | void glcpp_set_lineno (int line_number ,yyscan_t yyscanner ); |
||
735 | |||
736 | int glcpp_get_column (yyscan_t yyscanner ); |
||
737 | |||
738 | void glcpp_set_column (int column_no ,yyscan_t yyscanner ); |
||
739 | |||
740 | YYSTYPE * glcpp_get_lval (yyscan_t yyscanner ); |
||
741 | |||
742 | void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); |
||
743 | |||
744 | YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner ); |
||
745 | |||
746 | void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); |
||
747 | |||
748 | /* Macros after this point can all be overridden by user definitions in |
||
749 | * section 1. |
||
750 | */ |
||
751 | |||
752 | #ifndef YY_SKIP_YYWRAP |
||
753 | #ifdef __cplusplus |
||
754 | extern "C" int glcpp_wrap (yyscan_t yyscanner ); |
||
755 | #else |
||
756 | extern int glcpp_wrap (yyscan_t yyscanner ); |
||
757 | #endif |
||
758 | #endif |
||
759 | |||
760 | static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); |
||
761 | |||
762 | #ifndef yytext_ptr |
||
763 | static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); |
||
764 | #endif |
||
765 | |||
766 | #ifdef YY_NEED_STRLEN |
||
767 | static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); |
||
768 | #endif |
||
769 | |||
770 | #ifndef YY_NO_INPUT |
||
771 | |||
772 | #ifdef __cplusplus |
||
773 | static int yyinput (yyscan_t yyscanner ); |
||
774 | #else |
||
775 | static int input (yyscan_t yyscanner ); |
||
776 | #endif |
||
777 | |||
778 | #endif |
||
779 | |||
780 | static void yy_push_state (int new_state ,yyscan_t yyscanner); |
||
781 | |||
782 | static void yy_pop_state (yyscan_t yyscanner ); |
||
783 | |||
784 | static int yy_top_state (yyscan_t yyscanner ); |
||
785 | |||
786 | /* Amount of stuff to slurp up with each read. */ |
||
787 | #ifndef YY_READ_BUF_SIZE |
||
788 | #ifdef __ia64__ |
||
789 | /* On IA-64, the buffer size is 16k, not 8k */ |
||
790 | #define YY_READ_BUF_SIZE 16384 |
||
791 | #else |
||
792 | #define YY_READ_BUF_SIZE 8192 |
||
793 | #endif /* __ia64__ */ |
||
794 | #endif |
||
795 | |||
796 | /* Copy whatever the last rule matched to the standard output. */ |
||
797 | #ifndef ECHO |
||
798 | /* This used to be an fputs(), but since the string might contain NUL's, |
||
799 | * we now use fwrite(). |
||
800 | */ |
||
801 | #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
||
802 | #endif |
||
803 | |||
804 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
||
805 | * is returned in "result". |
||
806 | */ |
||
807 | #ifndef YY_INPUT |
||
808 | #define YY_INPUT(buf,result,max_size) \ |
||
809 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
||
810 | { \ |
||
811 | int c = '*'; \ |
||
812 | size_t n; \ |
||
813 | for ( n = 0; n < max_size && \ |
||
814 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
||
815 | buf[n] = (char) c; \ |
||
816 | if ( c == '\n' ) \ |
||
817 | buf[n++] = (char) c; \ |
||
818 | if ( c == EOF && ferror( yyin ) ) \ |
||
819 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
||
820 | result = n; \ |
||
821 | } \ |
||
822 | else \ |
||
823 | { \ |
||
824 | errno=0; \ |
||
825 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ |
||
826 | { \ |
||
827 | if( errno != EINTR) \ |
||
828 | { \ |
||
829 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
||
830 | break; \ |
||
831 | } \ |
||
832 | errno=0; \ |
||
833 | clearerr(yyin); \ |
||
834 | } \ |
||
835 | }\ |
||
836 | \ |
||
837 | |||
838 | #endif |
||
839 | |||
840 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
||
841 | * we don't want an extra ';' after the "return" because that will cause |
||
842 | * some compilers to complain about unreachable statements. |
||
843 | */ |
||
844 | #ifndef yyterminate |
||
845 | #define yyterminate() return YY_NULL |
||
846 | #endif |
||
847 | |||
848 | /* Number of entries by which start-condition stack grows. */ |
||
849 | #ifndef YY_START_STACK_INCR |
||
850 | #define YY_START_STACK_INCR 25 |
||
851 | #endif |
||
852 | |||
853 | /* Report a fatal error. */ |
||
854 | #ifndef YY_FATAL_ERROR |
||
855 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) |
||
856 | #endif |
||
857 | |||
858 | /* end tables serialization structures and prototypes */ |
||
859 | |||
860 | /* Default declaration of generated scanner - a define so the user can |
||
861 | * easily add parameters. |
||
862 | */ |
||
863 | #ifndef YY_DECL |
||
864 | #define YY_DECL_IS_OURS 1 |
||
865 | |||
866 | extern int glcpp_lex \ |
||
867 | (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); |
||
868 | |||
869 | #define YY_DECL int glcpp_lex \ |
||
870 | (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) |
||
871 | #endif /* !YY_DECL */ |
||
872 | |||
873 | /* Code executed at the beginning of each rule, after yytext and yyleng |
||
874 | * have been set up. |
||
875 | */ |
||
876 | #ifndef YY_USER_ACTION |
||
877 | #define YY_USER_ACTION |
||
878 | #endif |
||
879 | |||
880 | /* Code executed at the end of each rule. */ |
||
881 | #ifndef YY_BREAK |
||
882 | #define YY_BREAK break; |
||
883 | #endif |
||
884 | |||
885 | #define YY_RULE_SETUP \ |
||
886 | if ( yyleng > 0 ) \ |
||
887 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ |
||
888 | (yytext[yyleng - 1] == '\n'); \ |
||
889 | YY_USER_ACTION |
||
890 | |||
891 | /** The main scanner function which does all the work. |
||
892 | */ |
||
893 | YY_DECL |
||
894 | { |
||
895 | register yy_state_type yy_current_state; |
||
896 | register char *yy_cp, *yy_bp; |
||
897 | register int yy_act; |
||
898 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
899 | |||
900 | #line 94 "glcpp/glcpp-lex.l" |
||
901 | |||
902 | /* Implicitly switch between SKIP and INITIAL (non-skipping); |
||
903 | * don't switch if some other state was explicitly set. |
||
904 | */ |
||
905 | glcpp_parser_t *parser = yyextra; |
||
906 | if (YY_START == 0 || YY_START == SKIP) { |
||
907 | if (parser->lexing_if || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) { |
||
908 | BEGIN 0; |
||
909 | } else { |
||
910 | BEGIN SKIP; |
||
911 | } |
||
912 | } |
||
913 | |||
914 | /* Single-line comments */ |
||
915 | #line 916 "glcpp/glcpp-lex.c" |
||
916 | |||
917 | yylval = yylval_param; |
||
918 | |||
919 | yylloc = yylloc_param; |
||
920 | |||
921 | if ( !yyg->yy_init ) |
||
922 | { |
||
923 | yyg->yy_init = 1; |
||
924 | |||
925 | #ifdef YY_USER_INIT |
||
926 | YY_USER_INIT; |
||
927 | #endif |
||
928 | |||
929 | if ( ! yyg->yy_start ) |
||
930 | yyg->yy_start = 1; /* first start state */ |
||
931 | |||
932 | if ( ! yyin ) |
||
933 | yyin = stdin; |
||
934 | |||
935 | if ( ! yyout ) |
||
936 | yyout = stdout; |
||
937 | |||
938 | if ( ! YY_CURRENT_BUFFER ) { |
||
939 | glcpp_ensure_buffer_stack (yyscanner); |
||
940 | YY_CURRENT_BUFFER_LVALUE = |
||
941 | glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); |
||
942 | } |
||
943 | |||
944 | glcpp__load_buffer_state(yyscanner ); |
||
945 | } |
||
946 | |||
947 | while ( 1 ) /* loops until end-of-file is reached */ |
||
948 | { |
||
949 | yy_cp = yyg->yy_c_buf_p; |
||
950 | |||
951 | /* Support of yytext. */ |
||
952 | *yy_cp = yyg->yy_hold_char; |
||
953 | |||
954 | /* yy_bp points to the position in yy_ch_buf of the start of |
||
955 | * the current run. |
||
956 | */ |
||
957 | yy_bp = yy_cp; |
||
958 | |||
959 | yy_current_state = yyg->yy_start; |
||
960 | yy_current_state += YY_AT_BOL(); |
||
961 | yy_match: |
||
962 | do |
||
963 | { |
||
964 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; |
||
965 | if ( yy_accept[yy_current_state] ) |
||
966 | { |
||
967 | yyg->yy_last_accepting_state = yy_current_state; |
||
968 | yyg->yy_last_accepting_cpos = yy_cp; |
||
969 | } |
||
970 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
||
971 | { |
||
972 | yy_current_state = (int) yy_def[yy_current_state]; |
||
973 | if ( yy_current_state >= 150 ) |
||
974 | yy_c = yy_meta[(unsigned int) yy_c]; |
||
975 | } |
||
976 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
||
977 | ++yy_cp; |
||
978 | } |
||
979 | while ( yy_current_state != 149 ); |
||
980 | yy_cp = yyg->yy_last_accepting_cpos; |
||
981 | yy_current_state = yyg->yy_last_accepting_state; |
||
982 | |||
983 | yy_find_action: |
||
984 | yy_act = yy_accept[yy_current_state]; |
||
985 | |||
986 | YY_DO_BEFORE_ACTION; |
||
987 | |||
988 | do_action: /* This label is used only to access EOF actions. */ |
||
989 | |||
990 | switch ( yy_act ) |
||
991 | { /* beginning of action switch */ |
||
992 | case 0: /* must back up */ |
||
993 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
||
994 | *yy_cp = yyg->yy_hold_char; |
||
995 | yy_cp = yyg->yy_last_accepting_cpos; |
||
996 | yy_current_state = yyg->yy_last_accepting_state; |
||
997 | goto yy_find_action; |
||
998 | |||
999 | case 1: |
||
1000 | YY_RULE_SETUP |
||
1001 | #line 108 "glcpp/glcpp-lex.l" |
||
1002 | { |
||
1003 | } |
||
1004 | YY_BREAK |
||
1005 | /* Multi-line comments */ |
||
1006 | case 2: |
||
1007 | YY_RULE_SETUP |
||
1008 | #line 112 "glcpp/glcpp-lex.l" |
||
1009 | { yy_push_state(COMMENT, yyscanner); } |
||
1010 | YY_BREAK |
||
1011 | case 3: |
||
1012 | YY_RULE_SETUP |
||
1013 | #line 113 "glcpp/glcpp-lex.l" |
||
1014 | |||
1015 | YY_BREAK |
||
1016 | case 4: |
||
1017 | /* rule 4 can match eol */ |
||
1018 | YY_RULE_SETUP |
||
1019 | #line 114 "glcpp/glcpp-lex.l" |
||
1020 | { yylineno++; yycolumn = 0; return NEWLINE; } |
||
1021 | YY_BREAK |
||
1022 | case 5: |
||
1023 | YY_RULE_SETUP |
||
1024 | #line 115 "glcpp/glcpp-lex.l" |
||
1025 | |||
1026 | YY_BREAK |
||
1027 | case 6: |
||
1028 | /* rule 6 can match eol */ |
||
1029 | YY_RULE_SETUP |
||
1030 | #line 116 "glcpp/glcpp-lex.l" |
||
1031 | { yylineno++; yycolumn = 0; return NEWLINE; } |
||
1032 | YY_BREAK |
||
1033 | case 7: |
||
1034 | YY_RULE_SETUP |
||
1035 | #line 117 "glcpp/glcpp-lex.l" |
||
1036 | { |
||
1037 | yy_pop_state(yyscanner); |
||
1038 | if (yyextra->space_tokens) |
||
1039 | return SPACE; |
||
1040 | } |
||
1041 | YY_BREAK |
||
1042 | case 8: |
||
1043 | YY_RULE_SETUP |
||
1044 | #line 123 "glcpp/glcpp-lex.l" |
||
1045 | { |
||
1046 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1047 | yyextra->space_tokens = 0; |
||
1048 | return HASH_VERSION; |
||
1049 | } |
||
1050 | YY_BREAK |
||
1051 | /* glcpp doesn't handle #extension, #version, or #pragma directives. |
||
1052 | * Simply pass them through to the main compiler's lexer/parser. */ |
||
1053 | case 9: |
||
1054 | YY_RULE_SETUP |
||
1055 | #line 131 "glcpp/glcpp-lex.l" |
||
1056 | { |
||
1057 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1058 | yylineno++; |
||
1059 | yycolumn = 0; |
||
1060 | return OTHER; |
||
1061 | } |
||
1062 | YY_BREAK |
||
1063 | case 10: |
||
1064 | YY_RULE_SETUP |
||
1065 | #line 138 "glcpp/glcpp-lex.l" |
||
1066 | { |
||
1067 | return HASH_LINE; |
||
1068 | } |
||
1069 | YY_BREAK |
||
1070 | |||
1071 | case 11: |
||
1072 | YY_RULE_SETUP |
||
1073 | #line 143 "glcpp/glcpp-lex.l" |
||
1074 | { |
||
1075 | yyextra->lexing_if = 1; |
||
1076 | yyextra->space_tokens = 0; |
||
1077 | return HASH_IFDEF; |
||
1078 | } |
||
1079 | YY_BREAK |
||
1080 | case 12: |
||
1081 | YY_RULE_SETUP |
||
1082 | #line 149 "glcpp/glcpp-lex.l" |
||
1083 | { |
||
1084 | yyextra->lexing_if = 1; |
||
1085 | yyextra->space_tokens = 0; |
||
1086 | return HASH_IFNDEF; |
||
1087 | } |
||
1088 | YY_BREAK |
||
1089 | case 13: |
||
1090 | /* rule 13 can match eol */ |
||
1091 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ |
||
1092 | yyg->yy_c_buf_p = yy_cp -= 1; |
||
1093 | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
||
1094 | YY_RULE_SETUP |
||
1095 | #line 155 "glcpp/glcpp-lex.l" |
||
1096 | { |
||
1097 | yyextra->lexing_if = 1; |
||
1098 | yyextra->space_tokens = 0; |
||
1099 | return HASH_IF; |
||
1100 | } |
||
1101 | YY_BREAK |
||
1102 | case 14: |
||
1103 | /* rule 14 can match eol */ |
||
1104 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ |
||
1105 | yyg->yy_c_buf_p = yy_cp -= 1; |
||
1106 | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
||
1107 | YY_RULE_SETUP |
||
1108 | #line 161 "glcpp/glcpp-lex.l" |
||
1109 | { |
||
1110 | yyextra->lexing_if = 1; |
||
1111 | yyextra->space_tokens = 0; |
||
1112 | return HASH_ELIF; |
||
1113 | } |
||
1114 | YY_BREAK |
||
1115 | case 15: |
||
1116 | YY_RULE_SETUP |
||
1117 | #line 167 "glcpp/glcpp-lex.l" |
||
1118 | { |
||
1119 | yyextra->space_tokens = 0; |
||
1120 | return HASH_ELSE; |
||
1121 | } |
||
1122 | YY_BREAK |
||
1123 | case 16: |
||
1124 | YY_RULE_SETUP |
||
1125 | #line 172 "glcpp/glcpp-lex.l" |
||
1126 | { |
||
1127 | yyextra->space_tokens = 0; |
||
1128 | return HASH_ENDIF; |
||
1129 | } |
||
1130 | YY_BREAK |
||
1131 | |||
1132 | case 17: |
||
1133 | YY_RULE_SETUP |
||
1134 | #line 178 "glcpp/glcpp-lex.l" |
||
1135 | ; |
||
1136 | YY_BREAK |
||
1137 | case 18: |
||
1138 | YY_RULE_SETUP |
||
1139 | #line 180 "glcpp/glcpp-lex.l" |
||
1140 | { |
||
1141 | char *p; |
||
1142 | for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ |
||
1143 | p += 5; /* skip "error" */ |
||
1144 | glcpp_error(yylloc, yyextra, "#error%s", p); |
||
1145 | } |
||
1146 | YY_BREAK |
||
1147 | case 19: |
||
1148 | YY_RULE_SETUP |
||
1149 | #line 187 "glcpp/glcpp-lex.l" |
||
1150 | { |
||
1151 | yyextra->space_tokens = 0; |
||
1152 | yy_push_state(DEFINE, yyscanner); |
||
1153 | return HASH_DEFINE; |
||
1154 | } |
||
1155 | YY_BREAK |
||
1156 | case 20: |
||
1157 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ |
||
1158 | yyg->yy_c_buf_p = yy_cp -= 1; |
||
1159 | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
||
1160 | YY_RULE_SETUP |
||
1161 | #line 193 "glcpp/glcpp-lex.l" |
||
1162 | { |
||
1163 | yy_pop_state(yyscanner); |
||
1164 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1165 | return FUNC_IDENTIFIER; |
||
1166 | } |
||
1167 | YY_BREAK |
||
1168 | case 21: |
||
1169 | YY_RULE_SETUP |
||
1170 | #line 199 "glcpp/glcpp-lex.l" |
||
1171 | { |
||
1172 | yy_pop_state(yyscanner); |
||
1173 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1174 | return OBJ_IDENTIFIER; |
||
1175 | } |
||
1176 | YY_BREAK |
||
1177 | case 22: |
||
1178 | YY_RULE_SETUP |
||
1179 | #line 205 "glcpp/glcpp-lex.l" |
||
1180 | { |
||
1181 | yyextra->space_tokens = 0; |
||
1182 | return HASH_UNDEF; |
||
1183 | } |
||
1184 | YY_BREAK |
||
1185 | case 23: |
||
1186 | YY_RULE_SETUP |
||
1187 | #line 210 "glcpp/glcpp-lex.l" |
||
1188 | { |
||
1189 | yyextra->space_tokens = 0; |
||
1190 | return HASH; |
||
1191 | } |
||
1192 | YY_BREAK |
||
1193 | case 24: |
||
1194 | YY_RULE_SETUP |
||
1195 | #line 215 "glcpp/glcpp-lex.l" |
||
1196 | { |
||
1197 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1198 | return INTEGER_STRING; |
||
1199 | } |
||
1200 | YY_BREAK |
||
1201 | case 25: |
||
1202 | YY_RULE_SETUP |
||
1203 | #line 220 "glcpp/glcpp-lex.l" |
||
1204 | { |
||
1205 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1206 | return INTEGER_STRING; |
||
1207 | } |
||
1208 | YY_BREAK |
||
1209 | case 26: |
||
1210 | YY_RULE_SETUP |
||
1211 | #line 225 "glcpp/glcpp-lex.l" |
||
1212 | { |
||
1213 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1214 | return INTEGER_STRING; |
||
1215 | } |
||
1216 | YY_BREAK |
||
1217 | case 27: |
||
1218 | YY_RULE_SETUP |
||
1219 | #line 230 "glcpp/glcpp-lex.l" |
||
1220 | { |
||
1221 | return LEFT_SHIFT; |
||
1222 | } |
||
1223 | YY_BREAK |
||
1224 | case 28: |
||
1225 | YY_RULE_SETUP |
||
1226 | #line 234 "glcpp/glcpp-lex.l" |
||
1227 | { |
||
1228 | return RIGHT_SHIFT; |
||
1229 | } |
||
1230 | YY_BREAK |
||
1231 | case 29: |
||
1232 | YY_RULE_SETUP |
||
1233 | #line 238 "glcpp/glcpp-lex.l" |
||
1234 | { |
||
1235 | return LESS_OR_EQUAL; |
||
1236 | } |
||
1237 | YY_BREAK |
||
1238 | case 30: |
||
1239 | YY_RULE_SETUP |
||
1240 | #line 242 "glcpp/glcpp-lex.l" |
||
1241 | { |
||
1242 | return GREATER_OR_EQUAL; |
||
1243 | } |
||
1244 | YY_BREAK |
||
1245 | case 31: |
||
1246 | YY_RULE_SETUP |
||
1247 | #line 246 "glcpp/glcpp-lex.l" |
||
1248 | { |
||
1249 | return EQUAL; |
||
1250 | } |
||
1251 | YY_BREAK |
||
1252 | case 32: |
||
1253 | YY_RULE_SETUP |
||
1254 | #line 250 "glcpp/glcpp-lex.l" |
||
1255 | { |
||
1256 | return NOT_EQUAL; |
||
1257 | } |
||
1258 | YY_BREAK |
||
1259 | case 33: |
||
1260 | YY_RULE_SETUP |
||
1261 | #line 254 "glcpp/glcpp-lex.l" |
||
1262 | { |
||
1263 | return AND; |
||
1264 | } |
||
1265 | YY_BREAK |
||
1266 | case 34: |
||
1267 | YY_RULE_SETUP |
||
1268 | #line 258 "glcpp/glcpp-lex.l" |
||
1269 | { |
||
1270 | return OR; |
||
1271 | } |
||
1272 | YY_BREAK |
||
1273 | case 35: |
||
1274 | YY_RULE_SETUP |
||
1275 | #line 262 "glcpp/glcpp-lex.l" |
||
1276 | { |
||
1277 | if (parser->is_gles) |
||
1278 | glcpp_error(yylloc, yyextra, "Token pasting (##) is illegal in GLES"); |
||
1279 | return PASTE; |
||
1280 | } |
||
1281 | YY_BREAK |
||
1282 | case 36: |
||
1283 | YY_RULE_SETUP |
||
1284 | #line 268 "glcpp/glcpp-lex.l" |
||
1285 | { |
||
1286 | return DEFINED; |
||
1287 | } |
||
1288 | YY_BREAK |
||
1289 | case 37: |
||
1290 | YY_RULE_SETUP |
||
1291 | #line 272 "glcpp/glcpp-lex.l" |
||
1292 | { |
||
1293 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1294 | return IDENTIFIER; |
||
1295 | } |
||
1296 | YY_BREAK |
||
1297 | case 38: |
||
1298 | YY_RULE_SETUP |
||
1299 | #line 277 "glcpp/glcpp-lex.l" |
||
1300 | { |
||
1301 | return yytext[0]; |
||
1302 | } |
||
1303 | YY_BREAK |
||
1304 | case 39: |
||
1305 | YY_RULE_SETUP |
||
1306 | #line 281 "glcpp/glcpp-lex.l" |
||
1307 | { |
||
1308 | yylval->str = ralloc_strdup (yyextra, yytext); |
||
1309 | return OTHER; |
||
1310 | } |
||
1311 | YY_BREAK |
||
1312 | case 40: |
||
1313 | YY_RULE_SETUP |
||
1314 | #line 286 "glcpp/glcpp-lex.l" |
||
1315 | { |
||
1316 | if (yyextra->space_tokens) { |
||
1317 | return SPACE; |
||
1318 | } |
||
1319 | } |
||
1320 | YY_BREAK |
||
1321 | case 41: |
||
1322 | /* rule 41 can match eol */ |
||
1323 | YY_RULE_SETUP |
||
1324 | #line 292 "glcpp/glcpp-lex.l" |
||
1325 | { |
||
1326 | yyextra->lexing_if = 0; |
||
1327 | yylineno++; |
||
1328 | yycolumn = 0; |
||
1329 | return NEWLINE; |
||
1330 | } |
||
1331 | YY_BREAK |
||
1332 | /* Handle missing newline at EOF. */ |
||
1333 | case YY_STATE_EOF(INITIAL): |
||
1334 | #line 300 "glcpp/glcpp-lex.l" |
||
1335 | { |
||
1336 | BEGIN DONE; /* Don't keep matching this rule forever. */ |
||
1337 | yyextra->lexing_if = 0; |
||
1338 | return NEWLINE; |
||
1339 | } |
||
1340 | YY_BREAK |
||
1341 | /* We don't actually use the UNREACHABLE start condition. We |
||
1342 | only have this action here so that we can pretend to call some |
||
1343 | generated functions, (to avoid "defined but not used" |
||
1344 | warnings. */ |
||
1345 | case 42: |
||
1346 | YY_RULE_SETUP |
||
1347 | #line 310 "glcpp/glcpp-lex.l" |
||
1348 | { |
||
1349 | unput('.'); |
||
1350 | yy_top_state(yyextra); |
||
1351 | } |
||
1352 | YY_BREAK |
||
1353 | case 43: |
||
1354 | YY_RULE_SETUP |
||
1355 | #line 315 "glcpp/glcpp-lex.l" |
||
1356 | ECHO; |
||
1357 | YY_BREAK |
||
1358 | #line 1359 "glcpp/glcpp-lex.c" |
||
1359 | case YY_STATE_EOF(DONE): |
||
1360 | case YY_STATE_EOF(COMMENT): |
||
1361 | case YY_STATE_EOF(UNREACHABLE): |
||
1362 | case YY_STATE_EOF(SKIP): |
||
1363 | case YY_STATE_EOF(DEFINE): |
||
1364 | yyterminate(); |
||
1365 | |||
1366 | case YY_END_OF_BUFFER: |
||
1367 | { |
||
1368 | /* Amount of text matched not including the EOB char. */ |
||
1369 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; |
||
1370 | |||
1371 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
||
1372 | *yy_cp = yyg->yy_hold_char; |
||
1373 | YY_RESTORE_YY_MORE_OFFSET |
||
1374 | |||
1375 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
||
1376 | { |
||
1377 | /* We're scanning a new file or input source. It's |
||
1378 | * possible that this happened because the user |
||
1379 | * just pointed yyin at a new source and called |
||
1380 | * glcpp_lex(). If so, then we have to assure |
||
1381 | * consistency between YY_CURRENT_BUFFER and our |
||
1382 | * globals. Here is the right place to do so, because |
||
1383 | * this is the first action (other than possibly a |
||
1384 | * back-up) that will match for the new input source. |
||
1385 | */ |
||
1386 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
||
1387 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
||
1388 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
||
1389 | } |
||
1390 | |||
1391 | /* Note that here we test for yy_c_buf_p "<=" to the position |
||
1392 | * of the first EOB in the buffer, since yy_c_buf_p will |
||
1393 | * already have been incremented past the NUL character |
||
1394 | * (since all states make transitions on EOB to the |
||
1395 | * end-of-buffer state). Contrast this with the test |
||
1396 | * in input(). |
||
1397 | */ |
||
1398 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
||
1399 | { /* This was really a NUL. */ |
||
1400 | yy_state_type yy_next_state; |
||
1401 | |||
1402 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
||
1403 | |||
1404 | yy_current_state = yy_get_previous_state( yyscanner ); |
||
1405 | |||
1406 | /* Okay, we're now positioned to make the NUL |
||
1407 | * transition. We couldn't have |
||
1408 | * yy_get_previous_state() go ahead and do it |
||
1409 | * for us because it doesn't know how to deal |
||
1410 | * with the possibility of jamming (and we don't |
||
1411 | * want to build jamming into it because then it |
||
1412 | * will run more slowly). |
||
1413 | */ |
||
1414 | |||
1415 | yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); |
||
1416 | |||
1417 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1418 | |||
1419 | if ( yy_next_state ) |
||
1420 | { |
||
1421 | /* Consume the NUL. */ |
||
1422 | yy_cp = ++yyg->yy_c_buf_p; |
||
1423 | yy_current_state = yy_next_state; |
||
1424 | goto yy_match; |
||
1425 | } |
||
1426 | |||
1427 | else |
||
1428 | { |
||
1429 | yy_cp = yyg->yy_last_accepting_cpos; |
||
1430 | yy_current_state = yyg->yy_last_accepting_state; |
||
1431 | goto yy_find_action; |
||
1432 | } |
||
1433 | } |
||
1434 | |||
1435 | else switch ( yy_get_next_buffer( yyscanner ) ) |
||
1436 | { |
||
1437 | case EOB_ACT_END_OF_FILE: |
||
1438 | { |
||
1439 | yyg->yy_did_buffer_switch_on_eof = 0; |
||
1440 | |||
1441 | if ( glcpp_wrap(yyscanner ) ) |
||
1442 | { |
||
1443 | /* Note: because we've taken care in |
||
1444 | * yy_get_next_buffer() to have set up |
||
1445 | * yytext, we can now set up |
||
1446 | * yy_c_buf_p so that if some total |
||
1447 | * hoser (like flex itself) wants to |
||
1448 | * call the scanner after we return the |
||
1449 | * YY_NULL, it'll still work - another |
||
1450 | * YY_NULL will get returned. |
||
1451 | */ |
||
1452 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1453 | |||
1454 | yy_act = YY_STATE_EOF(YY_START); |
||
1455 | goto do_action; |
||
1456 | } |
||
1457 | |||
1458 | else |
||
1459 | { |
||
1460 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
||
1461 | YY_NEW_FILE; |
||
1462 | } |
||
1463 | break; |
||
1464 | } |
||
1465 | |||
1466 | case EOB_ACT_CONTINUE_SCAN: |
||
1467 | yyg->yy_c_buf_p = |
||
1468 | yyg->yytext_ptr + yy_amount_of_matched_text; |
||
1469 | |||
1470 | yy_current_state = yy_get_previous_state( yyscanner ); |
||
1471 | |||
1472 | yy_cp = yyg->yy_c_buf_p; |
||
1473 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1474 | goto yy_match; |
||
1475 | |||
1476 | case EOB_ACT_LAST_MATCH: |
||
1477 | yyg->yy_c_buf_p = |
||
1478 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
||
1479 | |||
1480 | yy_current_state = yy_get_previous_state( yyscanner ); |
||
1481 | |||
1482 | yy_cp = yyg->yy_c_buf_p; |
||
1483 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1484 | goto yy_find_action; |
||
1485 | } |
||
1486 | break; |
||
1487 | } |
||
1488 | |||
1489 | default: |
||
1490 | YY_FATAL_ERROR( |
||
1491 | "fatal flex scanner internal error--no action found" ); |
||
1492 | } /* end of action switch */ |
||
1493 | } /* end of scanning one token */ |
||
1494 | } /* end of glcpp_lex */ |
||
1495 | |||
1496 | /* yy_get_next_buffer - try to read in a new buffer |
||
1497 | * |
||
1498 | * Returns a code representing an action: |
||
1499 | * EOB_ACT_LAST_MATCH - |
||
1500 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
||
1501 | * EOB_ACT_END_OF_FILE - end of file |
||
1502 | */ |
||
1503 | static int yy_get_next_buffer (yyscan_t yyscanner) |
||
1504 | { |
||
1505 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1506 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
||
1507 | register char *source = yyg->yytext_ptr; |
||
1508 | register int number_to_move, i; |
||
1509 | int ret_val; |
||
1510 | |||
1511 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
||
1512 | YY_FATAL_ERROR( |
||
1513 | "fatal flex scanner internal error--end of buffer missed" ); |
||
1514 | |||
1515 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
||
1516 | { /* Don't try to fill the buffer, so this is an EOF. */ |
||
1517 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
||
1518 | { |
||
1519 | /* We matched a single character, the EOB, so |
||
1520 | * treat this as a final EOF. |
||
1521 | */ |
||
1522 | return EOB_ACT_END_OF_FILE; |
||
1523 | } |
||
1524 | |||
1525 | else |
||
1526 | { |
||
1527 | /* We matched some text prior to the EOB, first |
||
1528 | * process it. |
||
1529 | */ |
||
1530 | return EOB_ACT_LAST_MATCH; |
||
1531 | } |
||
1532 | } |
||
1533 | |||
1534 | /* Try to read more data. */ |
||
1535 | |||
1536 | /* First move last chars to start of buffer. */ |
||
1537 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; |
||
1538 | |||
1539 | for ( i = 0; i < number_to_move; ++i ) |
||
1540 | *(dest++) = *(source++); |
||
1541 | |||
1542 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
||
1543 | /* don't do the read, it's not guaranteed to return an EOF, |
||
1544 | * just force an EOF |
||
1545 | */ |
||
1546 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
||
1547 | |||
1548 | else |
||
1549 | { |
||
1550 | int num_to_read = |
||
1551 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
||
1552 | |||
1553 | while ( num_to_read <= 0 ) |
||
1554 | { /* Not enough room in the buffer - grow it. */ |
||
1555 | |||
1556 | /* just a shorter name for the current buffer */ |
||
1557 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; |
||
1558 | |||
1559 | int yy_c_buf_p_offset = |
||
1560 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
||
1561 | |||
1562 | if ( b->yy_is_our_buffer ) |
||
1563 | { |
||
1564 | int new_size = b->yy_buf_size * 2; |
||
1565 | |||
1566 | if ( new_size <= 0 ) |
||
1567 | b->yy_buf_size += b->yy_buf_size / 8; |
||
1568 | else |
||
1569 | b->yy_buf_size *= 2; |
||
1570 | |||
1571 | b->yy_ch_buf = (char *) |
||
1572 | /* Include room in for 2 EOB chars. */ |
||
1573 | glcpp_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); |
||
1574 | } |
||
1575 | else |
||
1576 | /* Can't grow it, we don't own it. */ |
||
1577 | b->yy_ch_buf = 0; |
||
1578 | |||
1579 | if ( ! b->yy_ch_buf ) |
||
1580 | YY_FATAL_ERROR( |
||
1581 | "fatal error - scanner input buffer overflow" ); |
||
1582 | |||
1583 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
||
1584 | |||
1585 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
||
1586 | number_to_move - 1; |
||
1587 | |||
1588 | } |
||
1589 | |||
1590 | if ( num_to_read > YY_READ_BUF_SIZE ) |
||
1591 | num_to_read = YY_READ_BUF_SIZE; |
||
1592 | |||
1593 | /* Read in more data. */ |
||
1594 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
||
1595 | yyg->yy_n_chars, (size_t) num_to_read ); |
||
1596 | |||
1597 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
||
1598 | } |
||
1599 | |||
1600 | if ( yyg->yy_n_chars == 0 ) |
||
1601 | { |
||
1602 | if ( number_to_move == YY_MORE_ADJ ) |
||
1603 | { |
||
1604 | ret_val = EOB_ACT_END_OF_FILE; |
||
1605 | glcpp_restart(yyin ,yyscanner); |
||
1606 | } |
||
1607 | |||
1608 | else |
||
1609 | { |
||
1610 | ret_val = EOB_ACT_LAST_MATCH; |
||
1611 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
||
1612 | YY_BUFFER_EOF_PENDING; |
||
1613 | } |
||
1614 | } |
||
1615 | |||
1616 | else |
||
1617 | ret_val = EOB_ACT_CONTINUE_SCAN; |
||
1618 | |||
1619 | if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
||
1620 | /* Extend the array by 50%, plus the number we really need. */ |
||
1621 | yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
||
1622 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); |
||
1623 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
||
1624 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
||
1625 | } |
||
1626 | |||
1627 | yyg->yy_n_chars += number_to_move; |
||
1628 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
||
1629 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
||
1630 | |||
1631 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
||
1632 | |||
1633 | return ret_val; |
||
1634 | } |
||
1635 | |||
1636 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
||
1637 | |||
1638 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) |
||
1639 | { |
||
1640 | register yy_state_type yy_current_state; |
||
1641 | register char *yy_cp; |
||
1642 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1643 | |||
1644 | yy_current_state = yyg->yy_start; |
||
1645 | yy_current_state += YY_AT_BOL(); |
||
1646 | |||
1647 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) |
||
1648 | { |
||
1649 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
||
1650 | if ( yy_accept[yy_current_state] ) |
||
1651 | { |
||
1652 | yyg->yy_last_accepting_state = yy_current_state; |
||
1653 | yyg->yy_last_accepting_cpos = yy_cp; |
||
1654 | } |
||
1655 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
||
1656 | { |
||
1657 | yy_current_state = (int) yy_def[yy_current_state]; |
||
1658 | if ( yy_current_state >= 150 ) |
||
1659 | yy_c = yy_meta[(unsigned int) yy_c]; |
||
1660 | } |
||
1661 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
||
1662 | } |
||
1663 | |||
1664 | return yy_current_state; |
||
1665 | } |
||
1666 | |||
1667 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
||
1668 | * |
||
1669 | * synopsis |
||
1670 | * next_state = yy_try_NUL_trans( current_state ); |
||
1671 | */ |
||
1672 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) |
||
1673 | { |
||
1674 | register int yy_is_jam; |
||
1675 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ |
||
1676 | register char *yy_cp = yyg->yy_c_buf_p; |
||
1677 | |||
1678 | register YY_CHAR yy_c = 1; |
||
1679 | if ( yy_accept[yy_current_state] ) |
||
1680 | { |
||
1681 | yyg->yy_last_accepting_state = yy_current_state; |
||
1682 | yyg->yy_last_accepting_cpos = yy_cp; |
||
1683 | } |
||
1684 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
||
1685 | { |
||
1686 | yy_current_state = (int) yy_def[yy_current_state]; |
||
1687 | if ( yy_current_state >= 150 ) |
||
1688 | yy_c = yy_meta[(unsigned int) yy_c]; |
||
1689 | } |
||
1690 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
||
1691 | yy_is_jam = (yy_current_state == 149); |
||
1692 | |||
1693 | return yy_is_jam ? 0 : yy_current_state; |
||
1694 | } |
||
1695 | |||
1696 | static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) |
||
1697 | { |
||
1698 | register char *yy_cp; |
||
1699 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1700 | |||
1701 | yy_cp = yyg->yy_c_buf_p; |
||
1702 | |||
1703 | /* undo effects of setting up yytext */ |
||
1704 | *yy_cp = yyg->yy_hold_char; |
||
1705 | |||
1706 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) |
||
1707 | { /* need to shift things up to make room */ |
||
1708 | /* +2 for EOB chars. */ |
||
1709 | register int number_to_move = yyg->yy_n_chars + 2; |
||
1710 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ |
||
1711 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; |
||
1712 | register char *source = |
||
1713 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; |
||
1714 | |||
1715 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
||
1716 | *--dest = *--source; |
||
1717 | |||
1718 | yy_cp += (int) (dest - source); |
||
1719 | yy_bp += (int) (dest - source); |
||
1720 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = |
||
1721 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; |
||
1722 | |||
1723 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) |
||
1724 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); |
||
1725 | } |
||
1726 | |||
1727 | *--yy_cp = (char) c; |
||
1728 | |||
1729 | yyg->yytext_ptr = yy_bp; |
||
1730 | yyg->yy_hold_char = *yy_cp; |
||
1731 | yyg->yy_c_buf_p = yy_cp; |
||
1732 | } |
||
1733 | |||
1734 | #ifndef YY_NO_INPUT |
||
1735 | #ifdef __cplusplus |
||
1736 | static int yyinput (yyscan_t yyscanner) |
||
1737 | #else |
||
1738 | static int input (yyscan_t yyscanner) |
||
1739 | #endif |
||
1740 | |||
1741 | { |
||
1742 | int c; |
||
1743 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1744 | |||
1745 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
||
1746 | |||
1747 | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
||
1748 | { |
||
1749 | /* yy_c_buf_p now points to the character we want to return. |
||
1750 | * If this occurs *before* the EOB characters, then it's a |
||
1751 | * valid NUL; if not, then we've hit the end of the buffer. |
||
1752 | */ |
||
1753 | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
||
1754 | /* This was really a NUL. */ |
||
1755 | *yyg->yy_c_buf_p = '\0'; |
||
1756 | |||
1757 | else |
||
1758 | { /* need more input */ |
||
1759 | int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; |
||
1760 | ++yyg->yy_c_buf_p; |
||
1761 | |||
1762 | switch ( yy_get_next_buffer( yyscanner ) ) |
||
1763 | { |
||
1764 | case EOB_ACT_LAST_MATCH: |
||
1765 | /* This happens because yy_g_n_b() |
||
1766 | * sees that we've accumulated a |
||
1767 | * token and flags that we need to |
||
1768 | * try matching the token before |
||
1769 | * proceeding. But for input(), |
||
1770 | * there's no matching to consider. |
||
1771 | * So convert the EOB_ACT_LAST_MATCH |
||
1772 | * to EOB_ACT_END_OF_FILE. |
||
1773 | */ |
||
1774 | |||
1775 | /* Reset buffer status. */ |
||
1776 | glcpp_restart(yyin ,yyscanner); |
||
1777 | |||
1778 | /*FALLTHROUGH*/ |
||
1779 | |||
1780 | case EOB_ACT_END_OF_FILE: |
||
1781 | { |
||
1782 | if ( glcpp_wrap(yyscanner ) ) |
||
1783 | return EOF; |
||
1784 | |||
1785 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
||
1786 | YY_NEW_FILE; |
||
1787 | #ifdef __cplusplus |
||
1788 | return yyinput(yyscanner); |
||
1789 | #else |
||
1790 | return input(yyscanner); |
||
1791 | #endif |
||
1792 | } |
||
1793 | |||
1794 | case EOB_ACT_CONTINUE_SCAN: |
||
1795 | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
||
1796 | break; |
||
1797 | } |
||
1798 | } |
||
1799 | } |
||
1800 | |||
1801 | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
||
1802 | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
||
1803 | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
||
1804 | |||
1805 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); |
||
1806 | |||
1807 | return c; |
||
1808 | } |
||
1809 | #endif /* ifndef YY_NO_INPUT */ |
||
1810 | |||
1811 | /** Immediately switch to a different input stream. |
||
1812 | * @param input_file A readable stream. |
||
1813 | * @param yyscanner The scanner object. |
||
1814 | * @note This function does not reset the start condition to @c INITIAL . |
||
1815 | */ |
||
1816 | void glcpp_restart (FILE * input_file , yyscan_t yyscanner) |
||
1817 | { |
||
1818 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1819 | |||
1820 | if ( ! YY_CURRENT_BUFFER ){ |
||
1821 | glcpp_ensure_buffer_stack (yyscanner); |
||
1822 | YY_CURRENT_BUFFER_LVALUE = |
||
1823 | glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); |
||
1824 | } |
||
1825 | |||
1826 | glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); |
||
1827 | glcpp__load_buffer_state(yyscanner ); |
||
1828 | } |
||
1829 | |||
1830 | /** Switch to a different input buffer. |
||
1831 | * @param new_buffer The new input buffer. |
||
1832 | * @param yyscanner The scanner object. |
||
1833 | */ |
||
1834 | void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
||
1835 | { |
||
1836 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1837 | |||
1838 | /* TODO. We should be able to replace this entire function body |
||
1839 | * with |
||
1840 | * glcpp_pop_buffer_state(); |
||
1841 | * glcpp_push_buffer_state(new_buffer); |
||
1842 | */ |
||
1843 | glcpp_ensure_buffer_stack (yyscanner); |
||
1844 | if ( YY_CURRENT_BUFFER == new_buffer ) |
||
1845 | return; |
||
1846 | |||
1847 | if ( YY_CURRENT_BUFFER ) |
||
1848 | { |
||
1849 | /* Flush out information for old buffer. */ |
||
1850 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
||
1851 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
||
1852 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
||
1853 | } |
||
1854 | |||
1855 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
||
1856 | glcpp__load_buffer_state(yyscanner ); |
||
1857 | |||
1858 | /* We don't actually know whether we did this switch during |
||
1859 | * EOF (glcpp_wrap()) processing, but the only time this flag |
||
1860 | * is looked at is after glcpp_wrap() is called, so it's safe |
||
1861 | * to go ahead and always set it. |
||
1862 | */ |
||
1863 | yyg->yy_did_buffer_switch_on_eof = 1; |
||
1864 | } |
||
1865 | |||
1866 | static void glcpp__load_buffer_state (yyscan_t yyscanner) |
||
1867 | { |
||
1868 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1869 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
||
1870 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
||
1871 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
||
1872 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
||
1873 | } |
||
1874 | |||
1875 | /** Allocate and initialize an input buffer state. |
||
1876 | * @param file A readable stream. |
||
1877 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
||
1878 | * @param yyscanner The scanner object. |
||
1879 | * @return the allocated buffer state. |
||
1880 | */ |
||
1881 | YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner) |
||
1882 | { |
||
1883 | YY_BUFFER_STATE b; |
||
1884 | |||
1885 | b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); |
||
1886 | if ( ! b ) |
||
1887 | YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); |
||
1888 | |||
1889 | b->yy_buf_size = size; |
||
1890 | |||
1891 | /* yy_ch_buf has to be 2 characters longer than the size given because |
||
1892 | * we need to put in 2 end-of-buffer characters. |
||
1893 | */ |
||
1894 | b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner ); |
||
1895 | if ( ! b->yy_ch_buf ) |
||
1896 | YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); |
||
1897 | |||
1898 | b->yy_is_our_buffer = 1; |
||
1899 | |||
1900 | glcpp__init_buffer(b,file ,yyscanner); |
||
1901 | |||
1902 | return b; |
||
1903 | } |
||
1904 | |||
1905 | /** Destroy the buffer. |
||
1906 | * @param b a buffer created with glcpp__create_buffer() |
||
1907 | * @param yyscanner The scanner object. |
||
1908 | */ |
||
1909 | void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
||
1910 | { |
||
1911 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1912 | |||
1913 | if ( ! b ) |
||
1914 | return; |
||
1915 | |||
1916 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
||
1917 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
||
1918 | |||
1919 | if ( b->yy_is_our_buffer ) |
||
1920 | glcpp_free((void *) b->yy_ch_buf ,yyscanner ); |
||
1921 | |||
1922 | glcpp_free((void *) b ,yyscanner ); |
||
1923 | } |
||
1924 | |||
1925 | /* Initializes or reinitializes a buffer. |
||
1926 | * This function is sometimes called more than once on the same buffer, |
||
1927 | * such as during a glcpp_restart() or at EOF. |
||
1928 | */ |
||
1929 | static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) |
||
1930 | |||
1931 | { |
||
1932 | int oerrno = errno; |
||
1933 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1934 | |||
1935 | glcpp__flush_buffer(b ,yyscanner); |
||
1936 | |||
1937 | b->yy_input_file = file; |
||
1938 | b->yy_fill_buffer = 1; |
||
1939 | |||
1940 | /* If b is the current buffer, then glcpp__init_buffer was _probably_ |
||
1941 | * called from glcpp_restart() or through yy_get_next_buffer. |
||
1942 | * In that case, we don't want to reset the lineno or column. |
||
1943 | */ |
||
1944 | if (b != YY_CURRENT_BUFFER){ |
||
1945 | b->yy_bs_lineno = 1; |
||
1946 | b->yy_bs_column = 0; |
||
1947 | } |
||
1948 | |||
1949 | b->yy_is_interactive = 0; |
||
1950 | |||
1951 | errno = oerrno; |
||
1952 | } |
||
1953 | |||
1954 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
||
1955 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
||
1956 | * @param yyscanner The scanner object. |
||
1957 | */ |
||
1958 | void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
||
1959 | { |
||
1960 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1961 | if ( ! b ) |
||
1962 | return; |
||
1963 | |||
1964 | b->yy_n_chars = 0; |
||
1965 | |||
1966 | /* We always need two end-of-buffer characters. The first causes |
||
1967 | * a transition to the end-of-buffer state. The second causes |
||
1968 | * a jam in that state. |
||
1969 | */ |
||
1970 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
||
1971 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
||
1972 | |||
1973 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
||
1974 | |||
1975 | b->yy_at_bol = 1; |
||
1976 | b->yy_buffer_status = YY_BUFFER_NEW; |
||
1977 | |||
1978 | if ( b == YY_CURRENT_BUFFER ) |
||
1979 | glcpp__load_buffer_state(yyscanner ); |
||
1980 | } |
||
1981 | |||
1982 | /** Pushes the new state onto the stack. The new state becomes |
||
1983 | * the current state. This function will allocate the stack |
||
1984 | * if necessary. |
||
1985 | * @param new_buffer The new state. |
||
1986 | * @param yyscanner The scanner object. |
||
1987 | */ |
||
1988 | void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
||
1989 | { |
||
1990 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1991 | if (new_buffer == NULL) |
||
1992 | return; |
||
1993 | |||
1994 | glcpp_ensure_buffer_stack(yyscanner); |
||
1995 | |||
1996 | /* This block is copied from glcpp__switch_to_buffer. */ |
||
1997 | if ( YY_CURRENT_BUFFER ) |
||
1998 | { |
||
1999 | /* Flush out information for old buffer. */ |
||
2000 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
||
2001 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
||
2002 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
||
2003 | } |
||
2004 | |||
2005 | /* Only push if top exists. Otherwise, replace top. */ |
||
2006 | if (YY_CURRENT_BUFFER) |
||
2007 | yyg->yy_buffer_stack_top++; |
||
2008 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
||
2009 | |||
2010 | /* copied from glcpp__switch_to_buffer. */ |
||
2011 | glcpp__load_buffer_state(yyscanner ); |
||
2012 | yyg->yy_did_buffer_switch_on_eof = 1; |
||
2013 | } |
||
2014 | |||
2015 | /** Removes and deletes the top of the stack, if present. |
||
2016 | * The next element becomes the new top. |
||
2017 | * @param yyscanner The scanner object. |
||
2018 | */ |
||
2019 | void glcpp_pop_buffer_state (yyscan_t yyscanner) |
||
2020 | { |
||
2021 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2022 | if (!YY_CURRENT_BUFFER) |
||
2023 | return; |
||
2024 | |||
2025 | glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); |
||
2026 | YY_CURRENT_BUFFER_LVALUE = NULL; |
||
2027 | if (yyg->yy_buffer_stack_top > 0) |
||
2028 | --yyg->yy_buffer_stack_top; |
||
2029 | |||
2030 | if (YY_CURRENT_BUFFER) { |
||
2031 | glcpp__load_buffer_state(yyscanner ); |
||
2032 | yyg->yy_did_buffer_switch_on_eof = 1; |
||
2033 | } |
||
2034 | } |
||
2035 | |||
2036 | /* Allocates the stack if it does not exist. |
||
2037 | * Guarantees space for at least one push. |
||
2038 | */ |
||
2039 | static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) |
||
2040 | { |
||
2041 | int num_to_alloc; |
||
2042 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2043 | |||
2044 | if (!yyg->yy_buffer_stack) { |
||
2045 | |||
2046 | /* First allocation is just for 2 elements, since we don't know if this |
||
2047 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
||
2048 | * immediate realloc on the next call. |
||
2049 | */ |
||
2050 | num_to_alloc = 1; |
||
2051 | yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc |
||
2052 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
||
2053 | , yyscanner); |
||
2054 | if ( ! yyg->yy_buffer_stack ) |
||
2055 | YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); |
||
2056 | |||
2057 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
||
2058 | |||
2059 | yyg->yy_buffer_stack_max = num_to_alloc; |
||
2060 | yyg->yy_buffer_stack_top = 0; |
||
2061 | return; |
||
2062 | } |
||
2063 | |||
2064 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ |
||
2065 | |||
2066 | /* Increase the buffer to prepare for a possible push. */ |
||
2067 | int grow_size = 8 /* arbitrary grow size */; |
||
2068 | |||
2069 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
||
2070 | yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc |
||
2071 | (yyg->yy_buffer_stack, |
||
2072 | num_to_alloc * sizeof(struct yy_buffer_state*) |
||
2073 | , yyscanner); |
||
2074 | if ( ! yyg->yy_buffer_stack ) |
||
2075 | YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); |
||
2076 | |||
2077 | /* zero only the new slots.*/ |
||
2078 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); |
||
2079 | yyg->yy_buffer_stack_max = num_to_alloc; |
||
2080 | } |
||
2081 | } |
||
2082 | |||
2083 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
||
2084 | * @param base the character buffer |
||
2085 | * @param size the size in bytes of the character buffer |
||
2086 | * @param yyscanner The scanner object. |
||
2087 | * @return the newly allocated buffer state object. |
||
2088 | */ |
||
2089 | YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
||
2090 | { |
||
2091 | YY_BUFFER_STATE b; |
||
2092 | |||
2093 | if ( size < 2 || |
||
2094 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
||
2095 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
||
2096 | /* They forgot to leave room for the EOB's. */ |
||
2097 | return 0; |
||
2098 | |||
2099 | b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); |
||
2100 | if ( ! b ) |
||
2101 | YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" ); |
||
2102 | |||
2103 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
||
2104 | b->yy_buf_pos = b->yy_ch_buf = base; |
||
2105 | b->yy_is_our_buffer = 0; |
||
2106 | b->yy_input_file = 0; |
||
2107 | b->yy_n_chars = b->yy_buf_size; |
||
2108 | b->yy_is_interactive = 0; |
||
2109 | b->yy_at_bol = 1; |
||
2110 | b->yy_fill_buffer = 0; |
||
2111 | b->yy_buffer_status = YY_BUFFER_NEW; |
||
2112 | |||
2113 | glcpp__switch_to_buffer(b ,yyscanner ); |
||
2114 | |||
2115 | return b; |
||
2116 | } |
||
2117 | |||
2118 | /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will |
||
2119 | * scan from a @e copy of @a str. |
||
2120 | * @param yystr a NUL-terminated string to scan |
||
2121 | * @param yyscanner The scanner object. |
||
2122 | * @return the newly allocated buffer state object. |
||
2123 | * @note If you want to scan bytes that may contain NUL values, then use |
||
2124 | * glcpp__scan_bytes() instead. |
||
2125 | */ |
||
2126 | YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) |
||
2127 | { |
||
2128 | |||
2129 | return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner); |
||
2130 | } |
||
2131 | |||
2132 | /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will |
||
2133 | * scan from a @e copy of @a bytes. |
||
2134 | * @param yybytes the byte buffer to scan |
||
2135 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
||
2136 | * @param yyscanner The scanner object. |
||
2137 | * @return the newly allocated buffer state object. |
||
2138 | */ |
||
2139 | YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) |
||
2140 | { |
||
2141 | YY_BUFFER_STATE b; |
||
2142 | char *buf; |
||
2143 | yy_size_t n; |
||
2144 | int i; |
||
2145 | |||
2146 | /* Get memory for full buffer, including space for trailing EOB's. */ |
||
2147 | n = _yybytes_len + 2; |
||
2148 | buf = (char *) glcpp_alloc(n ,yyscanner ); |
||
2149 | if ( ! buf ) |
||
2150 | YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" ); |
||
2151 | |||
2152 | for ( i = 0; i < _yybytes_len; ++i ) |
||
2153 | buf[i] = yybytes[i]; |
||
2154 | |||
2155 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
||
2156 | |||
2157 | b = glcpp__scan_buffer(buf,n ,yyscanner); |
||
2158 | if ( ! b ) |
||
2159 | YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" ); |
||
2160 | |||
2161 | /* It's okay to grow etc. this buffer, and we should throw it |
||
2162 | * away when we're done. |
||
2163 | */ |
||
2164 | b->yy_is_our_buffer = 1; |
||
2165 | |||
2166 | return b; |
||
2167 | } |
||
2168 | |||
2169 | static void yy_push_state (int new_state , yyscan_t yyscanner) |
||
2170 | { |
||
2171 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2172 | if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) |
||
2173 | { |
||
2174 | yy_size_t new_size; |
||
2175 | |||
2176 | yyg->yy_start_stack_depth += YY_START_STACK_INCR; |
||
2177 | new_size = yyg->yy_start_stack_depth * sizeof( int ); |
||
2178 | |||
2179 | if ( ! yyg->yy_start_stack ) |
||
2180 | yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner ); |
||
2181 | |||
2182 | else |
||
2183 | yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); |
||
2184 | |||
2185 | if ( ! yyg->yy_start_stack ) |
||
2186 | YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); |
||
2187 | } |
||
2188 | |||
2189 | yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; |
||
2190 | |||
2191 | BEGIN(new_state); |
||
2192 | } |
||
2193 | |||
2194 | static void yy_pop_state (yyscan_t yyscanner) |
||
2195 | { |
||
2196 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2197 | if ( --yyg->yy_start_stack_ptr < 0 ) |
||
2198 | YY_FATAL_ERROR( "start-condition stack underflow" ); |
||
2199 | |||
2200 | BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); |
||
2201 | } |
||
2202 | |||
2203 | static int yy_top_state (yyscan_t yyscanner) |
||
2204 | { |
||
2205 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2206 | return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; |
||
2207 | } |
||
2208 | |||
2209 | #ifndef YY_EXIT_FAILURE |
||
2210 | #define YY_EXIT_FAILURE 2 |
||
2211 | #endif |
||
2212 | |||
2213 | static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) |
||
2214 | { |
||
2215 | (void) fprintf( stderr, "%s\n", msg ); |
||
2216 | exit( YY_EXIT_FAILURE ); |
||
2217 | } |
||
2218 | |||
2219 | /* Redefine yyless() so it works in section 3 code. */ |
||
2220 | |||
2221 | #undef yyless |
||
2222 | #define yyless(n) \ |
||
2223 | do \ |
||
2224 | { \ |
||
2225 | /* Undo effects of setting up yytext. */ \ |
||
2226 | int yyless_macro_arg = (n); \ |
||
2227 | YY_LESS_LINENO(yyless_macro_arg);\ |
||
2228 | yytext[yyleng] = yyg->yy_hold_char; \ |
||
2229 | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
||
2230 | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
||
2231 | *yyg->yy_c_buf_p = '\0'; \ |
||
2232 | yyleng = yyless_macro_arg; \ |
||
2233 | } \ |
||
2234 | while ( 0 ) |
||
2235 | |||
2236 | /* Accessor methods (get/set functions) to struct members. */ |
||
2237 | |||
2238 | /** Get the user-defined data for this scanner. |
||
2239 | * @param yyscanner The scanner object. |
||
2240 | */ |
||
2241 | YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner) |
||
2242 | { |
||
2243 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2244 | return yyextra; |
||
2245 | } |
||
2246 | |||
2247 | /** Get the current line number. |
||
2248 | * @param yyscanner The scanner object. |
||
2249 | */ |
||
2250 | int glcpp_get_lineno (yyscan_t yyscanner) |
||
2251 | { |
||
2252 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2253 | |||
2254 | if (! YY_CURRENT_BUFFER) |
||
2255 | return 0; |
||
2256 | |||
2257 | return yylineno; |
||
2258 | } |
||
2259 | |||
2260 | /** Get the current column number. |
||
2261 | * @param yyscanner The scanner object. |
||
2262 | */ |
||
2263 | int glcpp_get_column (yyscan_t yyscanner) |
||
2264 | { |
||
2265 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2266 | |||
2267 | if (! YY_CURRENT_BUFFER) |
||
2268 | return 0; |
||
2269 | |||
2270 | return yycolumn; |
||
2271 | } |
||
2272 | |||
2273 | /** Get the input stream. |
||
2274 | * @param yyscanner The scanner object. |
||
2275 | */ |
||
2276 | FILE *glcpp_get_in (yyscan_t yyscanner) |
||
2277 | { |
||
2278 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2279 | return yyin; |
||
2280 | } |
||
2281 | |||
2282 | /** Get the output stream. |
||
2283 | * @param yyscanner The scanner object. |
||
2284 | */ |
||
2285 | FILE *glcpp_get_out (yyscan_t yyscanner) |
||
2286 | { |
||
2287 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2288 | return yyout; |
||
2289 | } |
||
2290 | |||
2291 | /** Get the length of the current token. |
||
2292 | * @param yyscanner The scanner object. |
||
2293 | */ |
||
2294 | int glcpp_get_leng (yyscan_t yyscanner) |
||
2295 | { |
||
2296 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2297 | return yyleng; |
||
2298 | } |
||
2299 | |||
2300 | /** Get the current token. |
||
2301 | * @param yyscanner The scanner object. |
||
2302 | */ |
||
2303 | |||
2304 | char *glcpp_get_text (yyscan_t yyscanner) |
||
2305 | { |
||
2306 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2307 | return yytext; |
||
2308 | } |
||
2309 | |||
2310 | /** Set the user-defined data. This data is never touched by the scanner. |
||
2311 | * @param user_defined The data to be associated with this scanner. |
||
2312 | * @param yyscanner The scanner object. |
||
2313 | */ |
||
2314 | void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) |
||
2315 | { |
||
2316 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2317 | yyextra = user_defined ; |
||
2318 | } |
||
2319 | |||
2320 | /** Set the current line number. |
||
2321 | * @param line_number |
||
2322 | * @param yyscanner The scanner object. |
||
2323 | */ |
||
2324 | void glcpp_set_lineno (int line_number , yyscan_t yyscanner) |
||
2325 | { |
||
2326 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2327 | |||
2328 | /* lineno is only valid if an input buffer exists. */ |
||
2329 | if (! YY_CURRENT_BUFFER ) |
||
2330 | yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner); |
||
2331 | |||
2332 | yylineno = line_number; |
||
2333 | } |
||
2334 | |||
2335 | /** Set the current column. |
||
2336 | * @param line_number |
||
2337 | * @param yyscanner The scanner object. |
||
2338 | */ |
||
2339 | void glcpp_set_column (int column_no , yyscan_t yyscanner) |
||
2340 | { |
||
2341 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2342 | |||
2343 | /* column is only valid if an input buffer exists. */ |
||
2344 | if (! YY_CURRENT_BUFFER ) |
||
2345 | yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner); |
||
2346 | |||
2347 | yycolumn = column_no; |
||
2348 | } |
||
2349 | |||
2350 | /** Set the input stream. This does not discard the current |
||
2351 | * input buffer. |
||
2352 | * @param in_str A readable stream. |
||
2353 | * @param yyscanner The scanner object. |
||
2354 | * @see glcpp__switch_to_buffer |
||
2355 | */ |
||
2356 | void glcpp_set_in (FILE * in_str , yyscan_t yyscanner) |
||
2357 | { |
||
2358 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2359 | yyin = in_str ; |
||
2360 | } |
||
2361 | |||
2362 | void glcpp_set_out (FILE * out_str , yyscan_t yyscanner) |
||
2363 | { |
||
2364 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2365 | yyout = out_str ; |
||
2366 | } |
||
2367 | |||
2368 | int glcpp_get_debug (yyscan_t yyscanner) |
||
2369 | { |
||
2370 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2371 | return yy_flex_debug; |
||
2372 | } |
||
2373 | |||
2374 | void glcpp_set_debug (int bdebug , yyscan_t yyscanner) |
||
2375 | { |
||
2376 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2377 | yy_flex_debug = bdebug ; |
||
2378 | } |
||
2379 | |||
2380 | /* Accessor methods for yylval and yylloc */ |
||
2381 | |||
2382 | YYSTYPE * glcpp_get_lval (yyscan_t yyscanner) |
||
2383 | { |
||
2384 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2385 | return yylval; |
||
2386 | } |
||
2387 | |||
2388 | void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) |
||
2389 | { |
||
2390 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2391 | yylval = yylval_param; |
||
2392 | } |
||
2393 | |||
2394 | YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner) |
||
2395 | { |
||
2396 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2397 | return yylloc; |
||
2398 | } |
||
2399 | |||
2400 | void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) |
||
2401 | { |
||
2402 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2403 | yylloc = yylloc_param; |
||
2404 | } |
||
2405 | |||
2406 | /* User-visible API */ |
||
2407 | |||
2408 | /* glcpp_lex_init is special because it creates the scanner itself, so it is |
||
2409 | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
||
2410 | * That's why we explicitly handle the declaration, instead of using our macros. |
||
2411 | */ |
||
2412 | |||
2413 | int glcpp_lex_init(yyscan_t* ptr_yy_globals) |
||
2414 | |||
2415 | { |
||
2416 | if (ptr_yy_globals == NULL){ |
||
2417 | errno = EINVAL; |
||
2418 | return 1; |
||
2419 | } |
||
2420 | |||
2421 | *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL ); |
||
2422 | |||
2423 | if (*ptr_yy_globals == NULL){ |
||
2424 | errno = ENOMEM; |
||
2425 | return 1; |
||
2426 | } |
||
2427 | |||
2428 | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
||
2429 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
||
2430 | |||
2431 | return yy_init_globals ( *ptr_yy_globals ); |
||
2432 | } |
||
2433 | |||
2434 | /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the |
||
2435 | * convention of taking the scanner as the last argument. Note however, that |
||
2436 | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
||
2437 | * is the reason, too, why this function also must handle its own declaration). |
||
2438 | * The user defined value in the first argument will be available to glcpp_alloc in |
||
2439 | * the yyextra field. |
||
2440 | */ |
||
2441 | |||
2442 | int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) |
||
2443 | |||
2444 | { |
||
2445 | struct yyguts_t dummy_yyguts; |
||
2446 | |||
2447 | glcpp_set_extra (yy_user_defined, &dummy_yyguts); |
||
2448 | |||
2449 | if (ptr_yy_globals == NULL){ |
||
2450 | errno = EINVAL; |
||
2451 | return 1; |
||
2452 | } |
||
2453 | |||
2454 | *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); |
||
2455 | |||
2456 | if (*ptr_yy_globals == NULL){ |
||
2457 | errno = ENOMEM; |
||
2458 | return 1; |
||
2459 | } |
||
2460 | |||
2461 | /* By setting to 0xAA, we expose bugs in |
||
2462 | yy_init_globals. Leave at 0x00 for releases. */ |
||
2463 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
||
2464 | |||
2465 | glcpp_set_extra (yy_user_defined, *ptr_yy_globals); |
||
2466 | |||
2467 | return yy_init_globals ( *ptr_yy_globals ); |
||
2468 | } |
||
2469 | |||
2470 | static int yy_init_globals (yyscan_t yyscanner) |
||
2471 | { |
||
2472 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2473 | /* Initialization is the same as for the non-reentrant scanner. |
||
2474 | * This function is called from glcpp_lex_destroy(), so don't allocate here. |
||
2475 | */ |
||
2476 | |||
2477 | yyg->yy_buffer_stack = 0; |
||
2478 | yyg->yy_buffer_stack_top = 0; |
||
2479 | yyg->yy_buffer_stack_max = 0; |
||
2480 | yyg->yy_c_buf_p = (char *) 0; |
||
2481 | yyg->yy_init = 0; |
||
2482 | yyg->yy_start = 0; |
||
2483 | |||
2484 | yyg->yy_start_stack_ptr = 0; |
||
2485 | yyg->yy_start_stack_depth = 0; |
||
2486 | yyg->yy_start_stack = NULL; |
||
2487 | |||
2488 | /* Defined in main.c */ |
||
2489 | #ifdef YY_STDINIT |
||
2490 | yyin = stdin; |
||
2491 | yyout = stdout; |
||
2492 | #else |
||
2493 | yyin = (FILE *) 0; |
||
2494 | yyout = (FILE *) 0; |
||
2495 | #endif |
||
2496 | |||
2497 | /* For future reference: Set errno on error, since we are called by |
||
2498 | * glcpp_lex_init() |
||
2499 | */ |
||
2500 | return 0; |
||
2501 | } |
||
2502 | |||
2503 | /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */ |
||
2504 | int glcpp_lex_destroy (yyscan_t yyscanner) |
||
2505 | { |
||
2506 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2507 | |||
2508 | /* Pop the buffer stack, destroying each element. */ |
||
2509 | while(YY_CURRENT_BUFFER){ |
||
2510 | glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); |
||
2511 | YY_CURRENT_BUFFER_LVALUE = NULL; |
||
2512 | glcpp_pop_buffer_state(yyscanner); |
||
2513 | } |
||
2514 | |||
2515 | /* Destroy the stack itself. */ |
||
2516 | glcpp_free(yyg->yy_buffer_stack ,yyscanner); |
||
2517 | yyg->yy_buffer_stack = NULL; |
||
2518 | |||
2519 | /* Destroy the start condition stack. */ |
||
2520 | glcpp_free(yyg->yy_start_stack ,yyscanner ); |
||
2521 | yyg->yy_start_stack = NULL; |
||
2522 | |||
2523 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
||
2524 | * glcpp_lex() is called, initialization will occur. */ |
||
2525 | yy_init_globals( yyscanner); |
||
2526 | |||
2527 | /* Destroy the main struct (reentrant only). */ |
||
2528 | glcpp_free ( yyscanner , yyscanner ); |
||
2529 | yyscanner = NULL; |
||
2530 | return 0; |
||
2531 | } |
||
2532 | |||
2533 | /* |
||
2534 | * Internal utility routines. |
||
2535 | */ |
||
2536 | |||
2537 | #ifndef yytext_ptr |
||
2538 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) |
||
2539 | { |
||
2540 | register int i; |
||
2541 | for ( i = 0; i < n; ++i ) |
||
2542 | s1[i] = s2[i]; |
||
2543 | } |
||
2544 | #endif |
||
2545 | |||
2546 | #ifdef YY_NEED_STRLEN |
||
2547 | static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) |
||
2548 | { |
||
2549 | register int n; |
||
2550 | for ( n = 0; s[n]; ++n ) |
||
2551 | ; |
||
2552 | |||
2553 | return n; |
||
2554 | } |
||
2555 | #endif |
||
2556 | |||
2557 | void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner) |
||
2558 | { |
||
2559 | return (void *) malloc( size ); |
||
2560 | } |
||
2561 | |||
2562 | void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) |
||
2563 | { |
||
2564 | /* The cast to (char *) in the following accommodates both |
||
2565 | * implementations that use char* generic pointers, and those |
||
2566 | * that use void* generic pointers. It works with the latter |
||
2567 | * because both ANSI C and C++ allow castless assignment from |
||
2568 | * any pointer type to void*, and deal with argument conversions |
||
2569 | * as though doing an assignment. |
||
2570 | */ |
||
2571 | return (void *) realloc( (char *) ptr, size ); |
||
2572 | } |
||
2573 | |||
2574 | void glcpp_free (void * ptr , yyscan_t yyscanner) |
||
2575 | { |
||
2576 | free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */ |
||
2577 | } |
||
2578 | |||
2579 | #define YYTABLES_NAME "yytables" |
||
2580 | |||
2581 | #line 315 "glcpp/glcpp-lex.l" |
||
2582 | |||
2583 | |||
2584 | |||
2585 | void |
||
2586 | glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) |
||
2587 | { |
||
2588 | glcpp__scan_string(shader,parser->scanner); |
||
2589 | }>>>>>>>>=>=>>=>=">>>>>>> |
||
2590 |