source: trunk/orbital/generated/mesh-scanner.cpp @ 1430

Last change on this file since 1430 was 1430, checked in by sam, 11 years ago

orbital: another bug in the hex colour parser; now also support 3-component
values which will automatically set alpha to 1.

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