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