1
2 #line 3 "ncgenl.c"
3
4 #define YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define yy_create_buffer ncg_create_buffer
9 #define yy_delete_buffer ncg_delete_buffer
10 #define yy_flex_debug ncg_flex_debug
11 #define yy_init_buffer ncg_init_buffer
12 #define yy_flush_buffer ncg_flush_buffer
13 #define yy_load_buffer_state ncg_load_buffer_state
14 #define yy_switch_to_buffer ncg_switch_to_buffer
15 #define yyin ncgin
16 #define yyleng ncgleng
17 #define yylex ncglex
18 #define yylineno ncglineno
19 #define yyout ncgout
20 #define yyrestart ncgrestart
21 #define yytext ncgtext
22 #define yywrap ncgwrap
23 #define yyalloc ncgalloc
24 #define yyrealloc ncgrealloc
25 #define yyfree ncgfree
26
27 #define FLEX_SCANNER
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 6
30 #define YY_FLEX_SUBMINOR_VERSION 0
31 #if YY_FLEX_SUBMINOR_VERSION > 0
32 #define FLEX_BETA
33 #endif
34
35 /* First, we deal with platform-specific or compiler-specific issues. */
36
37 /* begin standard C headers. */
38 #include <stdio.h>
39 #include <string.h>
40 #include <errno.h>
41 #include <stdlib.h>
42
43 /* end standard C headers. */
44
45 /* flex integer type definitions */
46
47 #ifndef FLEXINT_H
48 #define FLEXINT_H
49
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
51
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
56 */
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
59 #endif
60
61 #include <inttypes.h>
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
68 #else
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
75
76 /* Limits of integral types. */
77 #ifndef INT8_MIN
78 #define INT8_MIN (-128)
79 #endif
80 #ifndef INT16_MIN
81 #define INT16_MIN (-32767-1)
82 #endif
83 #ifndef INT32_MIN
84 #define INT32_MIN (-2147483647-1)
85 #endif
86 #ifndef INT8_MAX
87 #define INT8_MAX (127)
88 #endif
89 #ifndef INT16_MAX
90 #define INT16_MAX (32767)
91 #endif
92 #ifndef INT32_MAX
93 #define INT32_MAX (2147483647)
94 #endif
95 #ifndef UINT8_MAX
96 #define UINT8_MAX (255U)
97 #endif
98 #ifndef UINT16_MAX
99 #define UINT16_MAX (65535U)
100 #endif
101 #ifndef UINT32_MAX
102 #define UINT32_MAX (4294967295U)
103 #endif
104
105 #endif /* ! C99 */
106
107 #endif /* ! FLEXINT_H */
108
109 #ifdef __cplusplus
110
111 /* The "const" storage-class-modifier is valid. */
112 #define YY_USE_CONST
113
114 #else /* ! __cplusplus */
115
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
118
119 #define YY_USE_CONST
120
121 #endif /* defined (__STDC__) */
122 #endif /* ! __cplusplus */
123
124 #ifdef YY_USE_CONST
125 #define yyconst const
126 #else
127 #define yyconst
128 #endif
129
130 /* Returned upon end-of-file. */
131 #define YY_NULL 0
132
133 /* Promotes a possibly negative, possibly signed char to an unsigned
134 * integer for use as an array index. If the signed char is negative,
135 * we want to instead treat it as an 8-bit unsigned char, hence the
136 * double cast.
137 */
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139
140 /* Enter a start condition. This macro really ought to take a parameter,
141 * but we do it the disgusting crufty way forced on us by the ()-less
142 * definition of BEGIN.
143 */
144 #define BEGIN (yy_start) = 1 + 2 *
145
146 /* Translate the current start state into a value that can be later handed
147 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 * compatibility.
149 */
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
152
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE ncgrestart(ncgin )
158
159 #define YY_END_OF_BUFFER_CHAR 0
160
161 /* Size of default input buffer. */
162 #ifndef YY_BUF_SIZE
163 #ifdef __ia64__
164 /* On IA-64, the buffer size is 16k, not 8k.
165 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
166 * Ditto for the __ia64__ case accordingly.
167 */
168 #define YY_BUF_SIZE 32768
169 #else
170 #define YY_BUF_SIZE 16384
171 #endif /* __ia64__ */
172 #endif
173
174 /* The state buf must be large enough to hold one state per character in the main buffer.
175 */
176 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177
178 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
179 #define YY_TYPEDEF_YY_BUFFER_STATE
180 typedef struct yy_buffer_state *YY_BUFFER_STATE;
181 #endif
182
183 #ifndef YY_TYPEDEF_YY_SIZE_T
184 #define YY_TYPEDEF_YY_SIZE_T
185 typedef size_t yy_size_t;
186 #endif
187
188 extern yy_size_t ncgleng;
189
190 extern FILE *ncgin, *ncgout;
191
192 #define EOB_ACT_CONTINUE_SCAN 0
193 #define EOB_ACT_END_OF_FILE 1
194 #define EOB_ACT_LAST_MATCH 2
195
196 #define YY_LESS_LINENO(n)
197 #define YY_LINENO_REWIND_TO(ptr)
198
199 /* Return all but the first "n" matched characters back to the input stream. */
200 #define yyless(n) \
201 do \
202 { \
203 /* Undo effects of setting up ncgtext. */ \
204 int yyless_macro_arg = (n); \
205 YY_LESS_LINENO(yyless_macro_arg);\
206 *yy_cp = (yy_hold_char); \
207 YY_RESTORE_YY_MORE_OFFSET \
208 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
209 YY_DO_BEFORE_ACTION; /* set up ncgtext again */ \
210 } \
211 while ( 0 )
212
213 #define unput(c) yyunput( c, (yytext_ptr) )
214
215 #ifndef YY_STRUCT_YY_BUFFER_STATE
216 #define YY_STRUCT_YY_BUFFER_STATE
217 struct yy_buffer_state
218 {
219 FILE *yy_input_file;
220
221 char *yy_ch_buf; /* input buffer */
222 char *yy_buf_pos; /* current position in input buffer */
223
224 /* Size of input buffer in bytes, not including room for EOB
225 * characters.
226 */
227 yy_size_t yy_buf_size;
228
229 /* Number of characters read into yy_ch_buf, not including EOB
230 * characters.
231 */
232 int yy_n_chars;
233
234 /* Whether we "own" the buffer - i.e., we know we created it,
235 * and can realloc() it to grow it, and should free() it to
236 * delete it.
237 */
238 int yy_is_our_buffer;
239
240 /* Whether this is an "interactive" input source; if so, and
241 * if we're using stdio for input, then we want to use getc()
242 * instead of fread(), to make sure we stop fetching input after
243 * each newline.
244 */
245 int yy_is_interactive;
246
247 /* Whether we're considered to be at the beginning of a line.
248 * If so, '^' rules will be active on the next match, otherwise
249 * not.
250 */
251 int yy_at_bol;
252
253 int yy_bs_lineno; /**< The line count. */
254 int yy_bs_column; /**< The column count. */
255
256 /* Whether to try to fill the input buffer when we reach the
257 * end of it.
258 */
259 int yy_fill_buffer;
260
261 int yy_buffer_status;
262
263 #define YY_BUFFER_NEW 0
264 #define YY_BUFFER_NORMAL 1
265 /* When an EOF's been seen but there's still some text to process
266 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
267 * shouldn't try reading from the input source any more. We might
268 * still have a bunch of tokens to match, though, because of
269 * possible backing-up.
270 *
271 * When we actually see the EOF, we change the status to "new"
272 * (via ncgrestart()), so that the user can continue scanning by
273 * just pointing ncgin at a new input file.
274 */
275 #define YY_BUFFER_EOF_PENDING 2
276
277 };
278 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
279
280 /* Stack of input buffers. */
281 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
282 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
283 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
284
285 /* We provide macros for accessing buffer states in case in the
286 * future we want to put the buffer states in a more general
287 * "scanner state".
288 *
289 * Returns the top of the stack, or NULL.
290 */
291 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
292 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
293 : NULL)
294
295 /* Same as previous macro, but useful when we know that the buffer stack is not
296 * NULL or when we need an lvalue. For internal use only.
297 */
298 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
299
300 /* yy_hold_char holds the character lost when ncgtext is formed. */
301 static char yy_hold_char;
302 static int yy_n_chars; /* number of characters read into yy_ch_buf */
303 yy_size_t ncgleng;
304
305 /* Points to current character in buffer. */
306 static char *yy_c_buf_p = (char *) 0;
307 static int yy_init = 0; /* whether we need to initialize */
308 static int yy_start = 0; /* start state number */
309
310 /* Flag which is used to allow ncgwrap()'s to do buffer switches
311 * instead of setting up a fresh ncgin. A bit of a hack ...
312 */
313 static int yy_did_buffer_switch_on_eof;
314
315 void ncgrestart (FILE *input_file );
316 void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer );
317 YY_BUFFER_STATE ncg_create_buffer (FILE *file,int size );
318 void ncg_delete_buffer (YY_BUFFER_STATE b );
319 void ncg_flush_buffer (YY_BUFFER_STATE b );
320 void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer );
321 void ncgpop_buffer_state (void );
322
323 static void ncgensure_buffer_stack (void );
324 static void ncg_load_buffer_state (void );
325 static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file );
326
327 #define YY_FLUSH_BUFFER ncg_flush_buffer(YY_CURRENT_BUFFER )
328
329 YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size );
330 YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str );
331 YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len );
332
333 void *ncgalloc (yy_size_t );
334 void *ncgrealloc (void *,yy_size_t );
335 void ncgfree (void * );
336
337 #define yy_new_buffer ncg_create_buffer
338
339 #define yy_set_interactive(is_interactive) \
340 { \
341 if ( ! YY_CURRENT_BUFFER ){ \
342 ncgensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 ncg_create_buffer(ncgin,YY_BUF_SIZE ); \
345 } \
346 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
347 }
348
349 #define yy_set_bol(at_bol) \
350 { \
351 if ( ! YY_CURRENT_BUFFER ){\
352 ncgensure_buffer_stack (); \
353 YY_CURRENT_BUFFER_LVALUE = \
354 ncg_create_buffer(ncgin,YY_BUF_SIZE ); \
355 } \
356 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
357 }
358
359 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
360
361 /* Begin user sect3 */
362
363 typedef unsigned char YY_CHAR;
364
365 FILE *ncgin = (FILE *) 0, *ncgout = (FILE *) 0;
366
367 typedef int yy_state_type;
368
369 extern int ncglineno;
370
371 int ncglineno = 1;
372
373 extern char *ncgtext;
374 #ifdef yytext_ptr
375 #undef yytext_ptr
376 #endif
377 #define yytext_ptr ncgtext
378
379 static yy_state_type yy_get_previous_state (void );
380 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
381 static int yy_get_next_buffer (void );
382 #if defined(__GNUC__) && __GNUC__ >= 3
383 __attribute__((__noreturn__))
384 #endif
385 static void yy_fatal_error (yyconst char msg[] );
386
387 /* Done after the current pattern has been matched and before the
388 * corresponding action - sets up ncgtext.
389 */
390 #define YY_DO_BEFORE_ACTION \
391 (yytext_ptr) = yy_bp; \
392 ncgleng = (size_t) (yy_cp - yy_bp); \
393 (yy_hold_char) = *yy_cp; \
394 *yy_cp = '\0'; \
395 (yy_c_buf_p) = yy_cp;
396
397 #define YY_NUM_RULES 49
398 #define YY_END_OF_BUFFER 50
399 /* This struct is not used in this scanner,
400 but its presence is necessary. */
401 struct yy_trans_info
402 {
403 flex_int32_t yy_verify;
404 flex_int32_t yy_nxt;
405 };
406 static yyconst flex_int16_t yy_accept[422] =
407 { 0,
408 0, 0, 46, 46, 0, 0, 50, 48, 1, 44,
409 48, 48, 48, 48, 38, 32, 36, 36, 35, 35,
410 35, 35, 35, 35, 35, 48, 35, 35, 35, 35,
411 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
412 35, 35, 48, 48, 48, 46, 49, 34, 49, 1,
413 0, 3, 0, 0, 0, 38, 36, 0, 0, 38,
414 38, 0, 39, 45, 2, 32, 0, 0, 0, 0,
415 36, 36, 36, 36, 0, 35, 0, 0, 0, 0,
416 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
417 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
418
419 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
420 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
421 35, 35, 35, 0, 0, 46, 0, 47, 34, 40,
422 0, 0, 0, 0, 38, 0, 0, 38, 2, 32,
423 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
424 35, 35, 35, 35, 35, 35, 31, 28, 35, 35,
425 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
426 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
427 14, 35, 28, 35, 35, 35, 35, 35, 35, 35,
428 35, 35, 35, 35, 35, 0, 43, 0, 0, 38,
429
430 0, 32, 0, 0, 0, 0, 0, 0, 0, 4,
431 37, 37, 0, 35, 35, 29, 35, 35, 30, 35,
432 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
433 35, 35, 10, 9, 35, 35, 35, 35, 6, 35,
434 35, 35, 35, 14, 35, 35, 35, 8, 35, 35,
435 35, 35, 35, 15, 35, 35, 35, 35, 0, 0,
436 29, 0, 32, 0, 0, 0, 0, 0, 0, 0,
437 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
438 35, 35, 35, 35, 35, 35, 35, 35, 35, 24,
439 35, 35, 35, 16, 35, 35, 35, 35, 12, 35,
440
441 35, 35, 11, 35, 35, 15, 35, 35, 35, 41,
442 42, 0, 0, 0, 0, 35, 35, 35, 26, 35,
443 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
444 35, 35, 35, 35, 35, 18, 25, 35, 7, 19,
445 5, 21, 17, 35, 35, 13, 35, 0, 0, 35,
446 35, 35, 35, 35, 35, 35, 35, 33, 35, 35,
447 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
448 0, 35, 27, 35, 35, 35, 35, 35, 35, 35,
449 35, 35, 5, 35, 35, 35, 35, 27, 27, 20,
450 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
451
452 35, 35, 35, 35, 35, 35, 35, 23, 35, 35,
453 35, 22, 35, 35, 35, 35, 35, 35, 35, 35,
454 0
455 } ;
456
457 static yyconst YY_CHAR yy_ec[256] =
458 { 0,
459 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
460 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
461 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
462 1, 4, 5, 6, 5, 5, 5, 5, 7, 5,
463 5, 8, 9, 5, 10, 11, 12, 13, 14, 15,
464 16, 17, 14, 18, 14, 19, 19, 20, 5, 5,
465 5, 5, 5, 21, 22, 23, 24, 25, 26, 27,
466 28, 28, 29, 28, 28, 30, 31, 32, 28, 33,
467 28, 28, 34, 35, 36, 37, 28, 38, 28, 28,
468 5, 39, 5, 5, 40, 5, 41, 42, 43, 44,
469
470 45, 46, 47, 48, 49, 28, 50, 51, 52, 53,
471 54, 55, 56, 57, 58, 59, 60, 61, 28, 38,
472 62, 63, 64, 5, 5, 5, 1, 65, 65, 65,
473 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
474 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
475 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
476 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
477 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
478 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
479 65, 66, 66, 66, 66, 66, 66, 66, 66, 66,
480
481 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
482 66, 66, 66, 66, 1, 1, 1, 1, 1, 1,
483 1, 1, 1, 67, 67, 67, 67, 67, 67, 67,
484 67, 67, 67, 67, 67, 67, 67, 67, 67, 68,
485 68, 68, 68, 68, 68, 68, 68, 1, 1, 1,
486 1, 1, 1, 1, 1
487 } ;
488
489 static yyconst YY_CHAR yy_meta[69] =
490 { 0,
491 1, 1, 2, 1, 1, 1, 3, 4, 5, 5,
492 6, 7, 8, 8, 8, 8, 8, 8, 8, 1,
493 5, 9, 9, 9, 9, 10, 9, 11, 12, 13,
494 11, 11, 11, 13, 11, 11, 11, 11, 11, 11,
495 9, 9, 9, 9, 10, 9, 11, 11, 11, 11,
496 13, 11, 11, 11, 11, 11, 11, 13, 11, 11,
497 11, 11, 11, 14, 1, 11, 11, 11
498 } ;
499
500 static yyconst flex_uint16_t yy_base[440] =
501 { 0,
502 0, 0, 325, 321, 264, 255, 318, 2387, 67, 2387,
503 64, 269, 61, 62, 95, 77, 136, 259, 51, 61,
504 188, 97, 118, 150, 65, 195, 233, 153, 183, 222,
505 241, 202, 207, 213, 238, 246, 243, 257, 268, 264,
506 298, 276, 221, 219, 218, 270, 236, 0, 2387, 79,
507 87, 2387, 244, 238, 344, 0, 206, 358, 190, 0,
508 2387, 370, 2387, 2387, 0, 342, 377, 177, 175, 174,
509 200, 2387, 54, 377, 0, 254, 397, 171, 170, 169,
510 358, 85, 404, 373, 376, 398, 391, 406, 412, 417,
511 421, 428, 432, 451, 454, 443, 473, 476, 486, 489,
512
513 494, 499, 511, 508, 520, 530, 546, 542, 550, 553,
514 556, 560, 563, 566, 586, 598, 602, 605, 608, 623,
515 612, 644, 647, 168, 167, 222, 217, 2387, 0, 2387,
516 221, 680, 219, 703, 710, 179, 728, 749, 0, 691,
517 666, 765, 159, 158, 135, 130, 128, 651, 125, 123,
518 739, 716, 721, 751, 764, 770, 757, 775, 783, 760,
519 794, 800, 806, 809, 813, 824, 820, 844, 839, 830,
520 854, 850, 862, 869, 874, 886, 904, 893, 908, 917,
521 947, 934, 912, 964, 943, 954, 900, 957, 973, 969,
522 987, 990, 995, 1006, 999, 118, 2387, 735, 0, 2387,
523
524 50, 1030, 1062, 117, 115, 112, 110, 108, 104, 904,
525 72, 2387, 103, 1020, 1025, 1043, 1046, 1064, 1051, 1069,
526 1076, 1055, 1085, 1088, 1099, 1094, 1118, 1102, 1125, 1132,
527 1137, 1142, 1149, 1156, 1167, 1162, 1172, 1175, 1179, 1192,
528 1197, 1210, 1214, 1205, 1223, 1230, 1227, 1217, 1240, 1247,
529 1262, 1253, 1265, 1298, 1278, 1283, 1295, 1301, 160, 154,
530 2387, 107, 1314, 1350, 93, 91, 77, 73, 72, 70,
531 1332, 1344, 1335, 1320, 1356, 1340, 1352, 1374, 1388, 1391,
532 1366, 1396, 1406, 1412, 1409, 1422, 1428, 1442, 1445, 2387,
533 1448, 1452, 1462, 1459, 1478, 1465, 1495, 1498, 1482, 1508,
534
535 1501, 1515, 1485, 1519, 1531, 1534, 1540, 1545, 1549, 2387,
536 2387, 85, 65, 59, 36, 1564, 1556, 1575, 1553, 1590,
537 1571, 1587, 1594, 1609, 1606, 1601, 1612, 1627, 1642, 1645,
538 1648, 1651, 1661, 1667, 1682, 1685, 2387, 1697, 1691, 1700,
539 1716, 2387, 1703, 1733, 1721, 1707, 1740, 39, 27, 1751,
540 1746, 1754, 1770, 1766, 1758, 1788, 1784, 1763, 1800, 1803,
541 1814, 1818, 1833, 1807, 1821, 1825, 1837, 1851, 1857, 1867,
542 24, 1870, 1874, 1882, 1888, 1892, 1900, 1904, 1908, 1923,
543 1938, 1934, 1913, 1943, 1918, 1948, 1954, 36, 1958, 1964,
544 1968, 1978, 1989, 1994, 2002, 2010, 1999, 2020, 2013, 2033,
545
546 2025, 2036, 2050, 2059, 2045, 2056, 2070, 2387, 2075, 2089,
547 2082, 2387, 2093, 2096, 2100, 2108, 2112, 2132, 2119, 2138,
548 2387, 2206, 2220, 2234, 2248, 2257, 2266, 2275, 2288, 2302,
549 2315, 2329, 2339, 2345, 2353, 2355, 2361, 2367, 2373
550 } ;
551
552 static yyconst flex_int16_t yy_def[440] =
553 { 0,
554 421, 1, 422, 422, 423, 423, 421, 421, 421, 421,
555 424, 425, 421, 426, 421, 427, 421, 17, 428, 428,
556 428, 428, 428, 428, 428, 421, 428, 428, 428, 428,
557 21, 428, 428, 428, 428, 428, 428, 428, 428, 428,
558 428, 428, 421, 421, 421, 429, 429, 430, 421, 421,
559 424, 421, 424, 421, 431, 15, 17, 421, 421, 15,
560 421, 421, 421, 421, 432, 433, 421, 421, 421, 421,
561 17, 421, 421, 421, 434, 428, 421, 421, 421, 421,
562 428, 21, 21, 428, 428, 428, 428, 428, 428, 428,
563 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
564
565 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
566 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
567 428, 428, 428, 421, 421, 429, 429, 421, 430, 421,
568 421, 421, 435, 421, 421, 421, 421, 421, 432, 433,
569 436, 421, 421, 421, 421, 421, 421, 437, 421, 421,
570 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
571 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
572 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
573 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
574 428, 428, 428, 428, 428, 421, 421, 421, 438, 421,
575
576 421, 439, 421, 421, 421, 421, 421, 421, 421, 437,
577 421, 421, 421, 428, 428, 428, 428, 428, 428, 428,
578 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
579 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
580 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
581 428, 428, 428, 428, 428, 428, 428, 428, 421, 421,
582 421, 421, 439, 421, 421, 421, 421, 421, 421, 421,
583 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
584 428, 428, 428, 428, 428, 428, 428, 428, 428, 421,
585 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
586
587 428, 428, 428, 428, 428, 428, 428, 428, 428, 421,
588 421, 421, 421, 421, 421, 428, 428, 428, 428, 428,
589 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
590 428, 428, 428, 428, 428, 428, 421, 428, 428, 428,
591 428, 421, 428, 428, 428, 428, 428, 421, 421, 428,
592 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
593 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
594 421, 428, 428, 428, 428, 428, 428, 428, 428, 428,
595 428, 428, 428, 428, 428, 428, 428, 421, 428, 428,
596 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
597
598 428, 428, 428, 428, 428, 428, 428, 421, 428, 428,
599 428, 421, 428, 428, 428, 428, 428, 428, 428, 428,
600 0, 421, 421, 421, 421, 421, 421, 421, 421, 421,
601 421, 421, 421, 421, 421, 421, 421, 421, 421
602 } ;
603
604 static yyconst flex_uint16_t yy_nxt[2456] =
605 { 0,
606 8, 9, 10, 9, 8, 11, 12, 8, 13, 14,
607 15, 16, 17, 18, 18, 18, 18, 18, 18, 8,
608 8, 19, 19, 19, 20, 21, 22, 19, 23, 19,
609 19, 24, 19, 19, 19, 25, 19, 19, 26, 27,
610 19, 28, 29, 30, 31, 32, 33, 19, 34, 19,
611 35, 19, 36, 37, 19, 19, 38, 39, 40, 41,
612 42, 19, 19, 8, 8, 43, 44, 45, 50, 52,
613 50, 56, 56, 57, 57, 57, 57, 57, 57, 57,
614 50, 261, 50, 72, 64, 388, 58, 58, 65, 77,
615 59, 263, 52, 76, 76, 261, 90, 371, 262, 77,
616
617 202, 212, 53, 77, 72, 58, 58, 60, 60, 60,
618 60, 60, 60, 60, 81, 67, 78, 79, 80, 61,
619 62, 63, 212, 349, 61, 53, 78, 79, 80, 263,
620 78, 79, 80, 348, 140, 77, 315, 202, 61, 62,
621 63, 314, 68, 69, 70, 61, 56, 84, 71, 71,
622 71, 71, 71, 71, 71, 313, 77, 263, 72, 312,
623 311, 58, 78, 79, 80, 73, 310, 76, 66, 72,
624 85, 74, 270, 75, 140, 86, 269, 72, 87, 268,
625 58, 202, 91, 78, 79, 80, 73, 213, 77, 76,
626 88, 77, 209, 72, 66, 74, 82, 82, 89, 208,
627
628 83, 83, 83, 83, 83, 83, 83, 91, 91, 91,
629 91, 91, 91, 91, 99, 78, 79, 80, 78, 79,
630 80, 77, 207, 140, 201, 197, 77, 197, 421, 127,
631 100, 196, 91, 150, 149, 76, 101, 421, 147, 146,
632 77, 66, 136, 421, 130, 77, 421, 128, 78, 79,
633 80, 77, 106, 78, 79, 80, 92, 93, 94, 95,
634 77, 96, 102, 107, 97, 108, 98, 78, 79, 80,
635 103, 77, 78, 79, 80, 104, 77, 127, 78, 79,
636 80, 77, 125, 124, 77, 91, 110, 78, 79, 80,
637 111, 109, 77, 105, 112, 77, 421, 113, 78, 79,
638
639 80, 114, 77, 78, 79, 80, 77, 55, 78, 79,
640 80, 78, 79, 80, 77, 115, 123, 421, 49, 78,
641 79, 80, 78, 79, 80, 117, 116, 49, 47, 78,
642 79, 80, 47, 78, 79, 80, 77, 421, 421, 118,
643 421, 78, 79, 80, 421, 421, 119, 421, 120, 421,
644 121, 421, 421, 141, 421, 122, 132, 132, 132, 132,
645 132, 132, 421, 78, 79, 80, 134, 134, 421, 421,
646 135, 135, 135, 135, 135, 135, 135, 421, 137, 137,
647 142, 133, 138, 138, 138, 138, 138, 138, 138, 66,
648 66, 66, 66, 66, 66, 66, 77, 421, 421, 72,
649
650 76, 76, 76, 76, 76, 421, 73, 143, 144, 145,
651 72, 77, 76, 76, 77, 421, 76, 151, 72, 421,
652 157, 155, 421, 78, 79, 80, 154, 73, 152, 77,
653 153, 421, 156, 152, 72, 76, 77, 158, 78, 79,
654 80, 78, 79, 80, 77, 421, 159, 152, 421, 153,
655 77, 421, 421, 421, 152, 77, 78, 79, 80, 77,
656 76, 421, 157, 78, 79, 80, 77, 421, 421, 421,
657 77, 78, 79, 80, 421, 160, 161, 78, 79, 80,
658 421, 77, 78, 79, 80, 421, 78, 79, 80, 77,
659 421, 421, 77, 78, 79, 80, 167, 78, 79, 80,
660
661 166, 421, 163, 162, 164, 421, 421, 165, 78, 79,
662 80, 77, 421, 421, 77, 421, 78, 79, 80, 78,
663 79, 80, 421, 169, 77, 421, 168, 77, 421, 173,
664 421, 421, 77, 421, 170, 171, 421, 77, 78, 79,
665 80, 78, 79, 80, 172, 174, 77, 421, 421, 77,
666 421, 78, 79, 80, 78, 79, 80, 175, 77, 78,
667 79, 80, 176, 421, 78, 79, 80, 177, 77, 421,
668 421, 421, 421, 78, 79, 80, 78, 79, 80, 178,
669 77, 421, 421, 179, 77, 78, 79, 80, 77, 421,
670 421, 77, 421, 421, 77, 78, 79, 80, 77, 180,
671
672 181, 77, 182, 185, 77, 183, 186, 78, 79, 80,
673 157, 78, 79, 80, 184, 78, 79, 80, 78, 79,
674 80, 78, 79, 80, 77, 78, 79, 80, 78, 79,
675 80, 78, 79, 80, 421, 421, 77, 421, 421, 187,
676 77, 421, 421, 77, 421, 421, 77, 421, 421, 421,
677 77, 78, 79, 80, 188, 421, 189, 421, 421, 421,
678 191, 77, 193, 78, 79, 80, 190, 78, 79, 80,
679 78, 79, 80, 78, 79, 80, 192, 78, 79, 80,
680 211, 421, 77, 421, 212, 77, 197, 421, 78, 79,
681 80, 194, 198, 198, 198, 198, 198, 198, 421, 421,
682
683 421, 211, 141, 195, 203, 421, 421, 421, 212, 78,
684 79, 80, 78, 79, 80, 135, 135, 135, 135, 135,
685 135, 135, 135, 135, 135, 135, 135, 135, 135, 142,
686 421, 204, 205, 206, 200, 421, 63, 421, 421, 200,
687 138, 138, 138, 138, 138, 138, 138, 259, 259, 259,
688 259, 259, 259, 200, 77, 63, 143, 144, 145, 77,
689 200, 138, 138, 138, 138, 138, 138, 138, 140, 140,
690 140, 140, 140, 61, 421, 63, 421, 77, 61, 421,
691 214, 78, 79, 80, 140, 421, 78, 79, 80, 77,
692 421, 215, 61, 218, 63, 77, 421, 421, 77, 61,
693
694 421, 421, 77, 140, 78, 79, 80, 421, 77, 216,
695 421, 220, 217, 77, 421, 421, 78, 79, 80, 221,
696 219, 77, 78, 79, 80, 78, 79, 80, 140, 78,
697 79, 80, 77, 421, 421, 78, 79, 80, 77, 222,
698 78, 79, 80, 223, 77, 421, 421, 77, 78, 79,
699 80, 77, 228, 225, 421, 227, 224, 421, 77, 78,
700 79, 80, 77, 421, 421, 78, 79, 80, 77, 226,
701 229, 78, 79, 80, 78, 79, 80, 77, 78, 79,
702 80, 421, 77, 231, 421, 78, 79, 80, 77, 78,
703 79, 80, 77, 421, 233, 78, 79, 80, 230, 421,
704
705 77, 421, 421, 421, 78, 79, 80, 77, 232, 78,
706 79, 80, 77, 421, 236, 78, 79, 80, 234, 78,
707 79, 80, 421, 235, 77, 421, 421, 78, 79, 80,
708 237, 77, 421, 211, 78, 79, 80, 212, 77, 78,
709 79, 80, 77, 421, 239, 238, 77, 421, 240, 421,
710 77, 78, 79, 80, 211, 77, 249, 219, 78, 79,
711 80, 212, 421, 421, 242, 78, 79, 80, 421, 78,
712 79, 80, 77, 78, 79, 80, 241, 78, 79, 80,
713 244, 77, 78, 79, 80, 77, 421, 245, 421, 421,
714 421, 243, 77, 421, 421, 77, 421, 421, 247, 78,
715
716 79, 80, 77, 421, 248, 250, 246, 77, 78, 79,
717 80, 77, 78, 79, 80, 421, 251, 252, 421, 78,
718 79, 80, 78, 79, 80, 77, 421, 253, 77, 78,
719 79, 80, 421, 77, 78, 79, 80, 77, 78, 79,
720 80, 141, 255, 256, 77, 254, 421, 258, 421, 421,
721 421, 421, 78, 79, 80, 78, 79, 80, 77, 257,
722 78, 79, 80, 77, 78, 79, 80, 421, 264, 421,
723 271, 78, 79, 80, 202, 202, 202, 202, 202, 202,
724 202, 77, 421, 272, 77, 78, 79, 80, 274, 77,
725 78, 79, 80, 77, 421, 265, 266, 267, 273, 275,
726
727 421, 421, 77, 421, 421, 277, 421, 77, 78, 79,
728 80, 78, 79, 80, 77, 421, 78, 79, 80, 421,
729 78, 79, 80, 77, 421, 421, 77, 421, 276, 78,
730 79, 80, 77, 278, 78, 79, 80, 77, 279, 421,
731 77, 78, 79, 80, 421, 282, 280, 421, 421, 421,
732 78, 79, 80, 78, 79, 80, 77, 281, 284, 78,
733 79, 80, 283, 77, 78, 79, 80, 78, 79, 80,
734 77, 421, 421, 285, 421, 77, 421, 286, 421, 421,
735 77, 290, 421, 78, 79, 80, 288, 77, 421, 421,
736 78, 79, 80, 287, 77, 421, 421, 78, 79, 80,
737
738 77, 421, 78, 79, 80, 77, 421, 78, 79, 80,
739 77, 421, 421, 77, 78, 79, 80, 77, 421, 421,
740 289, 78, 79, 80, 291, 292, 294, 78, 79, 80,
741 77, 421, 78, 79, 80, 77, 421, 78, 79, 80,
742 78, 79, 80, 77, 78, 79, 80, 296, 77, 421,
743 248, 293, 77, 421, 421, 77, 421, 78, 79, 80,
744 295, 77, 78, 79, 80, 77, 421, 421, 77, 421,
745 78, 79, 80, 297, 421, 78, 79, 80, 77, 78,
746 79, 80, 78, 79, 80, 77, 298, 421, 78, 79,
747 80, 77, 78, 79, 80, 78, 79, 80, 299, 300,
748
749 77, 421, 421, 77, 301, 78, 79, 80, 421, 303,
750 302, 421, 78, 79, 80, 304, 77, 421, 78, 79,
751 80, 77, 421, 421, 306, 141, 421, 78, 79, 80,
752 78, 79, 80, 77, 307, 421, 77, 421, 421, 77,
753 421, 309, 305, 78, 79, 80, 319, 421, 78, 79,
754 80, 308, 264, 263, 263, 263, 263, 263, 77, 421,
755 78, 79, 80, 78, 79, 80, 78, 79, 80, 263,
756 77, 421, 317, 77, 421, 421, 316, 421, 77, 265,
757 266, 267, 77, 318, 320, 78, 79, 80, 263, 321,
758 77, 421, 322, 421, 77, 421, 421, 78, 79, 80,
759
760 78, 79, 80, 421, 77, 78, 79, 80, 326, 78,
761 79, 80, 77, 263, 323, 421, 421, 78, 79, 80,
762 421, 78, 79, 80, 324, 421, 77, 421, 421, 77,
763 421, 78, 79, 80, 77, 325, 327, 421, 421, 78,
764 79, 80, 421, 421, 77, 421, 421, 77, 421, 421,
765 77, 421, 421, 78, 79, 80, 78, 79, 80, 330,
766 77, 78, 79, 80, 328, 329, 77, 331, 332, 421,
767 421, 78, 79, 80, 78, 79, 80, 78, 79, 80,
768 77, 337, 421, 77, 421, 421, 77, 78, 79, 80,
769 77, 319, 421, 78, 79, 80, 336, 77, 333, 421,
770
771 77, 421, 421, 77, 334, 335, 421, 78, 79, 80,
772 78, 79, 80, 78, 79, 80, 77, 78, 79, 80,
773 77, 421, 338, 77, 78, 79, 80, 78, 79, 80,
774 78, 79, 80, 77, 342, 343, 77, 421, 421, 77,
775 319, 421, 339, 78, 79, 80, 77, 78, 79, 80,
776 78, 79, 80, 77, 340, 421, 421, 77, 421, 341,
777 78, 79, 80, 78, 79, 80, 78, 79, 80, 77,
778 421, 421, 77, 78, 79, 80, 421, 344, 77, 421,
779 78, 79, 80, 77, 78, 79, 80, 77, 345, 421,
780 347, 77, 350, 421, 77, 421, 78, 79, 80, 78,
781
782 79, 80, 77, 346, 354, 78, 79, 80, 351, 77,
783 78, 79, 80, 77, 78, 79, 80, 421, 78, 79,
784 80, 78, 79, 80, 353, 77, 421, 421, 77, 78,
785 79, 80, 77, 352, 421, 421, 78, 79, 80, 77,
786 78, 79, 80, 421, 77, 355, 356, 77, 359, 357,
787 77, 421, 78, 79, 80, 78, 79, 80, 421, 78,
788 79, 80, 358, 421, 421, 77, 78, 79, 80, 360,
789 358, 78, 79, 80, 78, 79, 80, 78, 79, 80,
790 77, 421, 421, 77, 421, 421, 77, 421, 421, 77,
791 421, 421, 78, 79, 80, 358, 361, 363, 362, 77,
792
793 421, 421, 364, 421, 421, 77, 421, 78, 79, 80,
794 78, 79, 80, 78, 79, 80, 78, 79, 80, 365,
795 77, 421, 421, 77, 421, 421, 78, 79, 80, 77,
796 366, 421, 78, 79, 80, 77, 421, 421, 77, 421,
797 421, 77, 421, 421, 421, 77, 421, 78, 79, 80,
798 78, 79, 80, 244, 77, 421, 78, 79, 80, 77,
799 421, 421, 78, 79, 80, 78, 79, 80, 78, 79,
800 80, 77, 78, 79, 80, 367, 421, 368, 77, 369,
801 421, 78, 79, 80, 77, 421, 78, 79, 80, 77,
802 370, 216, 77, 421, 421, 374, 77, 421, 78, 79,
803
804 80, 77, 376, 372, 77, 78, 79, 80, 77, 421,
805 421, 78, 79, 80, 375, 373, 78, 79, 80, 78,
806 79, 80, 77, 78, 79, 80, 77, 421, 78, 79,
807 80, 78, 79, 80, 378, 78, 79, 80, 77, 421,
808 377, 77, 421, 421, 379, 77, 380, 421, 421, 78,
809 79, 80, 77, 78, 79, 80, 77, 382, 381, 77,
810 421, 421, 358, 77, 383, 78, 79, 80, 78, 79,
811 80, 77, 78, 79, 80, 77, 421, 358, 384, 78,
812 79, 80, 421, 78, 79, 80, 78, 79, 80, 77,
813 78, 79, 80, 385, 421, 77, 421, 421, 78, 79,
814
815 80, 386, 78, 79, 80, 77, 390, 306, 77, 421,
816 421, 387, 77, 421, 421, 389, 78, 79, 80, 216,
817 77, 392, 78, 79, 80, 421, 77, 421, 421, 421,
818 77, 421, 78, 79, 80, 78, 79, 80, 77, 78,
819 79, 80, 77, 421, 393, 421, 77, 78, 79, 80,
820 391, 77, 421, 78, 79, 80, 77, 78, 79, 80,
821 421, 77, 383, 394, 395, 78, 79, 80, 396, 78,
822 79, 80, 77, 78, 79, 80, 77, 421, 78, 79,
823 80, 77, 421, 78, 79, 80, 77, 398, 78, 79,
824 80, 390, 77, 421, 397, 399, 77, 421, 421, 78,
825
826 79, 80, 77, 78, 79, 80, 77, 421, 78, 79,
827 80, 400, 401, 78, 79, 80, 77, 404, 421, 78,
828 79, 80, 402, 78, 79, 80, 358, 77, 421, 78,
829 79, 80, 77, 78, 79, 80, 421, 77, 358, 421,
830 77, 421, 421, 78, 79, 80, 403, 421, 77, 421,
831 421, 77, 408, 421, 78, 79, 80, 405, 77, 78,
832 79, 80, 406, 77, 78, 79, 80, 78, 79, 80,
833 407, 77, 421, 358, 77, 78, 79, 80, 78, 79,
834 80, 421, 358, 77, 421, 78, 79, 80, 77, 412,
835 78, 79, 80, 410, 77, 421, 409, 77, 78, 79,
836
837 80, 78, 79, 80, 421, 411, 421, 358, 77, 421,
838 78, 79, 80, 77, 421, 78, 79, 80, 415, 413,
839 77, 78, 79, 80, 78, 79, 80, 77, 421, 421,
840 421, 77, 421, 414, 77, 78, 79, 80, 77, 421,
841 78, 79, 80, 358, 416, 421, 77, 78, 79, 80,
842 77, 421, 421, 358, 78, 79, 80, 77, 78, 79,
843 80, 78, 79, 80, 417, 78, 79, 80, 421, 418,
844 77, 421, 420, 78, 79, 80, 77, 78, 79, 80,
845 419, 421, 421, 421, 78, 79, 80, 421, 421, 421,
846 358, 421, 421, 421, 421, 421, 421, 78, 79, 80,
847
848 421, 421, 421, 78, 79, 80, 46, 46, 46, 46,
849 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
850 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
851 48, 48, 48, 48, 51, 51, 51, 51, 51, 51,
852 51, 51, 51, 51, 51, 51, 51, 51, 54, 54,
853 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
854 54, 54, 57, 421, 57, 421, 57, 421, 57, 66,
855 421, 421, 66, 421, 66, 66, 66, 66, 66, 76,
856 76, 421, 76, 76, 76, 76, 76, 76, 126, 126,
857 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
858
859 126, 126, 129, 129, 129, 129, 129, 129, 129, 129,
860 129, 129, 129, 129, 129, 131, 421, 131, 131, 131,
861 131, 131, 131, 131, 131, 131, 131, 131, 131, 139,
862 421, 139, 139, 139, 139, 139, 139, 139, 139, 139,
863 139, 139, 139, 140, 140, 140, 140, 140, 140, 140,
864 140, 140, 148, 148, 148, 199, 421, 421, 421, 421,
865 199, 199, 199, 202, 202, 202, 202, 202, 210, 210,
866 210, 421, 421, 210, 260, 260, 260, 263, 263, 263,
867 263, 263, 263, 263, 263, 263, 7, 421, 421, 421,
868 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
869
870 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
871 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
872 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
873 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
874 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
875 421, 421, 421, 421, 421
876 } ;
877
878 static yyconst flex_int16_t yy_chk[2456] =
879 { 0,
880 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
881 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
882 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
883 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
884 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
885 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
886 1, 1, 1, 1, 1, 1, 1, 1, 9, 11,
887 9, 13, 14, 13, 13, 13, 13, 13, 13, 13,
888 50, 388, 50, 73, 16, 371, 13, 14, 16, 19,
889 14, 349, 51, 82, 82, 201, 25, 348, 201, 20,
890
891 315, 211, 11, 25, 73, 13, 14, 15, 15, 15,
892 15, 15, 15, 15, 20, 16, 19, 19, 19, 15,
893 15, 15, 211, 314, 15, 51, 20, 20, 20, 313,
894 25, 25, 25, 312, 270, 22, 269, 268, 15, 15,
895 15, 267, 16, 16, 16, 15, 17, 22, 17, 17,
896 17, 17, 17, 17, 17, 266, 23, 265, 17, 262,
897 260, 17, 22, 22, 22, 17, 259, 213, 209, 17,
898 23, 17, 208, 17, 207, 24, 206, 17, 24, 205,
899 17, 204, 196, 23, 23, 23, 17, 150, 24, 149,
900 24, 28, 147, 17, 146, 17, 21, 21, 24, 145,
901
902 21, 21, 21, 21, 21, 21, 21, 26, 26, 26,
903 26, 26, 26, 26, 28, 24, 24, 24, 28, 28,
904 28, 29, 144, 143, 136, 133, 21, 131, 127, 126,
905 29, 125, 124, 80, 79, 78, 29, 71, 70, 69,
906 32, 68, 59, 57, 54, 33, 53, 47, 29, 29,
907 29, 34, 32, 21, 21, 21, 27, 27, 27, 27,
908 30, 27, 30, 33, 27, 34, 27, 32, 32, 32,
909 30, 27, 33, 33, 33, 30, 35, 46, 34, 34,
910 34, 37, 45, 44, 36, 43, 36, 30, 30, 30,
911 36, 35, 76, 31, 36, 38, 18, 37, 27, 27,
912
913 27, 38, 40, 35, 35, 35, 39, 12, 37, 37,
914 37, 36, 36, 36, 42, 39, 42, 7, 6, 76,
915 76, 76, 38, 38, 38, 40, 39, 5, 4, 40,
916 40, 40, 3, 39, 39, 39, 41, 0, 0, 41,
917 0, 42, 42, 42, 0, 0, 41, 0, 41, 0,
918 41, 0, 0, 66, 0, 41, 55, 55, 55, 55,
919 55, 55, 0, 41, 41, 41, 58, 58, 0, 0,
920 58, 58, 58, 58, 58, 58, 58, 0, 62, 62,
921 66, 55, 62, 62, 62, 62, 62, 62, 62, 67,
922 67, 67, 67, 67, 67, 67, 81, 0, 0, 74,
923
924 77, 77, 77, 77, 77, 0, 74, 66, 66, 66,
925 74, 84, 83, 83, 85, 0, 77, 81, 74, 0,
926 87, 85, 0, 81, 81, 81, 84, 74, 83, 87,
927 83, 0, 86, 83, 74, 77, 86, 88, 84, 84,
928 84, 85, 85, 85, 88, 0, 90, 83, 0, 83,
929 89, 0, 0, 0, 83, 90, 87, 87, 87, 91,
930 77, 0, 89, 86, 86, 86, 92, 0, 0, 0,
931 93, 88, 88, 88, 0, 92, 93, 89, 89, 89,
932 0, 96, 90, 90, 90, 0, 91, 91, 91, 94,
933 0, 0, 95, 92, 92, 92, 97, 93, 93, 93,
934
935 96, 0, 95, 94, 95, 0, 0, 95, 96, 96,
936 96, 97, 0, 0, 98, 0, 94, 94, 94, 95,
937 95, 95, 0, 98, 99, 0, 97, 100, 0, 100,
938 0, 0, 101, 0, 98, 98, 0, 102, 97, 97,
939 97, 98, 98, 98, 99, 101, 104, 0, 0, 103,
940 0, 99, 99, 99, 100, 100, 100, 102, 105, 101,
941 101, 101, 103, 0, 102, 102, 102, 104, 106, 0,
942 0, 0, 0, 104, 104, 104, 103, 103, 103, 105,
943 108, 0, 0, 106, 107, 105, 105, 105, 109, 0,
944 0, 110, 0, 0, 111, 106, 106, 106, 112, 107,
945
946 108, 113, 109, 113, 114, 110, 114, 108, 108, 108,
947 112, 107, 107, 107, 111, 109, 109, 109, 110, 110,
948 110, 111, 111, 111, 115, 112, 112, 112, 113, 113,
949 113, 114, 114, 114, 0, 0, 116, 0, 0, 115,
950 117, 0, 0, 118, 0, 0, 119, 0, 0, 0,
951 121, 115, 115, 115, 116, 0, 117, 0, 0, 0,
952 119, 120, 121, 116, 116, 116, 118, 117, 117, 117,
953 118, 118, 118, 119, 119, 119, 120, 121, 121, 121,
954 148, 0, 122, 0, 148, 123, 132, 0, 120, 120,
955 120, 122, 132, 132, 132, 132, 132, 132, 0, 0,
956
957 0, 148, 140, 123, 141, 0, 0, 0, 148, 122,
958 122, 122, 123, 123, 123, 134, 134, 134, 134, 134,
959 134, 134, 135, 135, 135, 135, 135, 135, 135, 140,
960 0, 141, 141, 141, 135, 0, 135, 0, 0, 135,
961 137, 137, 137, 137, 137, 137, 137, 198, 198, 198,
962 198, 198, 198, 135, 152, 135, 140, 140, 140, 153,
963 135, 138, 138, 138, 138, 138, 138, 138, 142, 142,
964 142, 142, 142, 138, 0, 138, 0, 151, 138, 0,
965 151, 152, 152, 152, 142, 0, 153, 153, 153, 154,
966 0, 154, 138, 156, 138, 157, 0, 0, 160, 138,
967
968 0, 0, 155, 142, 151, 151, 151, 0, 156, 155,
969 0, 159, 155, 158, 0, 0, 154, 154, 154, 160,
970 158, 159, 157, 157, 157, 160, 160, 160, 142, 155,
971 155, 155, 161, 0, 0, 156, 156, 156, 162, 161,
972 158, 158, 158, 162, 163, 0, 0, 164, 159, 159,
973 159, 165, 167, 164, 0, 166, 163, 0, 167, 161,
974 161, 161, 166, 0, 0, 162, 162, 162, 170, 165,
975 168, 163, 163, 163, 164, 164, 164, 169, 165, 165,
976 165, 0, 168, 170, 0, 167, 167, 167, 172, 166,
977 166, 166, 171, 0, 172, 170, 170, 170, 169, 0,
978
979 173, 0, 0, 0, 169, 169, 169, 174, 171, 168,
980 168, 168, 175, 0, 175, 172, 172, 172, 173, 171,
981 171, 171, 0, 174, 176, 0, 0, 173, 173, 173,
982 176, 178, 0, 210, 174, 174, 174, 210, 187, 175,
983 175, 175, 177, 0, 178, 177, 179, 0, 179, 0,
984 183, 176, 176, 176, 210, 180, 187, 183, 178, 178,
985 178, 210, 0, 0, 181, 187, 187, 187, 0, 177,
986 177, 177, 182, 179, 179, 179, 180, 183, 183, 183,
987 182, 185, 180, 180, 180, 181, 0, 184, 0, 0,
988 0, 181, 186, 0, 0, 188, 0, 0, 185, 182,
989
990 182, 182, 184, 0, 186, 188, 184, 190, 185, 185,
991 185, 189, 181, 181, 181, 0, 188, 189, 0, 186,
992 186, 186, 188, 188, 188, 191, 0, 190, 192, 184,
993 184, 184, 0, 193, 190, 190, 190, 195, 189, 189,
994 189, 202, 192, 193, 194, 191, 0, 195, 0, 0,
995 0, 0, 191, 191, 191, 192, 192, 192, 214, 194,
996 193, 193, 193, 215, 195, 195, 195, 0, 202, 0,
997 214, 194, 194, 194, 203, 203, 203, 203, 203, 203,
998 203, 216, 0, 215, 217, 214, 214, 214, 218, 219,
999 215, 215, 215, 222, 0, 202, 202, 202, 217, 220,
1000
1001 0, 0, 218, 0, 0, 222, 0, 220, 216, 216,
1002 216, 217, 217, 217, 221, 0, 219, 219, 219, 0,
1003 222, 222, 222, 223, 0, 0, 224, 0, 221, 218,
1004 218, 218, 226, 223, 220, 220, 220, 225, 224, 0,
1005 228, 221, 221, 221, 0, 226, 224, 0, 0, 0,
1006 223, 223, 223, 224, 224, 224, 227, 225, 228, 226,
1007 226, 226, 227, 229, 225, 225, 225, 228, 228, 228,
1008 230, 0, 0, 229, 0, 231, 0, 230, 0, 0,
1009 232, 236, 0, 227, 227, 227, 232, 233, 0, 0,
1010 229, 229, 229, 231, 234, 0, 0, 230, 230, 230,
1011
1012 236, 0, 231, 231, 231, 235, 0, 232, 232, 232,
1013 237, 0, 0, 238, 233, 233, 233, 239, 0, 0,
1014 235, 234, 234, 234, 237, 238, 242, 236, 236, 236,
1015 240, 0, 235, 235, 235, 241, 0, 237, 237, 237,
1016 238, 238, 238, 244, 239, 239, 239, 245, 242, 0,
1017 240, 241, 243, 0, 0, 248, 0, 240, 240, 240,
1018 243, 245, 241, 241, 241, 247, 0, 0, 246, 0,
1019 244, 244, 244, 246, 0, 242, 242, 242, 249, 243,
1020 243, 243, 248, 248, 248, 250, 247, 0, 245, 245,
1021 245, 252, 247, 247, 247, 246, 246, 246, 249, 250,
1022
1023 251, 0, 0, 253, 251, 249, 249, 249, 0, 253,
1024 252, 0, 250, 250, 250, 254, 255, 0, 252, 252,
1025 252, 256, 0, 0, 255, 263, 0, 251, 251, 251,
1026 253, 253, 253, 257, 256, 0, 254, 0, 0, 258,
1027 0, 258, 254, 255, 255, 255, 274, 0, 256, 256,
1028 256, 257, 263, 264, 264, 264, 264, 264, 274, 0,
1029 257, 257, 257, 254, 254, 254, 258, 258, 258, 264,
1030 271, 0, 272, 273, 0, 0, 271, 0, 276, 263,
1031 263, 263, 272, 273, 275, 274, 274, 274, 264, 276,
1032 277, 0, 277, 0, 275, 0, 0, 271, 271, 271,
1033
1034 273, 273, 273, 0, 281, 276, 276, 276, 281, 272,
1035 272, 272, 278, 264, 278, 0, 0, 277, 277, 277,
1036 0, 275, 275, 275, 279, 0, 279, 0, 0, 280,
1037 0, 281, 281, 281, 282, 280, 282, 0, 0, 278,
1038 278, 278, 0, 0, 283, 0, 0, 285, 0, 0,
1039 284, 0, 0, 279, 279, 279, 280, 280, 280, 285,
1040 286, 282, 282, 282, 283, 284, 287, 286, 287, 0,
1041 0, 283, 283, 283, 285, 285, 285, 284, 284, 284,
1042 288, 293, 0, 289, 0, 0, 291, 286, 286, 286,
1043 292, 296, 0, 287, 287, 287, 292, 294, 288, 0,
1044
1045 293, 0, 0, 296, 289, 291, 0, 288, 288, 288,
1046 289, 289, 289, 291, 291, 291, 295, 292, 292, 292,
1047 299, 0, 295, 303, 294, 294, 294, 293, 293, 293,
1048 296, 296, 296, 297, 302, 304, 298, 0, 0, 301,
1049 297, 0, 298, 295, 295, 295, 300, 299, 299, 299,
1050 303, 303, 303, 302, 300, 0, 0, 304, 0, 301,
1051 297, 297, 297, 298, 298, 298, 301, 301, 301, 305,
1052 0, 0, 306, 300, 300, 300, 0, 305, 307, 0,
1053 302, 302, 302, 308, 304, 304, 304, 309, 307, 0,
1054 309, 319, 316, 0, 317, 0, 305, 305, 305, 306,
1055
1056 306, 306, 316, 308, 321, 307, 307, 307, 317, 321,
1057 308, 308, 308, 318, 309, 309, 309, 0, 319, 319,
1058 319, 317, 317, 317, 320, 322, 0, 0, 320, 316,
1059 316, 316, 323, 318, 0, 0, 321, 321, 321, 326,
1060 318, 318, 318, 0, 325, 322, 323, 324, 326, 324,
1061 327, 0, 322, 322, 322, 320, 320, 320, 0, 323,
1062 323, 323, 325, 0, 0, 328, 326, 326, 326, 328,
1063 327, 325, 325, 325, 324, 324, 324, 327, 327, 327,
1064 329, 0, 0, 330, 0, 0, 331, 0, 0, 332,
1065 0, 0, 328, 328, 328, 330, 329, 332, 331, 333,
1066
1067 0, 0, 333, 0, 0, 334, 0, 329, 329, 329,
1068 330, 330, 330, 331, 331, 331, 332, 332, 332, 334,
1069 335, 0, 0, 336, 0, 0, 333, 333, 333, 339,
1070 335, 0, 334, 334, 334, 338, 0, 0, 340, 0,
1071 0, 343, 0, 0, 0, 346, 0, 335, 335, 335,
1072 336, 336, 336, 338, 341, 0, 339, 339, 339, 345,
1073 0, 0, 338, 338, 338, 340, 340, 340, 343, 343,
1074 343, 344, 346, 346, 346, 341, 0, 344, 347, 345,
1075 0, 341, 341, 341, 351, 0, 345, 345, 345, 350,
1076 347, 351, 352, 0, 0, 353, 355, 0, 344, 344,
1077
1078 344, 358, 355, 350, 354, 347, 347, 347, 353, 0,
1079 0, 351, 351, 351, 354, 352, 350, 350, 350, 352,
1080 352, 352, 357, 355, 355, 355, 356, 0, 358, 358,
1081 358, 354, 354, 354, 357, 353, 353, 353, 359, 0,
1082 356, 360, 0, 0, 359, 364, 360, 0, 0, 357,
1083 357, 357, 361, 356, 356, 356, 362, 364, 361, 365,
1084 0, 0, 362, 366, 365, 359, 359, 359, 360, 360,
1085 360, 363, 364, 364, 364, 367, 0, 363, 366, 361,
1086 361, 361, 0, 362, 362, 362, 365, 365, 365, 368,
1087 366, 366, 366, 367, 0, 369, 0, 0, 363, 363,
1088
1089 363, 369, 367, 367, 367, 370, 374, 368, 372, 0,
1090 0, 370, 373, 0, 0, 372, 368, 368, 368, 373,
1091 374, 376, 369, 369, 369, 0, 375, 0, 0, 0,
1092 376, 0, 370, 370, 370, 372, 372, 372, 377, 373,
1093 373, 373, 378, 0, 377, 0, 379, 374, 374, 374,
1094 375, 383, 0, 375, 375, 375, 385, 376, 376, 376,
1095 0, 380, 385, 378, 379, 377, 377, 377, 380, 378,
1096 378, 378, 382, 379, 379, 379, 381, 0, 383, 383,
1097 383, 384, 0, 385, 385, 385, 386, 382, 380, 380,
1098 380, 386, 387, 0, 381, 384, 389, 0, 0, 382,
1099
1100 382, 382, 390, 381, 381, 381, 391, 0, 384, 384,
1101 384, 387, 391, 386, 386, 386, 392, 395, 0, 387,
1102 387, 387, 392, 389, 389, 389, 396, 393, 0, 390,
1103 390, 390, 394, 391, 391, 391, 0, 397, 394, 0,
1104 395, 0, 0, 392, 392, 392, 393, 0, 396, 0,
1105 0, 399, 400, 0, 393, 393, 393, 397, 398, 394,
1106 394, 394, 398, 401, 397, 397, 397, 395, 395, 395,
1107 399, 400, 0, 404, 402, 396, 396, 396, 399, 399,
1108 399, 0, 401, 405, 0, 398, 398, 398, 403, 407,
1109 401, 401, 401, 405, 406, 0, 402, 404, 400, 400,
1110
1111 400, 402, 402, 402, 0, 406, 0, 403, 407, 0,
1112 405, 405, 405, 409, 0, 403, 403, 403, 411, 409,
1113 411, 406, 406, 406, 404, 404, 404, 410, 0, 0,
1114 0, 413, 0, 410, 414, 407, 407, 407, 415, 0,
1115 409, 409, 409, 413, 415, 0, 416, 411, 411, 411,
1116 417, 0, 0, 414, 410, 410, 410, 419, 413, 413,
1117 413, 414, 414, 414, 416, 415, 415, 415, 0, 417,
1118 418, 0, 419, 416, 416, 416, 420, 417, 417, 417,
1119 418, 0, 0, 0, 419, 419, 419, 0, 0, 0,
1120 420, 0, 0, 0, 0, 0, 0, 418, 418, 418,
1121
1122 0, 0, 0, 420, 420, 420, 422, 422, 422, 422,
1123 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
1124 423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
1125 423, 423, 423, 423, 424, 424, 424, 424, 424, 424,
1126 424, 424, 424, 424, 424, 424, 424, 424, 425, 425,
1127 425, 425, 425, 425, 425, 425, 425, 425, 425, 425,
1128 425, 425, 426, 0, 426, 0, 426, 0, 426, 427,
1129 0, 0, 427, 0, 427, 427, 427, 427, 427, 428,
1130 428, 0, 428, 428, 428, 428, 428, 428, 429, 429,
1131 429, 429, 429, 429, 429, 429, 429, 429, 429, 429,
1132
1133 429, 429, 430, 430, 430, 430, 430, 430, 430, 430,
1134 430, 430, 430, 430, 430, 431, 0, 431, 431, 431,
1135 431, 431, 431, 431, 431, 431, 431, 431, 431, 432,
1136 0, 432, 432, 432, 432, 432, 432, 432, 432, 432,
1137 432, 432, 432, 433, 433, 433, 433, 433, 433, 433,
1138 433, 433, 434, 434, 434, 435, 0, 0, 0, 0,
1139 435, 435, 435, 436, 436, 436, 436, 436, 437, 437,
1140 437, 0, 0, 437, 438, 438, 438, 439, 439, 439,
1141 439, 439, 439, 439, 439, 439, 421, 421, 421, 421,
1142 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
1143
1144 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
1145 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
1146 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
1147 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
1148 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
1149 421, 421, 421, 421, 421
1150 } ;
1151
1152 static yy_state_type yy_last_accepting_state;
1153 static char *yy_last_accepting_cpos;
1154
1155 extern int ncg_flex_debug;
1156 int ncg_flex_debug = 0;
1157
1158 /* The intent behind this definition is that it'll catch
1159 * any uses of REJECT which flex missed.
1160 */
1161 #define REJECT reject_used_but_not_detected
1162 #define yymore() yymore_used_but_not_detected
1163 #define YY_MORE_ADJ 0
1164 #define YY_RESTORE_YY_MORE_OFFSET
1165 char *ncgtext;
1166 #line 1 "ncgen.l"
1167 #line 2 "ncgen.l"
1168 /*********************************************************************
1169 * Copyright 1993, UCAR/Unidata
1170 * See netcdf/COPYRIGHT file for copying and redistribution conditions.
1171 * $Id: ncgen.l,v 1.24 2009/09/25 18:22:35 dmh Exp $
1172 *********************************************************************/
1173
1174 /* Problems:
1175 1. We assume the input is true utf8.
1176 Unfortunately, we may actually get iso-latin-8859-1.
1177 This means that there will be ambiguity about the characters
1178 in the range 128-255 because they will look like n-byte unicode
1179 when they are 1-byte 8859 characters. Because of our encoding,
1180 8859 characters above 128 will be handles as n-byte utf8 and so
1181 will probably not lex correctly.
1182 Solution: assume utf8 and note in the documentation that
1183 ISO8859 is specifically unsupported.
1184 2. The netcdf function NC_check_name in string.c must be modified to
1185 conform to the use of UTF8.
1186 3. We actually have three tests for UTF8 of increasing correctness
1187 (in the sense that the least correct will allow some sequences that
1188 are technically illegal UTF8).
1189 The tests are derived from the table at
1190 http://www.w3.org/2005/03/23-lex-U
1191 We include lexical definitions for all three, but use the second version.
1192 4. Single character constants enclosed in '...' cannot be
1193 utf-8, so we assume they are by default encoded using the 1-byte
1194 subset of utf-8. It turns out that this subset is in fact
1195 equivalent to US-Ascii (7-bit).
1196 We could use ISO-8859-1, but that conflicts with UTF-8 above value 127.
1197 */
1198
1199 /* lex specification for tokens for ncgen */
1200
1201 /* Fill value used by ncdump from version 2.4 and later. Should match
1202 definition of FILL_STRING in ../ncdump/vardata.h */
1203
1204 #include "ncgen.h"
1205 #include "ncgeny.h"
1206
1207
1208 #define FILL_STRING "_"
1209 #define XDR_INT32_MIN (-2147483647-1)
1210 #define XDR_INT32_MAX 2147483647
1211 #define XDR_INT64_MIN (-9223372036854775807LL-1)
1212 #define XDR_INT64_MAX (9223372036854775807LL)
1213
1214 #undef DEBUG
1215 #ifdef DEBUG
1216 static int MIN_BYTE = NC_MIN_BYTE;
1217 static int MIN_SHORT = NC_MIN_SHORT;
1218 static int MIN_INT = NC_MIN_INT;
1219 static int MAX_BYTE = NC_MAX_BYTE;
1220 static int MAX_SHORT = NC_MAX_SHORT;
1221 static int MAX_INT = NC_MAX_INT;
1222 static int MAX_UBYTE = NC_MAX_UBYTE;
1223 static int MAX_USHORT = NC_MAX_USHORT;
1224 static unsigned int MAX_UINT = NC_MAX_UINT;
1225
1226 #undef NC_MIN_BYTE
1227 #undef NC_MIN_SHORT
1228 #undef NC_MIN_INT
1229 #undef NC_MAX_BYTE
1230 #undef NC_MAX_SHORT
1231 #undef NC_MAX_INT
1232 #undef NC_MAX_UBYTE
1233 #undef NC_MAX_USHORT
1234 #undef NC_MAX_UINT
1235
1236 #define NC_MIN_BYTE MIN_BYTE
1237 #define NC_MIN_SHORT MIN_SHORT
1238 #define NC_MIN_INT MIN_INT
1239 #define NC_MAX_BYTE MAX_BYTE
1240 #define NC_MAX_SHORT MAX_SHORT
1241 #define NC_MAX_INT MAX_INT
1242 #define NC_MAX_UBYTE MAX_UBYTE
1243 #define NC_MAX_USHORT MAX_USHORT
1244 #define NC_MAX_UINT MAX_UINT
1245 #endif
1246
1247 #define TAGCHARS "BbSsLlUu"
1248
1249 #define tstdecimal(ch) ((ch) >= '0' && (ch) <= '9')
1250 #define tstoctal(ch) ((ch) == '0')
1251
1252 /*Mnemonics*/
1253 #define ISIDENT 1
1254
1255 /* Define a fake constant indicating that
1256 no tag was specified */
1257 #define NC_NOTAG (-1)
1258
1259 char errstr[100]; /* for short error messages */
1260
1261 int lineno; /* line number for error messages */
1262 Bytebuffer* lextext; /* name or string with escapes removed */
1263
1264 #define YY_BREAK /* defining as nothing eliminates unreachable
1265 statement warnings from flex output,
1266 but make sure every action ends with
1267 "return" or "break"! */
1268
1269 int specialconstants; /* 1 if nan, nanf, infinity, etc is used */
1270 double double_val; /* last double value read */
1271 float float_val; /* last float value read */
1272 long long int64_val; /* last int64 value read */
1273 int int32_val; /* last int32 value read */
1274 short int16_val; /* last short value read */
1275 unsigned long long uint64_val; /* last int64 value read */
1276 unsigned int uint32_val; /* last int32 value read */
1277 unsigned short uint16_val; /* last short value read */
1278 char char_val; /* last char value read */
1279 signed char byte_val; /* last byte value read */
1280 unsigned char ubyte_val; /* last byte value read */
1281
1282 static Symbol* makepath(char* text);
1283 static int lexdebug(int);
1284 static unsigned long long parseULL(int radix, char* text, int*);
1285 static nc_type downconvert(unsigned long long uint64, int*, int, int);
1286 static int tagmatch(nc_type nct, int tag);
1287 static int nct2lexeme(nc_type nct);
1288 static int collecttag(char* text, char** stagp);
1289
1290 struct Specialtoken specials[] = {
1291 {"_FillValue",_FILLVALUE,_FILLVALUE_FLAG},
1292 {"_Format",_FORMAT,_FORMAT_FLAG},
1293 {"_Storage",_STORAGE,_STORAGE_FLAG},
1294 {"_ChunkSizes",_CHUNKSIZES,_CHUNKSIZES_FLAG},
1295 {"_Fletcher32",_FLETCHER32,_FLETCHER32_FLAG},
1296 {"_DeflateLevel",_DEFLATELEVEL,_DEFLATE_FLAG},
1297 {"_Shuffle",_SHUFFLE,_SHUFFLE_FLAG},
1298 {"_Endianness",_ENDIANNESS,_ENDIAN_FLAG},
1299 {"_NoFill",_NOFILL,_NOFILL_FLAG},
1300 {"_NCProperties",_NCPROPS,_NCPROPS_FLAG},
1301 {"_IsNetcdf4",_ISNETCDF4,_ISNETCDF4_FLAG},
1302 {"_SuperblockVersion",_SUPERBLOCK,_SUPERBLOCK_FLAG},
1303 {"_Filter",_FILTER,_FILTER_FLAG},
1304 {NULL,0} /* null terminate */
1305 };
1306
1307
1308
1309 /* The most correct (validating) version of UTF8 character set
1310 (Taken from: http://www.w3.org/2005/03/23-lex-U)
1311
1312 The lines of the expression cover the UTF8 characters as follows:
1313 1. non-overlong 2-byte
1314 2. excluding overlongs
1315 3. straight 3-byte
1316 4. excluding surrogates
1317 5. straight 3-byte
1318 6. planes 1-3
1319 7. planes 4-15
1320 8. plane 16
1321
1322 UTF8 ([\xC2-\xDF][\x80-\xBF]) \
1323 | (\xE0[\xA0-\xBF][\x80-\xBF]) \
1324 | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF]) \
1325 | (\xED[\x80-\x9F][\x80-\xBF]) \
1326 | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF]) \
1327 | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF]) \
1328 | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]) \
1329 | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF]) \
1330
1331 */
1332 /* Wish there was some way to ifdef lex files */
1333 /*The most relaxed version of UTF8 (not used)
1334 UTF8 ([\xC0-\xD6].)|([\xE0-\xEF]..)|([\xF0-\xF7]...)
1335 */
1336 /*The partially relaxed version of UTF8, and the one used here */
1337 /* The old definition of ID
1338 ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})*
1339 */
1340 /* Don't permit control characters or '/' in names, but other special
1341 chars OK if escaped. Note that to preserve backwards
1342 compatibility, none of the characters _.@+- should be escaped, as
1343 they were previously permitted in names without escaping. */
1344 /* New definition to conform to a subset of string.c */
1345 /* Capture a datasetidentifier */
1346 /* DATASETID ([a-zA-Z0-9!#$%&*:;<=>?/^|~_.@+-]|{UTF8})* */
1347 /* Note: this definition of string will work for utf8 as well,
1348 although it is a very relaxed definition
1349 */
1350 #line 1352 "ncgenl.c"
1351
1352 #define INITIAL 0
1353 #define ST_C_COMMENT 1
1354 #define TEXT 2
1355
1356 #ifndef YY_NO_UNISTD_H
1357 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1358 * down here because we want the user's section 1 to have been scanned first.
1359 * The user has a chance to override it with an option.
1360 */
1361 #include <unistd.h>
1362 #endif
1363
1364 #ifndef YY_EXTRA_TYPE
1365 #define YY_EXTRA_TYPE void *
1366 #endif
1367
1368 static int yy_init_globals (void );
1369
1370 /* Accessor methods to globals.
1371 These are made visible to non-reentrant scanners for convenience. */
1372
1373 int ncglex_destroy (void );
1374
1375 int ncgget_debug (void );
1376
1377 void ncgset_debug (int debug_flag );
1378
1379 YY_EXTRA_TYPE ncgget_extra (void );
1380
1381 void ncgset_extra (YY_EXTRA_TYPE user_defined );
1382
1383 FILE *ncgget_in (void );
1384
1385 void ncgset_in (FILE * _in_str );
1386
1387 FILE *ncgget_out (void );
1388
1389 void ncgset_out (FILE * _out_str );
1390
1391 yy_size_t ncgget_leng (void );
1392
1393 char *ncgget_text (void );
1394
1395 int ncgget_lineno (void );
1396
1397 void ncgset_lineno (int _line_number );
1398
1399 /* Macros after this point can all be overridden by user definitions in
1400 * section 1.
1401 */
1402
1403 #ifndef YY_SKIP_YYWRAP
1404 #ifdef __cplusplus
1405 extern "C" int ncgwrap (void );
1406 #else
1407 extern int ncgwrap (void );
1408 #endif
1409 #endif
1410
1411 #ifndef YY_NO_UNPUT
1412
1413 static void yyunput (int c,char *buf_ptr );
1414
1415 #endif
1416
1417 #ifndef yytext_ptr
1418 static void yy_flex_strncpy (char *,yyconst char *,int );
1419 #endif
1420
1421 #ifdef YY_NEED_STRLEN
1422 static int yy_flex_strlen (yyconst char * );
1423 #endif
1424
1425 #ifndef YY_NO_INPUT
1426
1427 #ifdef __cplusplus
1428 static int yyinput (void );
1429 #else
1430 static int input (void );
1431 #endif
1432
1433 #endif
1434
1435 /* Amount of stuff to slurp up with each read. */
1436 #ifndef YY_READ_BUF_SIZE
1437 #ifdef __ia64__
1438 /* On IA-64, the buffer size is 16k, not 8k */
1439 #define YY_READ_BUF_SIZE 16384
1440 #else
1441 #define YY_READ_BUF_SIZE 8192
1442 #endif /* __ia64__ */
1443 #endif
1444
1445 /* Copy whatever the last rule matched to the standard output. */
1446 #ifndef ECHO
1447 /* This used to be an fputs(), but since the string might contain NUL's,
1448 * we now use fwrite().
1449 */
1450 #define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0)
1451 #endif
1452
1453 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1454 * is returned in "result".
1455 */
1456 #ifndef YY_INPUT
1457 #define YY_INPUT(buf,result,max_size) \
1458 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1459 { \
1460 int c = '*'; \
1461 size_t n; \
1462 for ( n = 0; n < max_size && \
1463 (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
1464 buf[n] = (char) c; \
1465 if ( c == '\n' ) \
1466 buf[n++] = (char) c; \
1467 if ( c == EOF && ferror( ncgin ) ) \
1468 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1469 result = n; \
1470 } \
1471 else \
1472 { \
1473 errno=0; \
1474 while ( (result = fread(buf, 1, max_size, ncgin))==0 && ferror(ncgin)) \
1475 { \
1476 if( errno != EINTR) \
1477 { \
1478 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1479 break; \
1480 } \
1481 errno=0; \
1482 clearerr(ncgin); \
1483 } \
1484 }\
1485 \
1486
1487 #endif
1488
1489 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1490 * we don't want an extra ';' after the "return" because that will cause
1491 * some compilers to complain about unreachable statements.
1492 */
1493 #ifndef yyterminate
1494 #define yyterminate() return YY_NULL
1495 #endif
1496
1497 /* Number of entries by which start-condition stack grows. */
1498 #ifndef YY_START_STACK_INCR
1499 #define YY_START_STACK_INCR 25
1500 #endif
1501
1502 /* Report a fatal error. */
1503 #ifndef YY_FATAL_ERROR
1504 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1505 #endif
1506
1507 /* end tables serialization structures and prototypes */
1508
1509 /* Default declaration of generated scanner - a define so the user can
1510 * easily add parameters.
1511 */
1512 #ifndef YY_DECL
1513 #define YY_DECL_IS_OURS 1
1514
1515 extern int ncglex (void);
1516
1517 #define YY_DECL int ncglex (void)
1518 #endif /* !YY_DECL */
1519
1520 /* Code executed at the beginning of each rule, after ncgtext and ncgleng
1521 * have been set up.
1522 */
1523 #ifndef YY_USER_ACTION
1524 #define YY_USER_ACTION
1525 #endif
1526
1527 /* Code executed at the end of each rule. */
1528 #ifndef YY_BREAK
1529 #define YY_BREAK /*LINTED*/break;
1530 #endif
1531
1532 #define YY_RULE_SETUP \
1533 YY_USER_ACTION
1534
1535 /** The main scanner function which does all the work.
1536 */
1537 YY_DECL
1538 {
1539 yy_state_type yy_current_state;
1540 char *yy_cp, *yy_bp;
1541 int yy_act;
1542
1543 if ( !(yy_init) )
1544 {
1545 (yy_init) = 1;
1546
1547 #ifdef YY_USER_INIT
1548 YY_USER_INIT;
1549 #endif
1550
1551 if ( ! (yy_start) )
1552 (yy_start) = 1; /* first start state */
1553
1554 if ( ! ncgin )
1555 ncgin = stdin;
1556
1557 if ( ! ncgout )
1558 ncgout = stdout;
1559
1560 if ( ! YY_CURRENT_BUFFER ) {
1561 ncgensure_buffer_stack ();
1562 YY_CURRENT_BUFFER_LVALUE =
1563 ncg_create_buffer(ncgin,YY_BUF_SIZE );
1564 }
1565
1566 ncg_load_buffer_state( );
1567 }
1568
1569 {
1570 #line 221 "ncgen.l"
1571
1572 #line 1574 "ncgenl.c"
1573
1574 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1575 {
1576 yy_cp = (yy_c_buf_p);
1577
1578 /* Support of ncgtext. */
1579 *yy_cp = (yy_hold_char);
1580
1581 /* yy_bp points to the position in yy_ch_buf of the start of
1582 * the current run.
1583 */
1584 yy_bp = yy_cp;
1585
1586 yy_current_state = (yy_start);
1587 yy_match:
1588 do
1589 {
1590 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1591 if ( yy_accept[yy_current_state] )
1592 {
1593 (yy_last_accepting_state) = yy_current_state;
1594 (yy_last_accepting_cpos) = yy_cp;
1595 }
1596 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1597 {
1598 yy_current_state = (int) yy_def[yy_current_state];
1599 if ( yy_current_state >= 422 )
1600 yy_c = yy_meta[(unsigned int) yy_c];
1601 }
1602 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1603 ++yy_cp;
1604 }
1605 while ( yy_base[yy_current_state] != 2387 );
1606
1607 yy_find_action:
1608 yy_act = yy_accept[yy_current_state];
1609 if ( yy_act == 0 )
1610 { /* have to back up */
1611 yy_cp = (yy_last_accepting_cpos);
1612 yy_current_state = (yy_last_accepting_state);
1613 yy_act = yy_accept[yy_current_state];
1614 }
1615
1616 YY_DO_BEFORE_ACTION;
1617
1618 do_action: /* This label is used only to access EOF actions. */
1619
1620 switch ( yy_act )
1621 { /* beginning of action switch */
1622 case 0: /* must back up */
1623 /* undo the effects of YY_DO_BEFORE_ACTION */
1624 *yy_cp = (yy_hold_char);
1625 yy_cp = (yy_last_accepting_cpos);
1626 yy_current_state = (yy_last_accepting_state);
1627 goto yy_find_action;
1628
1629 case 1:
1630 YY_RULE_SETUP
1631 #line 222 "ncgen.l"
1632 { /* whitespace */
1633 break;
1634 }
1635 YY_BREAK
1636 case 2:
1637 YY_RULE_SETUP
1638 #line 226 "ncgen.l"
1639 { /* comment */
1640 break;
1641 }
1642 YY_BREAK
1643 case 3:
1644 /* rule 3 can match eol */
1645 YY_RULE_SETUP
1646 #line 230 "ncgen.l"
1647 {int len; char* s = NULL;
1648 /* In netcdf4, this will be used in a variety
1649 of places, so only remove escapes */
1650 /*
1651 if(ncgleng > MAXTRST) {
1652 yyerror("string too long, truncated\n");
1653 ncgtext[MAXTRST-1] = '\0';
1654 }
1655 */
1656 len = unescape((char *)ncgtext+1,ncgleng-2,!ISIDENT,&s);
1657 if(len < 0) {
1658 sprintf(errstr,"Illegal character: %s",ncgtext);
1659 yyerror(errstr);
1660 }
1661 bbClear(lextext);
1662 bbAppendn(lextext,s,len);
1663 bbNull(lextext);
1664 if(s) efree(s);
1665 return lexdebug(TERMSTRING);
1666 }
1667 YY_BREAK
1668 case 4:
1669 YY_RULE_SETUP
1670 #line 251 "ncgen.l"
1671 { /* drop leading 0x; pad to even number of chars */
1672 char* p = ncgtext+2;
1673 int len = ncgleng - 2;
1674 bbClear(lextext);
1675 bbAppendn(lextext,p,len);
1676 if((len % 2) == 1) bbAppend(lextext,'0');
1677 bbNull(lextext);
1678 /* convert all chars to lower case */
1679 for(p=bbContents(lextext);(int)*p;p++) *p = tolower(*p);
1680 return lexdebug(OPAQUESTRING);
1681 }
1682 YY_BREAK
1683 case 5:
1684 YY_RULE_SETUP
1685 #line 263 "ncgen.l"
1686 {return lexdebug(COMPOUND);}
1687 YY_BREAK
1688 case 6:
1689 YY_RULE_SETUP
1690 #line 264 "ncgen.l"
1691 {return lexdebug(ENUM);}
1692 YY_BREAK
1693 case 7:
1694 YY_RULE_SETUP
1695 #line 265 "ncgen.l"
1696 {return lexdebug(OPAQUE_);}
1697 YY_BREAK
1698 case 8:
1699 YY_RULE_SETUP
1700 #line 267 "ncgen.l"
1701 {return lexdebug(FLOAT_K);}
1702 YY_BREAK
1703 case 9:
1704 YY_RULE_SETUP
1705 #line 268 "ncgen.l"
1706 {return lexdebug(CHAR_K);}
1707 YY_BREAK
1708 case 10:
1709 YY_RULE_SETUP
1710 #line 269 "ncgen.l"
1711 {return lexdebug(BYTE_K);}
1712 YY_BREAK
1713 case 11:
1714 YY_RULE_SETUP
1715 #line 270 "ncgen.l"
1716 {return lexdebug(UBYTE_K);}
1717 YY_BREAK
1718 case 12:
1719 YY_RULE_SETUP
1720 #line 271 "ncgen.l"
1721 {return lexdebug(SHORT_K);}
1722 YY_BREAK
1723 case 13:
1724 YY_RULE_SETUP
1725 #line 272 "ncgen.l"
1726 {return lexdebug(USHORT_K);}
1727 YY_BREAK
1728 case 14:
1729 YY_RULE_SETUP
1730 #line 273 "ncgen.l"
1731 {return lexdebug(INT_K);}
1732 YY_BREAK
1733 case 15:
1734 YY_RULE_SETUP
1735 #line 274 "ncgen.l"
1736 {return lexdebug(UINT_K);}
1737 YY_BREAK
1738 case 16:
1739 YY_RULE_SETUP
1740 #line 275 "ncgen.l"
1741 {return lexdebug(INT64_K);}
1742 YY_BREAK
1743 case 17:
1744 YY_RULE_SETUP
1745 #line 276 "ncgen.l"
1746 {return lexdebug(UINT64_K);}
1747 YY_BREAK
1748 case 18:
1749 YY_RULE_SETUP
1750 #line 277 "ncgen.l"
1751 {return lexdebug(DOUBLE_K);}
1752 YY_BREAK
1753 case 19:
1754 YY_RULE_SETUP
1755 #line 278 "ncgen.l"
1756 {return lexdebug(STRING_K);}
1757 YY_BREAK
1758 case 20:
1759 YY_RULE_SETUP
1760 #line 280 "ncgen.l"
1761 {int32_val = -1;
1762 return lexdebug(NC_UNLIMITED_K);}
1763 YY_BREAK
1764 case 21:
1765 YY_RULE_SETUP
1766 #line 283 "ncgen.l"
1767 {return lexdebug(TYPES);}
1768 YY_BREAK
1769 case 22:
1770 YY_RULE_SETUP
1771 #line 284 "ncgen.l"
1772 {return lexdebug(DIMENSIONS);}
1773 YY_BREAK
1774 case 23:
1775 YY_RULE_SETUP
1776 #line 285 "ncgen.l"
1777 {return lexdebug(VARIABLES);}
1778 YY_BREAK
1779 case 24:
1780 YY_RULE_SETUP
1781 #line 286 "ncgen.l"
1782 {return lexdebug(DATA);}
1783 YY_BREAK
1784 case 25:
1785 YY_RULE_SETUP
1786 #line 287 "ncgen.l"
1787 {return lexdebug(GROUP);}
1788 YY_BREAK
1789 case 26:
1790 YY_RULE_SETUP
1791 #line 289 "ncgen.l"
1792 {BEGIN(TEXT);return lexdebug(NETCDF);}
1793 YY_BREAK
1794 case 27:
1795 YY_RULE_SETUP
1796 #line 291 "ncgen.l"
1797 { /* missing value (pre-2.4 backward compatibility) */
1798 if (ncgtext[0] == '-') {
1799 double_val = NEGNC_INFINITE;
1800 } else {
1801 double_val = NC_INFINITE;
1802 }
1803 specialconstants = 1;
1804 return lexdebug(DOUBLE_CONST);
1805 }
1806 YY_BREAK
1807 case 28:
1808 YY_RULE_SETUP
1809 #line 300 "ncgen.l"
1810 { /* missing value (pre-2.4 backward compatibility) */
1811 double_val = NAN;
1812 specialconstants = 1;
1813 return lexdebug(DOUBLE_CONST);
1814 }
1815 YY_BREAK
1816 case 29:
1817 YY_RULE_SETUP
1818 #line 306 "ncgen.l"
1819 {/* missing value (pre-2.4 backward compatibility)*/
1820 if (ncgtext[0] == '-') {
1821 float_val = NEGNC_INFINITEF;
1822 } else {
1823 float_val = NC_INFINITEF;
1824 }
1825 specialconstants = 1;
1826 return lexdebug(FLOAT_CONST);
1827 }
1828 YY_BREAK
1829 case 30:
1830 YY_RULE_SETUP
1831 #line 315 "ncgen.l"
1832 { /* missing value (pre-2.4 backward compatibility) */
1833 float_val = NANF;
1834 specialconstants = 1;
1835 return lexdebug(FLOAT_CONST);
1836 }
1837 YY_BREAK
1838 case 31:
1839 YY_RULE_SETUP
1840 #line 321 "ncgen.l"
1841 {
1842 #ifdef USE_NETCDF4
1843 if(l_flag == L_C || l_flag == L_BINARY)
1844 return lexdebug(NIL);
1845 yyerror("NIL only allowed for netcdf-4 and for -lc or -lb");
1846 #else
1847 yyerror("NIL only allowed for netcdf-4 and for -lc or -lb");
1848 #endif
1849 }
1850 YY_BREAK
1851 case 32:
1852 YY_RULE_SETUP
1853 #line 331 "ncgen.l"
1854 {
1855 bbClear(lextext);
1856 bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
1857 bbNull(lextext);
1858 yylval.sym = makepath(bbContents(lextext));
1859 return lexdebug(PATH);
1860 }
1861 YY_BREAK
1862 case 33:
1863 YY_RULE_SETUP
1864 #line 340 "ncgen.l"
1865 {struct Specialtoken* st;
1866 bbClear(lextext);
1867 bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
1868 bbNull(lextext);
1869 for(st=specials;st->name;st++) {
1870 if(strcmp(bbContents(lextext),st->name)==0) {return lexdebug(st->token);}
1871 }
1872 return 0;
1873 }
1874 YY_BREAK
1875 case 34:
1876 /* rule 34 can match eol */
1877 YY_RULE_SETUP
1878 #line 350 "ncgen.l"
1879 {
1880 int c;
1881 char* p; char* q;
1882 /* copy the trimmed name */
1883 bbClear(lextext);
1884 bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */
1885 bbNull(lextext);
1886 p = bbContents(lextext);
1887 q = p;
1888 while((c=*p++)) {if(c > ' ') *q++ = c;}
1889 *q = '\0';
1890 if(datasetname == NULL)
1891 datasetname = bbDup(lextext);
1892 BEGIN(INITIAL);
1893 return lexdebug(DATASETID);
1894 }
1895 YY_BREAK
1896 case 35:
1897 YY_RULE_SETUP
1898 #line 367 "ncgen.l"
1899 { char* id = NULL; int len;
1900 len = strlen(ncgtext);
1901 len = unescape(ncgtext,len,ISIDENT,&id);
1902 if(NCSTREQ(id, FILL_STRING)) {
1903 efree(id);
1904 return lexdebug(FILLMARKER);
1905 }
1906 yylval.sym = install(id);
1907 efree(id);
1908 return lexdebug(IDENT);
1909 }
1910 YY_BREAK
1911 case 36:
1912 YY_RULE_SETUP
1913 #line 379 "ncgen.l"
1914 {
1915 /*
1916 We need to try to see what size of integer ((u)int).
1917 Technically, the user should specify, but...
1918 If out of any integer range, then complain
1919 Also, if the digits begin with 0, then assume octal.
1920 */
1921 int slen = strlen(ncgtext);
1922 char* stag = NULL;
1923 int tag = NC_NAT;
1924 int isneg = 0;
1925 int c = ncgtext[0];
1926 int fail = 0;
1927 nc_type nct = 0;
1928 char* pos = NULL;
1929 int hasU = 0;
1930 int radix = 10;
1931
1932 pos = ncgtext;
1933
1934 /* capture the tag string */
1935 tag = collecttag(pos,&stag);
1936 if(tag == NC_NAT) {
1937 sprintf(errstr,"Illegal integer suffix: %s",stag);
1938 yyerror(errstr);
1939 goto done;
1940 }
1941
1942 /* drop the tag from the input text */
1943 ncgtext[slen - strlen(stag)] = '\0';
1944 hasU = isuinttype(tag);
1945
1946 /* Capture the sign, if any */
1947 isneg = (c == '-');
1948 /* skip leading sign */
1949 if(c == '-' || c == '+')
1950 pos++;
1951
1952 c = pos[0];
1953 if(tstoctal(c))
1954 radix = 8;
1955 else
1956 radix = 10;
1957
1958 if(isneg && hasU) {
1959 sprintf(errstr,"Unsigned integer cannot be signed: %s",ncgtext);
1960 yyerror(errstr);
1961 goto done;
1962 }
1963 uint64_val = parseULL(radix, pos,&fail);
1964 if(fail) {
1965 sprintf(errstr,"integer constant out of range: %s",ncgtext);
1966 yyerror(errstr);
1967 goto done;
1968 }
1969 /* Down convert to smallest possible range */
1970 nct = downconvert(uint64_val,&tag,isneg,hasU);
1971 switch (k_flag) {
1972 case NC_FORMAT_64BIT_DATA:
1973 case NC_FORMAT_NETCDF4:
1974 return lexdebug(nct2lexeme(nct));
1975 case NC_FORMAT_CLASSIC:
1976 case NC_FORMAT_64BIT_OFFSET:
1977 case NC_FORMAT_NETCDF4_CLASSIC:
1978 if(nct > NC_INT) {
1979 sprintf(errstr,"Illegal integer constant for classic format: %s",ncgtext);
1980 yyerror(errstr);
1981 goto done;
1982 }
1983 }
1984
1985 if(!tagmatch(nct,tag)) {
1986 semwarn(lineno,"Warning: Integer out of range for tag: %s; tag treated as changed.",ncgtext);
1987 }
1988 return lexdebug(nct2lexeme(nct));
1989 done: return 0;
1990 }
1991 YY_BREAK
1992 case 37:
1993 YY_RULE_SETUP
1994 #line 457 "ncgen.l"
1995 {
1996 int c;
1997 int token = 0;
1998 int slen = strlen(ncgtext);
1999 char* stag = NULL;
2000 int tag = NC_NAT;
2001 char* hex = ncgtext+2; /* point to first true hex digit */
2002 int xlen = (slen - 3); /* true hex length */
2003
2004 ncgtext[slen-1] = '\0';
2005 /* capture the tag string */
2006 tag = collecttag(ncgtext,&stag);
2007 if(tag == NC_NAT) {
2008 sprintf(errstr,"Illegal integer suffix: %s",stag);
2009 yyerror(errstr);
2010 goto done;
2011 }
2012 ncgtext[slen - strlen(stag)] = '\0';
2013 if(xlen > 16) { /* truncate hi order digits */
2014 hex += (xlen - 16);
2015 }
2016 /* convert to an unsigned long long */
2017 uint64_val = 0;
2018 while((c=*hex++)) {
2019 unsigned int hexdigit = (c <= '9'?(c-'0'):(c-'a')+0xa);
2020 uint64_val = ((uint64_val << 4) | hexdigit);
2021 }
2022 switch (tag) {
2023 case NC_USHORT:
2024 uint16_val = (unsigned short)uint64_val;
2025 token = USHORT_CONST;
2026 break;
2027 case NC_UINT:
2028 token = UINT_CONST;
2029 break;
2030 case NC_UINT64:
2031 token = UINT64_CONST;
2032 break;
2033 default: /* should never happen */
2034 if (sscanf((char*)ncgtext, "%i", &uint32_val) != 1) {
2035 sprintf(errstr,"bad unsigned int constant: %s",(char*)ncgtext);
2036 yyerror(errstr);
2037 }
2038 token = UINT_CONST;
2039 }
2040 return lexdebug(token);
2041 }
2042 YY_BREAK
2043 case 38:
2044 YY_RULE_SETUP
2045 #line 504 "ncgen.l"
2046 {
2047 if (sscanf((char*)ncgtext, "%le", &double_val) != 1) {
2048 sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext);
2049 yyerror(errstr);
2050 }
2051 return lexdebug(DOUBLE_CONST);
2052 }
2053 YY_BREAK
2054 case 39:
2055 YY_RULE_SETUP
2056 #line 511 "ncgen.l"
2057 {
2058 if (sscanf((char*)ncgtext, "%e", &float_val) != 1) {
2059 sprintf(errstr,"bad float constant: %s",(char*)ncgtext);
2060 yyerror(errstr);
2061 }
2062 return lexdebug(FLOAT_CONST);
2063 }
2064 YY_BREAK
2065 case 40:
2066 /* rule 40 can match eol */
2067 YY_RULE_SETUP
2068 #line 518 "ncgen.l"
2069 {
2070 (void) sscanf((char*)&ncgtext[1],"%c",&byte_val);
2071 return lexdebug(BYTE_CONST);
2072 }
2073 YY_BREAK
2074 case 41:
2075 YY_RULE_SETUP
2076 #line 522 "ncgen.l"
2077 {
2078 int oct = unescapeoct(&ncgtext[2]);
2079 if(oct < 0) {
2080 sprintf(errstr,"bad octal character constant: %s",(char*)ncgtext);
2081 yyerror(errstr);
2082 }
2083 byte_val = (unsigned int)oct;
2084 return lexdebug(BYTE_CONST);
2085 }
2086 YY_BREAK
2087 case 42:
2088 YY_RULE_SETUP
2089 #line 531 "ncgen.l"
2090 {
2091 int hex = unescapehex(&ncgtext[3]);
2092 if(byte_val < 0) {
2093 sprintf(errstr,"bad hex character constant: %s",(char*)ncgtext);
2094 yyerror(errstr);
2095 }
2096 byte_val = (unsigned int)hex;
2097 return lexdebug(BYTE_CONST);
2098 }
2099 YY_BREAK
2100 case 43:
2101 YY_RULE_SETUP
2102 #line 540 "ncgen.l"
2103 {
2104 switch ((char)ncgtext[2]) {
2105 case 'a': byte_val = '\007'; break; /* not everyone under-
2106 * stands '\a' yet */
2107 case 'b': byte_val = '\b'; break;
2108 case 'f': byte_val = '\f'; break;
2109 case 'n': byte_val = '\n'; break;
2110 case 'r': byte_val = '\r'; break;
2111 case 't': byte_val = '\t'; break;
2112 case 'v': byte_val = '\v'; break;
2113 case '\\': byte_val = '\\'; break;
2114 case '?': byte_val = '\177'; break;
2115 case '\'': byte_val = '\''; break;
2116 default: byte_val = (char)ncgtext[2];
2117 }
2118 return lexdebug(BYTE_CONST);
2119 }
2120 YY_BREAK
2121 case 44:
2122 /* rule 44 can match eol */
2123 YY_RULE_SETUP
2124 #line 558 "ncgen.l"
2125 {
2126 lineno++ ;
2127 break;
2128 }
2129 YY_BREAK
2130 case 45:
2131 YY_RULE_SETUP
2132 #line 563 "ncgen.l"
2133 {/*initial*/
2134 BEGIN(ST_C_COMMENT);
2135 break;
2136 }
2137 YY_BREAK
2138 case 46:
2139 /* rule 46 can match eol */
2140 YY_RULE_SETUP
2141 #line 568 "ncgen.l"
2142 {/* continuation */
2143 break;
2144 }
2145 YY_BREAK
2146 case 47:
2147 YY_RULE_SETUP
2148 #line 572 "ncgen.l"
2149 {/* final */
2150 BEGIN(INITIAL);
2151 break;
2152 }
2153 YY_BREAK
2154 case YY_STATE_EOF(ST_C_COMMENT):
2155 #line 577 "ncgen.l"
2156 {/* final, error */
2157 fprintf(stderr,"unterminated /**/ comment");
2158 BEGIN(INITIAL);
2159 break;
2160 }
2161 YY_BREAK
2162 case 48:
2163 YY_RULE_SETUP
2164 #line 583 "ncgen.l"
2165 {/* Note: this next rule will not work for UTF8 characters */
2166 return lexdebug(ncgtext[0]) ;
2167 }
2168 YY_BREAK
2169 case 49:
2170 YY_RULE_SETUP
2171 #line 586 "ncgen.l"
2172 ECHO;
2173 YY_BREAK
2174 #line 2176 "ncgenl.c"
2175 case YY_STATE_EOF(INITIAL):
2176 case YY_STATE_EOF(TEXT):
2177 yyterminate();
2178
2179 case YY_END_OF_BUFFER:
2180 {
2181 /* Amount of text matched not including the EOB char. */
2182 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2183
2184 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2185 *yy_cp = (yy_hold_char);
2186 YY_RESTORE_YY_MORE_OFFSET
2187
2188 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2189 {
2190 /* We're scanning a new file or input source. It's
2191 * possible that this happened because the user
2192 * just pointed ncgin at a new source and called
2193 * ncglex(). If so, then we have to assure
2194 * consistency between YY_CURRENT_BUFFER and our
2195 * globals. Here is the right place to do so, because
2196 * this is the first action (other than possibly a
2197 * back-up) that will match for the new input source.
2198 */
2199 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2200 YY_CURRENT_BUFFER_LVALUE->yy_input_file = ncgin;
2201 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2202 }
2203
2204 /* Note that here we test for yy_c_buf_p "<=" to the position
2205 * of the first EOB in the buffer, since yy_c_buf_p will
2206 * already have been incremented past the NUL character
2207 * (since all states make transitions on EOB to the
2208 * end-of-buffer state). Contrast this with the test
2209 * in input().
2210 */
2211 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2212 { /* This was really a NUL. */
2213 yy_state_type yy_next_state;
2214
2215 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2216
2217 yy_current_state = yy_get_previous_state( );
2218
2219 /* Okay, we're now positioned to make the NUL
2220 * transition. We couldn't have
2221 * yy_get_previous_state() go ahead and do it
2222 * for us because it doesn't know how to deal
2223 * with the possibility of jamming (and we don't
2224 * want to build jamming into it because then it
2225 * will run more slowly).
2226 */
2227
2228 yy_next_state = yy_try_NUL_trans( yy_current_state );
2229
2230 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2231
2232 if ( yy_next_state )
2233 {
2234 /* Consume the NUL. */
2235 yy_cp = ++(yy_c_buf_p);
2236 yy_current_state = yy_next_state;
2237 goto yy_match;
2238 }
2239
2240 else
2241 {
2242 yy_cp = (yy_c_buf_p);
2243 goto yy_find_action;
2244 }
2245 }
2246
2247 else switch ( yy_get_next_buffer( ) )
2248 {
2249 case EOB_ACT_END_OF_FILE:
2250 {
2251 (yy_did_buffer_switch_on_eof) = 0;
2252
2253 if ( ncgwrap( ) )
2254 {
2255 /* Note: because we've taken care in
2256 * yy_get_next_buffer() to have set up
2257 * ncgtext, we can now set up
2258 * yy_c_buf_p so that if some total
2259 * hoser (like flex itself) wants to
2260 * call the scanner after we return the
2261 * YY_NULL, it'll still work - another
2262 * YY_NULL will get returned.
2263 */
2264 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2265
2266 yy_act = YY_STATE_EOF(YY_START);
2267 goto do_action;
2268 }
2269
2270 else
2271 {
2272 if ( ! (yy_did_buffer_switch_on_eof) )
2273 YY_NEW_FILE;
2274 }
2275 break;
2276 }
2277
2278 case EOB_ACT_CONTINUE_SCAN:
2279 (yy_c_buf_p) =
2280 (yytext_ptr) + yy_amount_of_matched_text;
2281
2282 yy_current_state = yy_get_previous_state( );
2283
2284 yy_cp = (yy_c_buf_p);
2285 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2286 goto yy_match;
2287
2288 case EOB_ACT_LAST_MATCH:
2289 (yy_c_buf_p) =
2290 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2291
2292 yy_current_state = yy_get_previous_state( );
2293
2294 yy_cp = (yy_c_buf_p);
2295 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2296 goto yy_find_action;
2297 }
2298 break;
2299 }
2300
2301 default:
2302 YY_FATAL_ERROR(
2303 "fatal flex scanner internal error--no action found" );
2304 } /* end of action switch */
2305 } /* end of scanning one token */
2306 } /* end of user's declarations */
2307 } /* end of ncglex */
2308
2309 /* yy_get_next_buffer - try to read in a new buffer
2310 *
2311 * Returns a code representing an action:
2312 * EOB_ACT_LAST_MATCH -
2313 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2314 * EOB_ACT_END_OF_FILE - end of file
2315 */
yy_get_next_buffer(void)2316 static int yy_get_next_buffer (void)
2317 {
2318 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2319 char *source = (yytext_ptr);
2320 yy_size_t number_to_move, i;
2321 int ret_val;
2322
2323 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2324 YY_FATAL_ERROR(
2325 "fatal flex scanner internal error--end of buffer missed" );
2326
2327 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2328 { /* Don't try to fill the buffer, so this is an EOF. */
2329 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2330 {
2331 /* We matched a single character, the EOB, so
2332 * treat this as a final EOF.
2333 */
2334 return EOB_ACT_END_OF_FILE;
2335 }
2336
2337 else
2338 {
2339 /* We matched some text prior to the EOB, first
2340 * process it.
2341 */
2342 return EOB_ACT_LAST_MATCH;
2343 }
2344 }
2345
2346 /* Try to read more data. */
2347
2348 /* First move last chars to start of buffer. */
2349 number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2350
2351 for ( i = 0; i < number_to_move; ++i )
2352 *(dest++) = *(source++);
2353
2354 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2355 /* don't do the read, it's not guaranteed to return an EOF,
2356 * just force an EOF
2357 */
2358 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2359
2360 else
2361 {
2362 yy_size_t num_to_read =
2363 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2364
2365 while ( num_to_read <= 0 )
2366 { /* Not enough room in the buffer - grow it. */
2367
2368 /* just a shorter name for the current buffer */
2369 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2370
2371 int yy_c_buf_p_offset =
2372 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2373
2374 if ( b->yy_is_our_buffer )
2375 {
2376 yy_size_t new_size = b->yy_buf_size * 2;
2377
2378 if ( new_size <= 0 )
2379 b->yy_buf_size += b->yy_buf_size / 8;
2380 else
2381 b->yy_buf_size *= 2;
2382
2383 b->yy_ch_buf = (char *)
2384 /* Include room in for 2 EOB chars. */
2385 ncgrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
2386 }
2387 else
2388 /* Can't grow it, we don't own it. */
2389 b->yy_ch_buf = 0;
2390
2391 if ( ! b->yy_ch_buf )
2392 YY_FATAL_ERROR(
2393 "fatal error - scanner input buffer overflow" );
2394
2395 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2396
2397 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2398 number_to_move - 1;
2399
2400 }
2401
2402 if ( num_to_read > YY_READ_BUF_SIZE )
2403 num_to_read = YY_READ_BUF_SIZE;
2404
2405 /* Read in more data. */
2406 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2407 (yy_n_chars), num_to_read );
2408
2409 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2410 }
2411
2412 if ( (yy_n_chars) == 0 )
2413 {
2414 if ( number_to_move == YY_MORE_ADJ )
2415 {
2416 ret_val = EOB_ACT_END_OF_FILE;
2417 ncgrestart(ncgin );
2418 }
2419
2420 else
2421 {
2422 ret_val = EOB_ACT_LAST_MATCH;
2423 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2424 YY_BUFFER_EOF_PENDING;
2425 }
2426 }
2427
2428 else
2429 ret_val = EOB_ACT_CONTINUE_SCAN;
2430
2431 if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2432 /* Extend the array by 50%, plus the number we really need. */
2433 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2434 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
2435 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2436 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2437 }
2438
2439 (yy_n_chars) += number_to_move;
2440 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2441 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2442
2443 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2444
2445 return ret_val;
2446 }
2447
2448 /* yy_get_previous_state - get the state just before the EOB char was reached */
2449
yy_get_previous_state(void)2450 static yy_state_type yy_get_previous_state (void)
2451 {
2452 yy_state_type yy_current_state;
2453 char *yy_cp;
2454
2455 yy_current_state = (yy_start);
2456
2457 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2458 {
2459 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2460 if ( yy_accept[yy_current_state] )
2461 {
2462 (yy_last_accepting_state) = yy_current_state;
2463 (yy_last_accepting_cpos) = yy_cp;
2464 }
2465 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2466 {
2467 yy_current_state = (int) yy_def[yy_current_state];
2468 if ( yy_current_state >= 422 )
2469 yy_c = yy_meta[(unsigned int) yy_c];
2470 }
2471 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2472 }
2473
2474 return yy_current_state;
2475 }
2476
2477 /* yy_try_NUL_trans - try to make a transition on the NUL character
2478 *
2479 * synopsis
2480 * next_state = yy_try_NUL_trans( current_state );
2481 */
yy_try_NUL_trans(yy_state_type yy_current_state)2482 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2483 {
2484 int yy_is_jam;
2485 char *yy_cp = (yy_c_buf_p);
2486
2487 YY_CHAR yy_c = 1;
2488 if ( yy_accept[yy_current_state] )
2489 {
2490 (yy_last_accepting_state) = yy_current_state;
2491 (yy_last_accepting_cpos) = yy_cp;
2492 }
2493 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2494 {
2495 yy_current_state = (int) yy_def[yy_current_state];
2496 if ( yy_current_state >= 422 )
2497 yy_c = yy_meta[(unsigned int) yy_c];
2498 }
2499 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2500 yy_is_jam = (yy_current_state == 421);
2501
2502 return yy_is_jam ? 0 : yy_current_state;
2503 }
2504
2505 #ifndef YY_NO_UNPUT
2506
yyunput(int c,char * yy_bp)2507 static void yyunput (int c, char * yy_bp )
2508 {
2509 char *yy_cp;
2510
2511 yy_cp = (yy_c_buf_p);
2512
2513 /* undo effects of setting up ncgtext */
2514 *yy_cp = (yy_hold_char);
2515
2516 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2517 { /* need to shift things up to make room */
2518 /* +2 for EOB chars. */
2519 yy_size_t number_to_move = (yy_n_chars) + 2;
2520 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2521 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2522 char *source =
2523 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2524
2525 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2526 *--dest = *--source;
2527
2528 yy_cp += (int) (dest - source);
2529 yy_bp += (int) (dest - source);
2530 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2531 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2532
2533 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2534 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2535 }
2536
2537 *--yy_cp = (char) c;
2538
2539 (yytext_ptr) = yy_bp;
2540 (yy_hold_char) = *yy_cp;
2541 (yy_c_buf_p) = yy_cp;
2542 }
2543
2544 #endif
2545
2546 #ifndef YY_NO_INPUT
2547 #ifdef __cplusplus
yyinput(void)2548 static int yyinput (void)
2549 #else
2550 static int input (void)
2551 #endif
2552
2553 {
2554 int c;
2555
2556 *(yy_c_buf_p) = (yy_hold_char);
2557
2558 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2559 {
2560 /* yy_c_buf_p now points to the character we want to return.
2561 * If this occurs *before* the EOB characters, then it's a
2562 * valid NUL; if not, then we've hit the end of the buffer.
2563 */
2564 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2565 /* This was really a NUL. */
2566 *(yy_c_buf_p) = '\0';
2567
2568 else
2569 { /* need more input */
2570 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
2571 ++(yy_c_buf_p);
2572
2573 switch ( yy_get_next_buffer( ) )
2574 {
2575 case EOB_ACT_LAST_MATCH:
2576 /* This happens because yy_g_n_b()
2577 * sees that we've accumulated a
2578 * token and flags that we need to
2579 * try matching the token before
2580 * proceeding. But for input(),
2581 * there's no matching to consider.
2582 * So convert the EOB_ACT_LAST_MATCH
2583 * to EOB_ACT_END_OF_FILE.
2584 */
2585
2586 /* Reset buffer status. */
2587 ncgrestart(ncgin );
2588
2589 /*FALLTHROUGH*/
2590
2591 case EOB_ACT_END_OF_FILE:
2592 {
2593 if ( ncgwrap( ) )
2594 return EOF;
2595
2596 if ( ! (yy_did_buffer_switch_on_eof) )
2597 YY_NEW_FILE;
2598 #ifdef __cplusplus
2599 return yyinput();
2600 #else
2601 return input();
2602 #endif
2603 }
2604
2605 case EOB_ACT_CONTINUE_SCAN:
2606 (yy_c_buf_p) = (yytext_ptr) + offset;
2607 break;
2608 }
2609 }
2610 }
2611
2612 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2613 *(yy_c_buf_p) = '\0'; /* preserve ncgtext */
2614 (yy_hold_char) = *++(yy_c_buf_p);
2615
2616 return c;
2617 }
2618 #endif /* ifndef YY_NO_INPUT */
2619
2620 /** Immediately switch to a different input stream.
2621 * @param input_file A readable stream.
2622 *
2623 * @note This function does not reset the start condition to @c INITIAL .
2624 */
ncgrestart(FILE * input_file)2625 void ncgrestart (FILE * input_file )
2626 {
2627
2628 if ( ! YY_CURRENT_BUFFER ){
2629 ncgensure_buffer_stack ();
2630 YY_CURRENT_BUFFER_LVALUE =
2631 ncg_create_buffer(ncgin,YY_BUF_SIZE );
2632 }
2633
2634 ncg_init_buffer(YY_CURRENT_BUFFER,input_file );
2635 ncg_load_buffer_state( );
2636 }
2637
2638 /** Switch to a different input buffer.
2639 * @param new_buffer The new input buffer.
2640 *
2641 */
ncg_switch_to_buffer(YY_BUFFER_STATE new_buffer)2642 void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer )
2643 {
2644
2645 /* TODO. We should be able to replace this entire function body
2646 * with
2647 * ncgpop_buffer_state();
2648 * ncgpush_buffer_state(new_buffer);
2649 */
2650 ncgensure_buffer_stack ();
2651 if ( YY_CURRENT_BUFFER == new_buffer )
2652 return;
2653
2654 if ( YY_CURRENT_BUFFER )
2655 {
2656 /* Flush out information for old buffer. */
2657 *(yy_c_buf_p) = (yy_hold_char);
2658 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2659 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2660 }
2661
2662 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2663 ncg_load_buffer_state( );
2664
2665 /* We don't actually know whether we did this switch during
2666 * EOF (ncgwrap()) processing, but the only time this flag
2667 * is looked at is after ncgwrap() is called, so it's safe
2668 * to go ahead and always set it.
2669 */
2670 (yy_did_buffer_switch_on_eof) = 1;
2671 }
2672
ncg_load_buffer_state(void)2673 static void ncg_load_buffer_state (void)
2674 {
2675 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2676 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2677 ncgin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2678 (yy_hold_char) = *(yy_c_buf_p);
2679 }
2680
2681 /** Allocate and initialize an input buffer state.
2682 * @param file A readable stream.
2683 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2684 *
2685 * @return the allocated buffer state.
2686 */
ncg_create_buffer(FILE * file,int size)2687 YY_BUFFER_STATE ncg_create_buffer (FILE * file, int size )
2688 {
2689 YY_BUFFER_STATE b;
2690
2691 b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) );
2692 if ( ! b )
2693 YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" );
2694
2695 b->yy_buf_size = (yy_size_t)size;
2696
2697 /* yy_ch_buf has to be 2 characters longer than the size given because
2698 * we need to put in 2 end-of-buffer characters.
2699 */
2700 b->yy_ch_buf = (char *) ncgalloc(b->yy_buf_size + 2 );
2701 if ( ! b->yy_ch_buf )
2702 YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" );
2703
2704 b->yy_is_our_buffer = 1;
2705
2706 ncg_init_buffer(b,file );
2707
2708 return b;
2709 }
2710
2711 /** Destroy the buffer.
2712 * @param b a buffer created with ncg_create_buffer()
2713 *
2714 */
ncg_delete_buffer(YY_BUFFER_STATE b)2715 void ncg_delete_buffer (YY_BUFFER_STATE b )
2716 {
2717
2718 if ( ! b )
2719 return;
2720
2721 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2722 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2723
2724 if ( b->yy_is_our_buffer )
2725 ncgfree((void *) b->yy_ch_buf );
2726
2727 ncgfree((void *) b );
2728 }
2729
2730 /* Initializes or reinitializes a buffer.
2731 * This function is sometimes called more than once on the same buffer,
2732 * such as during a ncgrestart() or at EOF.
2733 */
ncg_init_buffer(YY_BUFFER_STATE b,FILE * file)2734 static void ncg_init_buffer (YY_BUFFER_STATE b, FILE * file )
2735
2736 {
2737 int oerrno = errno;
2738
2739 ncg_flush_buffer(b );
2740
2741 b->yy_input_file = file;
2742 b->yy_fill_buffer = 1;
2743
2744 /* If b is the current buffer, then ncg_init_buffer was _probably_
2745 * called from ncgrestart() or through yy_get_next_buffer.
2746 * In that case, we don't want to reset the lineno or column.
2747 */
2748 if (b != YY_CURRENT_BUFFER){
2749 b->yy_bs_lineno = 1;
2750 b->yy_bs_column = 0;
2751 }
2752
2753 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2754
2755 errno = oerrno;
2756 }
2757
2758 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2759 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2760 *
2761 */
ncg_flush_buffer(YY_BUFFER_STATE b)2762 void ncg_flush_buffer (YY_BUFFER_STATE b )
2763 {
2764 if ( ! b )
2765 return;
2766
2767 b->yy_n_chars = 0;
2768
2769 /* We always need two end-of-buffer characters. The first causes
2770 * a transition to the end-of-buffer state. The second causes
2771 * a jam in that state.
2772 */
2773 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2774 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2775
2776 b->yy_buf_pos = &b->yy_ch_buf[0];
2777
2778 b->yy_at_bol = 1;
2779 b->yy_buffer_status = YY_BUFFER_NEW;
2780
2781 if ( b == YY_CURRENT_BUFFER )
2782 ncg_load_buffer_state( );
2783 }
2784
2785 /** Pushes the new state onto the stack. The new state becomes
2786 * the current state. This function will allocate the stack
2787 * if necessary.
2788 * @param new_buffer The new state.
2789 *
2790 */
ncgpush_buffer_state(YY_BUFFER_STATE new_buffer)2791 void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer )
2792 {
2793 if (new_buffer == NULL)
2794 return;
2795
2796 ncgensure_buffer_stack();
2797
2798 /* This block is copied from ncg_switch_to_buffer. */
2799 if ( YY_CURRENT_BUFFER )
2800 {
2801 /* Flush out information for old buffer. */
2802 *(yy_c_buf_p) = (yy_hold_char);
2803 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2804 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2805 }
2806
2807 /* Only push if top exists. Otherwise, replace top. */
2808 if (YY_CURRENT_BUFFER)
2809 (yy_buffer_stack_top)++;
2810 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2811
2812 /* copied from ncg_switch_to_buffer. */
2813 ncg_load_buffer_state( );
2814 (yy_did_buffer_switch_on_eof) = 1;
2815 }
2816
2817 /** Removes and deletes the top of the stack, if present.
2818 * The next element becomes the new top.
2819 *
2820 */
ncgpop_buffer_state(void)2821 void ncgpop_buffer_state (void)
2822 {
2823 if (!YY_CURRENT_BUFFER)
2824 return;
2825
2826 ncg_delete_buffer(YY_CURRENT_BUFFER );
2827 YY_CURRENT_BUFFER_LVALUE = NULL;
2828 if ((yy_buffer_stack_top) > 0)
2829 --(yy_buffer_stack_top);
2830
2831 if (YY_CURRENT_BUFFER) {
2832 ncg_load_buffer_state( );
2833 (yy_did_buffer_switch_on_eof) = 1;
2834 }
2835 }
2836
2837 /* Allocates the stack if it does not exist.
2838 * Guarantees space for at least one push.
2839 */
ncgensure_buffer_stack(void)2840 static void ncgensure_buffer_stack (void)
2841 {
2842 yy_size_t num_to_alloc;
2843
2844 if (!(yy_buffer_stack)) {
2845
2846 /* First allocation is just for 2 elements, since we don't know if this
2847 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2848 * immediate realloc on the next call.
2849 */
2850 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2851 (yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc
2852 (num_to_alloc * sizeof(struct yy_buffer_state*)
2853 );
2854 if ( ! (yy_buffer_stack) )
2855 YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" );
2856
2857 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2858
2859 (yy_buffer_stack_max) = num_to_alloc;
2860 (yy_buffer_stack_top) = 0;
2861 return;
2862 }
2863
2864 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2865
2866 /* Increase the buffer to prepare for a possible push. */
2867 yy_size_t grow_size = 8 /* arbitrary grow size */;
2868
2869 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2870 (yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc
2871 ((yy_buffer_stack),
2872 num_to_alloc * sizeof(struct yy_buffer_state*)
2873 );
2874 if ( ! (yy_buffer_stack) )
2875 YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" );
2876
2877 /* zero only the new slots.*/
2878 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2879 (yy_buffer_stack_max) = num_to_alloc;
2880 }
2881 }
2882
2883 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2884 * @param base the character buffer
2885 * @param size the size in bytes of the character buffer
2886 *
2887 * @return the newly allocated buffer state object.
2888 */
ncg_scan_buffer(char * base,yy_size_t size)2889 YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size )
2890 {
2891 YY_BUFFER_STATE b;
2892
2893 if ( size < 2 ||
2894 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2895 base[size-1] != YY_END_OF_BUFFER_CHAR )
2896 /* They forgot to leave room for the EOB's. */
2897 return 0;
2898
2899 b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) );
2900 if ( ! b )
2901 YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_buffer()" );
2902
2903 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2904 b->yy_buf_pos = b->yy_ch_buf = base;
2905 b->yy_is_our_buffer = 0;
2906 b->yy_input_file = 0;
2907 b->yy_n_chars = b->yy_buf_size;
2908 b->yy_is_interactive = 0;
2909 b->yy_at_bol = 1;
2910 b->yy_fill_buffer = 0;
2911 b->yy_buffer_status = YY_BUFFER_NEW;
2912
2913 ncg_switch_to_buffer(b );
2914
2915 return b;
2916 }
2917
2918 /** Setup the input buffer state to scan a string. The next call to ncglex() will
2919 * scan from a @e copy of @a str.
2920 * @param yystr a NUL-terminated string to scan
2921 *
2922 * @return the newly allocated buffer state object.
2923 * @note If you want to scan bytes that may contain NUL values, then use
2924 * ncg_scan_bytes() instead.
2925 */
ncg_scan_string(yyconst char * yystr)2926 YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr )
2927 {
2928
2929 return ncg_scan_bytes(yystr,strlen(yystr) );
2930 }
2931
2932 /** Setup the input buffer state to scan the given bytes. The next call to ncglex() will
2933 * scan from a @e copy of @a bytes.
2934 * @param yybytes the byte buffer to scan
2935 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2936 *
2937 * @return the newly allocated buffer state object.
2938 */
ncg_scan_bytes(yyconst char * yybytes,yy_size_t _yybytes_len)2939 YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
2940 {
2941 YY_BUFFER_STATE b;
2942 char *buf;
2943 yy_size_t n;
2944 yy_size_t i;
2945
2946 /* Get memory for full buffer, including space for trailing EOB's. */
2947 n = _yybytes_len + 2;
2948 buf = (char *) ncgalloc(n );
2949 if ( ! buf )
2950 YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_bytes()" );
2951
2952 for ( i = 0; i < _yybytes_len; ++i )
2953 buf[i] = yybytes[i];
2954
2955 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2956
2957 b = ncg_scan_buffer(buf,n );
2958 if ( ! b )
2959 YY_FATAL_ERROR( "bad buffer in ncg_scan_bytes()" );
2960
2961 /* It's okay to grow etc. this buffer, and we should throw it
2962 * away when we're done.
2963 */
2964 b->yy_is_our_buffer = 1;
2965
2966 return b;
2967 }
2968
2969 #ifndef YY_EXIT_FAILURE
2970 #define YY_EXIT_FAILURE 2
2971 #endif
2972
yy_fatal_error(yyconst char * msg)2973 static void yy_fatal_error (yyconst char* msg )
2974 {
2975 (void) fprintf( stderr, "%s\n", msg );
2976 exit( YY_EXIT_FAILURE );
2977 }
2978
2979 /* Redefine yyless() so it works in section 3 code. */
2980
2981 #undef yyless
2982 #define yyless(n) \
2983 do \
2984 { \
2985 /* Undo effects of setting up ncgtext. */ \
2986 int yyless_macro_arg = (n); \
2987 YY_LESS_LINENO(yyless_macro_arg);\
2988 ncgtext[ncgleng] = (yy_hold_char); \
2989 (yy_c_buf_p) = ncgtext + yyless_macro_arg; \
2990 (yy_hold_char) = *(yy_c_buf_p); \
2991 *(yy_c_buf_p) = '\0'; \
2992 ncgleng = yyless_macro_arg; \
2993 } \
2994 while ( 0 )
2995
2996 /* Accessor methods (get/set functions) to struct members. */
2997
2998 /** Get the current line number.
2999 *
3000 */
ncgget_lineno(void)3001 int ncgget_lineno (void)
3002 {
3003
3004 return ncglineno;
3005 }
3006
3007 /** Get the input stream.
3008 *
3009 */
ncgget_in(void)3010 FILE *ncgget_in (void)
3011 {
3012 return ncgin;
3013 }
3014
3015 /** Get the output stream.
3016 *
3017 */
ncgget_out(void)3018 FILE *ncgget_out (void)
3019 {
3020 return ncgout;
3021 }
3022
3023 /** Get the length of the current token.
3024 *
3025 */
ncgget_leng(void)3026 yy_size_t ncgget_leng (void)
3027 {
3028 return ncgleng;
3029 }
3030
3031 /** Get the current token.
3032 *
3033 */
3034
ncgget_text(void)3035 char *ncgget_text (void)
3036 {
3037 return ncgtext;
3038 }
3039
3040 /** Set the current line number.
3041 * @param _line_number line number
3042 *
3043 */
ncgset_lineno(int _line_number)3044 void ncgset_lineno (int _line_number )
3045 {
3046
3047 ncglineno = _line_number;
3048 }
3049
3050 /** Set the input stream. This does not discard the current
3051 * input buffer.
3052 * @param _in_str A readable stream.
3053 *
3054 * @see ncg_switch_to_buffer
3055 */
ncgset_in(FILE * _in_str)3056 void ncgset_in (FILE * _in_str )
3057 {
3058 ncgin = _in_str ;
3059 }
3060
ncgset_out(FILE * _out_str)3061 void ncgset_out (FILE * _out_str )
3062 {
3063 ncgout = _out_str ;
3064 }
3065
ncgget_debug(void)3066 int ncgget_debug (void)
3067 {
3068 return ncg_flex_debug;
3069 }
3070
ncgset_debug(int _bdebug)3071 void ncgset_debug (int _bdebug )
3072 {
3073 ncg_flex_debug = _bdebug ;
3074 }
3075
yy_init_globals(void)3076 static int yy_init_globals (void)
3077 {
3078 /* Initialization is the same as for the non-reentrant scanner.
3079 * This function is called from ncglex_destroy(), so don't allocate here.
3080 */
3081
3082 (yy_buffer_stack) = 0;
3083 (yy_buffer_stack_top) = 0;
3084 (yy_buffer_stack_max) = 0;
3085 (yy_c_buf_p) = (char *) 0;
3086 (yy_init) = 0;
3087 (yy_start) = 0;
3088
3089 /* Defined in main.c */
3090 #ifdef YY_STDINIT
3091 ncgin = stdin;
3092 ncgout = stdout;
3093 #else
3094 ncgin = (FILE *) 0;
3095 ncgout = (FILE *) 0;
3096 #endif
3097
3098 /* For future reference: Set errno on error, since we are called by
3099 * ncglex_init()
3100 */
3101 return 0;
3102 }
3103
3104 /* ncglex_destroy is for both reentrant and non-reentrant scanners. */
ncglex_destroy(void)3105 int ncglex_destroy (void)
3106 {
3107
3108 /* Pop the buffer stack, destroying each element. */
3109 while(YY_CURRENT_BUFFER){
3110 ncg_delete_buffer(YY_CURRENT_BUFFER );
3111 YY_CURRENT_BUFFER_LVALUE = NULL;
3112 ncgpop_buffer_state();
3113 }
3114
3115 /* Destroy the stack itself. */
3116 ncgfree((yy_buffer_stack) );
3117 (yy_buffer_stack) = NULL;
3118
3119 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3120 * ncglex() is called, initialization will occur. */
3121 yy_init_globals( );
3122
3123 return 0;
3124 }
3125
3126 /*
3127 * Internal utility routines.
3128 */
3129
3130 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,yyconst char * s2,int n)3131 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3132 {
3133
3134 int i;
3135 for ( i = 0; i < n; ++i )
3136 s1[i] = s2[i];
3137 }
3138 #endif
3139
3140 #ifdef YY_NEED_STRLEN
yy_flex_strlen(yyconst char * s)3141 static int yy_flex_strlen (yyconst char * s )
3142 {
3143 int n;
3144 for ( n = 0; s[n]; ++n )
3145 ;
3146
3147 return n;
3148 }
3149 #endif
3150
ncgalloc(yy_size_t size)3151 void *ncgalloc (yy_size_t size )
3152 {
3153 return (void *) malloc( size );
3154 }
3155
ncgrealloc(void * ptr,yy_size_t size)3156 void *ncgrealloc (void * ptr, yy_size_t size )
3157 {
3158
3159 /* The cast to (char *) in the following accommodates both
3160 * implementations that use char* generic pointers, and those
3161 * that use void* generic pointers. It works with the latter
3162 * because both ANSI C and C++ allow castless assignment from
3163 * any pointer type to void*, and deal with argument conversions
3164 * as though doing an assignment.
3165 */
3166 return (void *) realloc( (char *) ptr, size );
3167 }
3168
ncgfree(void * ptr)3169 void ncgfree (void * ptr )
3170 {
3171 free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */
3172 }
3173
3174 #define YYTABLES_NAME "yytables"
3175
3176 #line 586 "ncgen.l"
3177
3178
3179 static int
lexdebug(int token)3180 lexdebug(int token)
3181 {
3182 if(debug >= 2)
3183 {
3184 char* text = ncgtext;
3185 text[ncgleng] = 0;
3186 fprintf(stderr,"Token=%d |%s| line=%d\n",token,text,lineno);
3187 }
3188 return token;
3189 }
3190
3191 int
lex_init(void)3192 lex_init(void)
3193 {
3194 lineno = 1;
3195 lextext = bbNew();
3196 if(0) unput(0); /* keep -Wall quiet */
3197 return 0;
3198 }
3199
3200 static Symbol*
makepath(char * text0)3201 makepath(char* text0)
3202 {
3203 /* Create a reference symbol.
3204 Convert path to a sequence of symbols.
3205 Use last name as symbol name (with root group reference ('/') as exception).
3206 */
3207 Symbol* refsym = NULL;
3208 /* walk the path converting to a sequence of symbols */
3209 if(strcmp(text0,"/")==0) {
3210 /* special case of root reference */
3211 refsym = rootgroup;
3212 } else {
3213 List* prefix = listnew();
3214 /* split the text into IDENT chunks, convert to symbols */
3215 Symbol* container = rootgroup;
3216 char *ident, *p, *match;
3217 char* text = estrdup(text0);
3218 int lastident;
3219
3220 ident=text+1; p=ident; /* skip leading '/' */
3221 lastident = 0;
3222 do {
3223 match = esc_strchr(p,'/',0);
3224 lastident = (*match == '\0');
3225 *match='\0';
3226 (void)unescape(p,strlen(p),ISIDENT,&ident);
3227 refsym = lookupingroup(NC_GRP,ident,container);
3228 if(!lastident) {
3229 if(refsym == NULL) {
3230 sprintf(errstr,"Undefined or forward referenced group: %s",ident);
3231 yyerror(errstr);
3232 refsym = rootgroup;
3233 } else
3234 listpush(prefix,(void*)refsym);
3235 } else {/* lasiident is true */
3236 refsym = install(ident); /* create as symbol */
3237 refsym->objectclass = NC_GRP;/* tentative */
3238 refsym->ref.is_ref = 1;
3239 refsym->container = container;
3240 refsym->subnodes = listnew();
3241 }
3242 container = refsym;
3243 p = (lastident?match:match+1);
3244 if(ident) efree(ident);
3245 } while(!lastident);
3246 refsym->prefix = prefix;
3247 efree(text);
3248 }
3249 return refsym;
3250 }
3251
3252 /*
3253 Parse a simple string of digits into an unsigned long long
3254 Return the value.
3255 */
3256 static unsigned long long
parseULL(int radix,char * text,int * failp)3257 parseULL(int radix, char* text, int* failp)
3258 {
3259 extern int errno;
3260 char* endptr;
3261 unsigned long long uint64 = 0;
3262
3263 errno = 0; endptr = NULL;
3264 #ifdef HAVE_STRTOULL
3265 uint64 = strtoull(text,&endptr,radix);
3266 if(errno == ERANGE) {
3267 if(failp) *failp = ERANGE;
3268 return 0;
3269 }
3270 #else /*!defined HAVE_STRTOULL*/
3271 /* Have no useful way to detect out of range */
3272 if(radix == 8)
3273 sscanf((char*)text, "%llo", &uint64);
3274 else
3275 sscanf((char*)text, "%llu", &uint64);
3276 #endif /*!defined HAVE_STRTOULL*/
3277 return uint64;
3278 }
3279
3280
3281 /**
3282 Given the raw bits, the sign char, the tag, and hasU
3283 fill in the appropriate *_val field
3284 and return the type.
3285 Note that we cannot return unsigned types if running pure netcdf classic.
3286 The rule is to pick the smallest enclosing type.
3287
3288 The rule used here is that the tag (the suffix, if any)
3289 always takes precedence and the value is modified to conform
3290 if possible, otherwise out-of-range is signalled.
3291 For historical reasons (ncgen3), values that fit as unsigned
3292 are acceptable for the signed tag and conversion is attempted;
3293 e.g. 65535s; is legal and is return as a negative short.
3294 */
3295 static nc_type
downconvert(unsigned long long uint64,int * tagp,int isneg,int hasU)3296 downconvert(unsigned long long uint64, int* tagp, int isneg, int hasU)
3297 {
3298 nc_type nct = NC_NAT;
3299 int tag = *tagp;
3300 int bit63set = (uint64 >> 63);
3301 long long int64 = *((long long*)&uint64);
3302
3303 if(isneg && hasU) {
3304 return (*tagp = NC_NAT);
3305 }
3306 /* To simplify the code, we look for special case of NC_UINT64
3307 constants that will not fit into an NC_INT64 constant.
3308 */
3309 if(tag == NC_UINT64 && bit63set) {
3310 uint64_val = uint64;
3311 return tag;
3312 }
3313 /* At this point we need deal only with int64 value */
3314 /* Apply the isneg */
3315 if(isneg)
3316 int64 = - int64;
3317
3318 if(tag == NC_NOTAG) {
3319 /* If we have no other info, then assume NC_(U)INT(64) */
3320 if(int64 >= NC_MIN_INT && int64 <= NC_MAX_INT) {
3321 nct = (tag = NC_INT);
3322 int32_val = (signed int)int64;
3323 } else if(int64 >= 0 && int64 <= NC_MAX_UINT) {
3324 nct = (tag = NC_UINT);
3325 uint32_val = (unsigned int)int64;
3326 } else if(int64 < 0) {
3327 nct = (tag = NC_INT64);
3328 int64_val = (signed long long)int64;
3329 } else {
3330 nct = (tag = NC_UINT64);
3331 uint64_val = (unsigned long long)int64;
3332 }
3333 goto done;
3334 }
3335 if(isuinttype(tag) && int64 < 0)
3336 goto outofrange;
3337 switch (tag) {
3338 case NC_UBYTE:
3339 if(int64 <= NC_MAX_UBYTE) {
3340 nct = NC_UBYTE;
3341 ubyte_val = (unsigned char)int64;
3342 } else
3343 goto outofrange;
3344 break;
3345 case NC_USHORT:
3346 if(int64 <= NC_MAX_USHORT) {
3347 nct = NC_USHORT;
3348 uint16_val = (unsigned short)int64;
3349 } else
3350 goto outofrange;
3351 break;
3352 case NC_UINT:
3353 if(int64 <= NC_MAX_UINT) {
3354 nct = NC_UINT;
3355 uint32_val = (unsigned int)int64;
3356 } else
3357 goto outofrange;
3358 break;
3359 case NC_UINT64:
3360 if(int64 <= NC_MAX_UINT64) {
3361 nct = NC_UINT64;
3362 uint64_val = uint64;
3363 } else
3364 goto outofrange;
3365 break;
3366 case NC_INT64:
3367 nct = NC_INT64;
3368 int64_val = int64;
3369 break;
3370 case NC_BYTE:
3371 nct = NC_BYTE;
3372 byte_val = (signed char)int64;
3373 break;
3374 case NC_SHORT:
3375 nct = NC_SHORT;
3376 int16_val = (signed short)int64;
3377 break;
3378 case NC_INT:
3379 nct = NC_INT;
3380 int32_val = (signed int)int64;
3381 break;
3382 default:
3383 goto outofrange;
3384 }
3385
3386 done:
3387 *tagp = tag;
3388 return nct;
3389 outofrange:
3390 yyerror("Value out of range");
3391 return NC_NAT;
3392 }
3393
3394 static int
nct2lexeme(nc_type nct)3395 nct2lexeme(nc_type nct)
3396 {
3397 switch(nct) {
3398 case NC_BYTE: return BYTE_CONST;
3399 case NC_CHAR: return CHAR_CONST;
3400 case NC_SHORT: return SHORT_CONST;
3401 case NC_INT: return INT_CONST;
3402 case NC_UBYTE: return UBYTE_CONST;
3403 case NC_USHORT: return USHORT_CONST;
3404 case NC_UINT: return UINT_CONST;
3405 case NC_INT64: return INT64_CONST;
3406 case NC_UINT64: return UINT64_CONST;
3407 }
3408 return 0;
3409 }
3410
3411 static int
tagmatch(nc_type nct,int tag)3412 tagmatch(nc_type nct, int tag)
3413 {
3414 if(tag == NC_NAT || tag == NC_NOTAG)
3415 return 1;
3416 return nct == tag;
3417 }
3418
3419 /* capture the tag string */
3420 static int
collecttag(char * text,char ** stagp)3421 collecttag(char* text, char** stagp)
3422 {
3423 char* stag0;
3424 #define MAXTAGLEN 3
3425 char stag[MAXTAGLEN+1];
3426 int slen = strlen(text);
3427 int staglen;
3428 int tag = NC_NAT;
3429 int hasU = 0;
3430
3431 for(stag0 = text+(slen-1);stag0 > 0;stag0--) {
3432 if(strchr(TAGCHARS,*stag0) == NULL) {stag0++; break;}
3433 }
3434 if(stagp) *stagp = stag0;
3435 staglen = strlen(stag0);
3436 if(staglen == 0)
3437 return NC_NOTAG;
3438 if(staglen > MAXTAGLEN)
3439 return tag;
3440 strncpy(stag,stag0,sizeof(stag));
3441 stag[MAXTAGLEN] = '\0';
3442 if(stag[0] == 'U' || stag[0] == 'u') {
3443 hasU = 1;
3444 memmove(stag,stag+1,MAXTAGLEN);
3445 staglen--;
3446 } else if(stag[staglen-1] == 'U' || stag[staglen-1] == 'u') {
3447 hasU = 1;
3448 staglen--;
3449 stag[staglen] = '\0';
3450 }
3451 if(strlen(stag) == 0 && hasU) {
3452 tag = NC_UINT;
3453 } else if(strlen(stag) == 1) {
3454 switch (stag[0]) {
3455 case 'B': case 'b': tag = (hasU ? NC_UBYTE : NC_BYTE); break;
3456 case 'S': case 's': tag = (hasU ? NC_USHORT : NC_SHORT); break;
3457 case 'L': case 'l': tag = (hasU ? NC_UINT : NC_INT); break;
3458 default: break;
3459 }
3460 } else if(strcasecmp(stag,"ll") == 0) {
3461 tag = (hasU ? NC_UINT64 : NC_INT64);
3462 }
3463 if(tag == NC_NAT) {
3464 if(strlen(stag) > 0)
3465 return tag;
3466 tag = NC_NAT;
3467 }
3468 return tag;
3469 }
3470
3471