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