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

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

orbital: enhance the language with [] contexts.

  • 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 41
334#define YY_END_OF_BUFFER 42
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,   42,   39,   40,   39,   39,   36,   39,   35,
345       37,   38,   39,   39,   39,   39,   39,   18,    8,    0,
346        0,   35,   35,    0,   23,   22,   29,    0,    0,   31,
347       27,   30,    0,    0,   19,   20,   21,    9,   10,   11,
348        3,   15,   16,   17,    0,    5,    6,    7,    0,    0,
349       35,   32,   28,    0,    0,    0,    2,    1,    4,   12,
350       13,   14,   33,   25,   24,   26,   34,    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,    1,    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        9,    1,   10,    1,    1,    1,   11,   12,   13,   14,
365
366       15,   16,   17,   18,   19,    1,    1,    1,   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,    2,    1,    1,    1,
388        2,    2,    2,    2,    2,    2,    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,   93,   94,   94,    0,   23,   25,   85,   27,
395       94,   94,   31,   68,   67,   10,   13,   35,   38,    0,
396       82,   44,   60,   53,   94,   71,   94,   63,   73,   94,
397       56,   94,   73,   72,   94,   94,   94,   94,   94,   94,
398       71,   94,   94,   94,   44,   94,   94,   94,    0,   75,
399       74,   94,   94,   68,   67,   60,   94,   94,   94,   94,
400       94,   94,    0,   94,   94,   94,   94,   94,   74,   72,
401       71,   52
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,   68,   70,
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[123] =
417    {   0,
418        4,    5,    6,    7,    8,    9,   10,    4,   11,   12,
419       13,    4,    4,    4,    4,   14,    4,    4,   15,   16,
420        4,    4,   17,   18,   19,    4,    4,    4,   21,   22,
421       21,   22,   21,   22,   24,   35,   36,   37,   38,   39,
422       40,   24,   25,   26,   27,   28,   29,   41,   45,   21,
423       22,   24,   30,   67,   31,   32,   50,   50,   24,   51,
424       42,   43,   44,   46,   47,   48,   23,   24,   55,   60,
425       61,   62,   63,   49,   24,   20,   56,   66,   65,   64,
426       51,   51,   59,   58,   57,   54,   53,   52,   23,   34,
427       33,   23,   68,    3,   68,   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
432    } ;
433
434static yyconst flex_int16_t yy_chk[123] =
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        8,    8,   10,   10,   10,   16,   16,   16,   17,   17,
440       17,   10,   13,   13,   13,   13,   13,   18,   19,   22,
441       22,   22,   13,   72,   13,   13,   24,   24,   22,   24,
442       18,   18,   18,   19,   19,   19,   23,   23,   31,   45,
443       45,   45,   71,   70,   23,   69,   31,   56,   55,   54,
444       51,   50,   41,   34,   33,   29,   28,   26,   21,   15,
445       14,    9,    3,   68,   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
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_INITRB; }
688        YY_BREAK
689case 2:
690YY_RULE_SETUP
691#line 46 "mesh-scanner.l"
692{ return token::T_FREERB; }
693        YY_BREAK
694case 3:
695YY_RULE_SETUP
696#line 48 "mesh-scanner.l"
697{ return token::T_COLOR; }
698        YY_BREAK
699case 4:
700YY_RULE_SETUP
701#line 49 "mesh-scanner.l"
702{ return token::T_BGCOLOR; }
703        YY_BREAK
704case 5:
705YY_RULE_SETUP
706#line 51 "mesh-scanner.l"
707{ return token::T_TRANSLATEX; }
708        YY_BREAK
709case 6:
710YY_RULE_SETUP
711#line 52 "mesh-scanner.l"
712{ return token::T_TRANSLATEY; }
713        YY_BREAK
714case 7:
715YY_RULE_SETUP
716#line 53 "mesh-scanner.l"
717{ return token::T_TRANSLATEZ; }
718        YY_BREAK
719case 8:
720YY_RULE_SETUP
721#line 54 "mesh-scanner.l"
722{ return token::T_TRANSLATE; }
723        YY_BREAK
724case 9:
725YY_RULE_SETUP
726#line 55 "mesh-scanner.l"
727{ return token::T_ROTATEX; }
728        YY_BREAK
729case 10:
730YY_RULE_SETUP
731#line 56 "mesh-scanner.l"
732{ return token::T_ROTATEY; }
733        YY_BREAK
734case 11:
735YY_RULE_SETUP
736#line 57 "mesh-scanner.l"
737{ return token::T_ROTATEZ; }
738        YY_BREAK
739case 12:
740YY_RULE_SETUP
741#line 58 "mesh-scanner.l"
742{ return token::T_TAPERX; }
743        YY_BREAK
744case 13:
745YY_RULE_SETUP
746#line 59 "mesh-scanner.l"
747{ return token::T_TAPERY; }
748        YY_BREAK
749case 14:
750YY_RULE_SETUP
751#line 60 "mesh-scanner.l"
752{ return token::T_TAPERZ; }
753        YY_BREAK
754case 15:
755YY_RULE_SETUP
756#line 61 "mesh-scanner.l"
757{ return token::T_SCALEX; }
758        YY_BREAK
759case 16:
760YY_RULE_SETUP
761#line 62 "mesh-scanner.l"
762{ return token::T_SCALEY; }
763        YY_BREAK
764case 17:
765YY_RULE_SETUP
766#line 63 "mesh-scanner.l"
767{ return token::T_SCALEZ; }
768        YY_BREAK
769case 18:
770YY_RULE_SETUP
771#line 64 "mesh-scanner.l"
772{ return token::T_SCALE; }
773        YY_BREAK
774case 19:
775YY_RULE_SETUP
776#line 65 "mesh-scanner.l"
777{ return token::T_MIRRORX; }
778        YY_BREAK
779case 20:
780YY_RULE_SETUP
781#line 66 "mesh-scanner.l"
782{ return token::T_MIRRORY; }
783        YY_BREAK
784case 21:
785YY_RULE_SETUP
786#line 67 "mesh-scanner.l"
787{ return token::T_MIRRORZ; }
788        YY_BREAK
789case 22:
790YY_RULE_SETUP
791#line 69 "mesh-scanner.l"
792{ return token::T_CYLINDER; }
793        YY_BREAK
794case 23:
795YY_RULE_SETUP
796#line 70 "mesh-scanner.l"
797{ return token::T_BOX; }
798        YY_BREAK
799case 24:
800YY_RULE_SETUP
801#line 71 "mesh-scanner.l"
802{ return token::T_SMOOTHCHAMFBOX; }
803        YY_BREAK
804case 25:
805YY_RULE_SETUP
806#line 72 "mesh-scanner.l"
807{ return token::T_FLATCHAMFBOX; }
808        YY_BREAK
809case 26:
810YY_RULE_SETUP
811#line 73 "mesh-scanner.l"
812{ return token::T_SPHERE; }
813        YY_BREAK
814case 27:
815YY_RULE_SETUP
816#line 74 "mesh-scanner.l"
817{ return token::T_STAR; }
818        YY_BREAK
819case 28:
820YY_RULE_SETUP
821#line 75 "mesh-scanner.l"
822{ return token::T_EXPANDEDSTAR; }
823        YY_BREAK
824case 29:
825YY_RULE_SETUP
826#line 76 "mesh-scanner.l"
827{ return token::T_DISC; }
828        YY_BREAK
829case 30:
830YY_RULE_SETUP
831#line 77 "mesh-scanner.l"
832{ return token::T_TRIANGLE; }
833        YY_BREAK
834case 31:
835YY_RULE_SETUP
836#line 78 "mesh-scanner.l"
837{ return token::T_QUAD; }
838        YY_BREAK
839case 32:
840YY_RULE_SETUP
841#line 79 "mesh-scanner.l"
842{ return token::T_COG; }
843        YY_BREAK
844case 33:
845YY_RULE_SETUP
846#line 81 "mesh-scanner.l"
847{
848        yylval->u32val = 0xf + 0x10 * strtol(yytext + 1, NULL, 16);
849        return token::COLOR; }
850        YY_BREAK
851case 34:
852YY_RULE_SETUP
853#line 84 "mesh-scanner.l"
854{
855        yylval->u32val = strtol(yytext + 1, NULL, 16);
856        return token::COLOR; }
857        YY_BREAK
858case 35:
859YY_RULE_SETUP
860#line 87 "mesh-scanner.l"
861{
862        yylval->fval = atof(yytext); return token::NUMBER; }
863        YY_BREAK
864case 36:
865YY_RULE_SETUP
866#line 89 "mesh-scanner.l"
867{ return token_type('-'); }
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:
880YY_RULE_SETUP
881#line 92 "mesh-scanner.l"
882{ /* ignore everything else */ }
883        YY_BREAK
884case 40:
885/* rule 40 can match eol */
886YY_RULE_SETUP
887#line 93 "mesh-scanner.l"
888{ /* ignore everything else */ }
889        YY_BREAK
890case 41:
891YY_RULE_SETUP
892#line 95 "mesh-scanner.l"
893ECHO;
894        YY_BREAK
895#line 896 "generated/mesh-scanner.cpp"
896case YY_STATE_EOF(INITIAL):
897        yyterminate();
898
899        case YY_END_OF_BUFFER:
900                {
901                /* Amount of text matched not including the EOB char. */
902                int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
903
904                /* Undo the effects of YY_DO_BEFORE_ACTION. */
905                *yy_cp = (yy_hold_char);
906                YY_RESTORE_YY_MORE_OFFSET
907
908                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
909                        {
910                        /* We're scanning a new file or input source.  It's
911                         * possible that this happened because the user
912                         * just pointed yyin at a new source and called
913                         * yylex().  If so, then we have to assure
914                         * consistency between YY_CURRENT_BUFFER and our
915                         * globals.  Here is the right place to do so, because
916                         * this is the first action (other than possibly a
917                         * back-up) that will match for the new input source.
918                         */
919                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
920                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
921                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
922                        }
923
924                /* Note that here we test for yy_c_buf_p "<=" to the position
925                 * of the first EOB in the buffer, since yy_c_buf_p will
926                 * already have been incremented past the NUL character
927                 * (since all states make transitions on EOB to the
928                 * end-of-buffer state).  Contrast this with the test
929                 * in input().
930                 */
931                if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
932                        { /* This was really a NUL. */
933                        yy_state_type yy_next_state;
934
935                        (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
936
937                        yy_current_state = yy_get_previous_state(  );
938
939                        /* Okay, we're now positioned to make the NUL
940                         * transition.  We couldn't have
941                         * yy_get_previous_state() go ahead and do it
942                         * for us because it doesn't know how to deal
943                         * with the possibility of jamming (and we don't
944                         * want to build jamming into it because then it
945                         * will run more slowly).
946                         */
947
948                        yy_next_state = yy_try_NUL_trans( yy_current_state );
949
950                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
951
952                        if ( yy_next_state )
953                                {
954                                /* Consume the NUL. */
955                                yy_cp = ++(yy_c_buf_p);
956                                yy_current_state = yy_next_state;
957                                goto yy_match;
958                                }
959
960                        else
961                                {
962                                yy_cp = (yy_last_accepting_cpos);
963                                yy_current_state = (yy_last_accepting_state);
964                                goto yy_find_action;
965                                }
966                        }
967
968                else switch ( yy_get_next_buffer(  ) )
969                        {
970                        case EOB_ACT_END_OF_FILE:
971                                {
972                                (yy_did_buffer_switch_on_eof) = 0;
973
974                                if ( yywrap(  ) )
975                                        {
976                                        /* Note: because we've taken care in
977                                         * yy_get_next_buffer() to have set up
978                                         * yytext, we can now set up
979                                         * yy_c_buf_p so that if some total
980                                         * hoser (like flex itself) wants to
981                                         * call the scanner after we return the
982                                         * YY_NULL, it'll still work - another
983                                         * YY_NULL will get returned.
984                                         */
985                                        (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
986
987                                        yy_act = YY_STATE_EOF(YY_START);
988                                        goto do_action;
989                                        }
990
991                                else
992                                        {
993                                        if ( ! (yy_did_buffer_switch_on_eof) )
994                                                YY_NEW_FILE;
995                                        }
996                                break;
997                                }
998
999                        case EOB_ACT_CONTINUE_SCAN:
1000                                (yy_c_buf_p) =
1001                                        (yytext_ptr) + yy_amount_of_matched_text;
1002
1003                                yy_current_state = yy_get_previous_state(  );
1004
1005                                yy_cp = (yy_c_buf_p);
1006                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1007                                goto yy_match;
1008
1009                        case EOB_ACT_LAST_MATCH:
1010                                (yy_c_buf_p) =
1011                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1012
1013                                yy_current_state = yy_get_previous_state(  );
1014
1015                                yy_cp = (yy_c_buf_p);
1016                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1017                                goto yy_find_action;
1018                        }
1019                break;
1020                }
1021
1022        default:
1023                YY_FATAL_ERROR(
1024                        "fatal flex scanner internal error--no action found" );
1025        } /* end of action switch */
1026                } /* end of scanning one token */
1027} /* end of yylex */
1028
1029/* The contents of this function are C++ specific, so the () macro is not used.
1030 */
1031yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1032{
1033        yyin = arg_yyin;
1034        yyout = arg_yyout;
1035        yy_c_buf_p = 0;
1036        yy_init = 0;
1037        yy_start = 0;
1038        yy_flex_debug = 0;
1039        yylineno = 1;   // this will only get updated if %option yylineno
1040
1041        yy_did_buffer_switch_on_eof = 0;
1042
1043        yy_looking_for_trail_begin = 0;
1044        yy_more_flag = 0;
1045        yy_more_len = 0;
1046        yy_more_offset = yy_prev_more_offset = 0;
1047
1048        yy_start_stack_ptr = yy_start_stack_depth = 0;
1049        yy_start_stack = NULL;
1050
1051        yy_buffer_stack = 0;
1052        yy_buffer_stack_top = 0;
1053        yy_buffer_stack_max = 0;
1054
1055        yy_state_buf = 0;
1056
1057}
1058
1059/* The contents of this function are C++ specific, so the () macro is not used.
1060 */
1061yyFlexLexer::~yyFlexLexer()
1062{
1063        delete [] yy_state_buf;
1064        Meshfree(yy_start_stack  );
1065        yy_delete_buffer( YY_CURRENT_BUFFER );
1066        Meshfree(yy_buffer_stack  );
1067}
1068
1069/* The contents of this function are C++ specific, so the () macro is not used.
1070 */
1071void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1072{
1073        if ( new_in )
1074                {
1075                yy_delete_buffer( YY_CURRENT_BUFFER );
1076                yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
1077                }
1078
1079        if ( new_out )
1080                yyout = new_out;
1081}
1082
1083#ifdef YY_INTERACTIVE
1084int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1085#else
1086int yyFlexLexer::LexerInput( char* buf, int max_size )
1087#endif
1088{
1089        if ( yyin->eof() || yyin->fail() )
1090                return 0;
1091
1092#ifdef YY_INTERACTIVE
1093        yyin->get( buf[0] );
1094
1095        if ( yyin->eof() )
1096                return 0;
1097
1098        if ( yyin->bad() )
1099                return -1;
1100
1101        return 1;
1102
1103#else
1104        (void) yyin->read( buf, max_size );
1105
1106        if ( yyin->bad() )
1107                return -1;
1108        else
1109                return yyin->gcount();
1110#endif
1111}
1112
1113void yyFlexLexer::LexerOutput( const char* buf, int size )
1114{
1115        (void) yyout->write( buf, size );
1116}
1117
1118/* yy_get_next_buffer - try to read in a new buffer
1119 *
1120 * Returns a code representing an action:
1121 *      EOB_ACT_LAST_MATCH -
1122 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1123 *      EOB_ACT_END_OF_FILE - end of file
1124 */
1125int yyFlexLexer::yy_get_next_buffer()
1126{
1127        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1128        register char *source = (yytext_ptr);
1129        register int number_to_move, i;
1130        int ret_val;
1131
1132        if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1133                YY_FATAL_ERROR(
1134                "fatal flex scanner internal error--end of buffer missed" );
1135
1136        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1137                { /* Don't try to fill the buffer, so this is an EOF. */
1138                if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1139                        {
1140                        /* We matched a single character, the EOB, so
1141                         * treat this as a final EOF.
1142                         */
1143                        return EOB_ACT_END_OF_FILE;
1144                        }
1145
1146                else
1147                        {
1148                        /* We matched some text prior to the EOB, first
1149                         * process it.
1150                         */
1151                        return EOB_ACT_LAST_MATCH;
1152                        }
1153                }
1154
1155        /* Try to read more data. */
1156
1157        /* First move last chars to start of buffer. */
1158        number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1159
1160        for ( i = 0; i < number_to_move; ++i )
1161                *(dest++) = *(source++);
1162
1163        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1164                /* don't do the read, it's not guaranteed to return an EOF,
1165                 * just force an EOF
1166                 */
1167                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1168
1169        else
1170                {
1171                        int num_to_read =
1172                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1173
1174                while ( num_to_read <= 0 )
1175                        { /* Not enough room in the buffer - grow it. */
1176
1177                        /* just a shorter name for the current buffer */
1178                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1179
1180                        int yy_c_buf_p_offset =
1181                                (int) ((yy_c_buf_p) - b->yy_ch_buf);
1182
1183                        if ( b->yy_is_our_buffer )
1184                                {
1185                                int new_size = b->yy_buf_size * 2;
1186
1187                                if ( new_size <= 0 )
1188                                        b->yy_buf_size += b->yy_buf_size / 8;
1189                                else
1190                                        b->yy_buf_size *= 2;
1191
1192                                b->yy_ch_buf = (char *)
1193                                        /* Include room in for 2 EOB chars. */
1194                                        Meshrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1195                                }
1196                        else
1197                                /* Can't grow it, we don't own it. */
1198                                b->yy_ch_buf = 0;
1199
1200                        if ( ! b->yy_ch_buf )
1201                                YY_FATAL_ERROR(
1202                                "fatal error - scanner input buffer overflow" );
1203
1204                        (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1205
1206                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1207                                                number_to_move - 1;
1208
1209                        }
1210
1211                if ( num_to_read > YY_READ_BUF_SIZE )
1212                        num_to_read = YY_READ_BUF_SIZE;
1213
1214                /* Read in more data. */
1215                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1216                        (yy_n_chars), (size_t) num_to_read );
1217
1218                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1219                }
1220
1221        if ( (yy_n_chars) == 0 )
1222                {
1223                if ( number_to_move == YY_MORE_ADJ )
1224                        {
1225                        ret_val = EOB_ACT_END_OF_FILE;
1226                        yyrestart( yyin  );
1227                        }
1228
1229                else
1230                        {
1231                        ret_val = EOB_ACT_LAST_MATCH;
1232                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1233                                YY_BUFFER_EOF_PENDING;
1234                        }
1235                }
1236
1237        else
1238                ret_val = EOB_ACT_CONTINUE_SCAN;
1239
1240        if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1241                /* Extend the array by 50%, plus the number we really need. */
1242                yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1243                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Meshrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1244                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1245                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1246        }
1247
1248        (yy_n_chars) += number_to_move;
1249        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1250        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1251
1252        (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1253
1254        return ret_val;
1255}
1256
1257/* yy_get_previous_state - get the state just before the EOB char was reached */
1258
1259    yy_state_type yyFlexLexer::yy_get_previous_state()
1260{
1261        register yy_state_type yy_current_state;
1262        register char *yy_cp;
1263   
1264        yy_current_state = (yy_start);
1265
1266        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1267                {
1268                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1269                if ( yy_accept[yy_current_state] )
1270                        {
1271                        (yy_last_accepting_state) = yy_current_state;
1272                        (yy_last_accepting_cpos) = yy_cp;
1273                        }
1274                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1275                        {
1276                        yy_current_state = (int) yy_def[yy_current_state];
1277                        if ( yy_current_state >= 69 )
1278                                yy_c = yy_meta[(unsigned int) yy_c];
1279                        }
1280                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1281                }
1282
1283        return yy_current_state;
1284}
1285
1286/* yy_try_NUL_trans - try to make a transition on the NUL character
1287 *
1288 * synopsis
1289 *      next_state = yy_try_NUL_trans( current_state );
1290 */
1291    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1292{
1293        register int yy_is_jam;
1294        register char *yy_cp = (yy_c_buf_p);
1295
1296        register YY_CHAR yy_c = 1;
1297        if ( yy_accept[yy_current_state] )
1298                {
1299                (yy_last_accepting_state) = yy_current_state;
1300                (yy_last_accepting_cpos) = yy_cp;
1301                }
1302        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1303                {
1304                yy_current_state = (int) yy_def[yy_current_state];
1305                if ( yy_current_state >= 69 )
1306                        yy_c = yy_meta[(unsigned int) yy_c];
1307                }
1308        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1309        yy_is_jam = (yy_current_state == 68);
1310
1311        return yy_is_jam ? 0 : yy_current_state;
1312}
1313
1314    void yyFlexLexer::yyunput( int c, register char* yy_bp)
1315{
1316        register char *yy_cp;
1317   
1318    yy_cp = (yy_c_buf_p);
1319
1320        /* undo effects of setting up yytext */
1321        *yy_cp = (yy_hold_char);
1322
1323        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1324                { /* need to shift things up to make room */
1325                /* +2 for EOB chars. */
1326                register int number_to_move = (yy_n_chars) + 2;
1327                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1328                                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1329                register char *source =
1330                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1331
1332                while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1333                        *--dest = *--source;
1334
1335                yy_cp += (int) (dest - source);
1336                yy_bp += (int) (dest - source);
1337                YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1338                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1339
1340                if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1341                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
1342                }
1343
1344        *--yy_cp = (char) c;
1345
1346        (yytext_ptr) = yy_bp;
1347        (yy_hold_char) = *yy_cp;
1348        (yy_c_buf_p) = yy_cp;
1349}
1350
1351    int yyFlexLexer::yyinput()
1352{
1353        int c;
1354   
1355        *(yy_c_buf_p) = (yy_hold_char);
1356
1357        if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1358                {
1359                /* yy_c_buf_p now points to the character we want to return.
1360                 * If this occurs *before* the EOB characters, then it's a
1361                 * valid NUL; if not, then we've hit the end of the buffer.
1362                 */
1363                if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1364                        /* This was really a NUL. */
1365                        *(yy_c_buf_p) = '\0';
1366
1367                else
1368                        { /* need more input */
1369                        int offset = (yy_c_buf_p) - (yytext_ptr);
1370                        ++(yy_c_buf_p);
1371
1372                        switch ( yy_get_next_buffer(  ) )
1373                                {
1374                                case EOB_ACT_LAST_MATCH:
1375                                        /* This happens because yy_g_n_b()
1376                                         * sees that we've accumulated a
1377                                         * token and flags that we need to
1378                                         * try matching the token before
1379                                         * proceeding.  But for input(),
1380                                         * there's no matching to consider.
1381                                         * So convert the EOB_ACT_LAST_MATCH
1382                                         * to EOB_ACT_END_OF_FILE.
1383                                         */
1384
1385                                        /* Reset buffer status. */
1386                                        yyrestart( yyin );
1387
1388                                        /*FALLTHROUGH*/
1389
1390                                case EOB_ACT_END_OF_FILE:
1391                                        {
1392                                        if ( yywrap(  ) )
1393                                                return EOF;
1394
1395                                        if ( ! (yy_did_buffer_switch_on_eof) )
1396                                                YY_NEW_FILE;
1397#ifdef __cplusplus
1398                                        return yyinput();
1399#else
1400                                        return input();
1401#endif
1402                                        }
1403
1404                                case EOB_ACT_CONTINUE_SCAN:
1405                                        (yy_c_buf_p) = (yytext_ptr) + offset;
1406                                        break;
1407                                }
1408                        }
1409                }
1410
1411        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
1412        *(yy_c_buf_p) = '\0';   /* preserve yytext */
1413        (yy_hold_char) = *++(yy_c_buf_p);
1414
1415        return c;
1416}
1417
1418/** Immediately switch to a different input stream.
1419 * @param input_file A readable stream.
1420 *
1421 * @note This function does not reset the start condition to @c INITIAL .
1422 */
1423    void yyFlexLexer::yyrestart( std::istream* input_file )
1424{
1425   
1426        if ( ! YY_CURRENT_BUFFER ){
1427        yyensure_buffer_stack ();
1428                YY_CURRENT_BUFFER_LVALUE =
1429            yy_create_buffer( yyin, YY_BUF_SIZE );
1430        }
1431
1432        yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1433        yy_load_buffer_state(  );
1434}
1435
1436/** Switch to a different input buffer.
1437 * @param new_buffer The new input buffer.
1438 *
1439 */
1440    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1441{
1442   
1443        /* TODO. We should be able to replace this entire function body
1444         * with
1445         *              yypop_buffer_state();
1446         *              yypush_buffer_state(new_buffer);
1447     */
1448        yyensure_buffer_stack ();
1449        if ( YY_CURRENT_BUFFER == new_buffer )
1450                return;
1451
1452        if ( YY_CURRENT_BUFFER )
1453                {
1454                /* Flush out information for old buffer. */
1455                *(yy_c_buf_p) = (yy_hold_char);
1456                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1457                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1458                }
1459
1460        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1461        yy_load_buffer_state(  );
1462
1463        /* We don't actually know whether we did this switch during
1464         * EOF (yywrap()) processing, but the only time this flag
1465         * is looked at is after yywrap() is called, so it's safe
1466         * to go ahead and always set it.
1467         */
1468        (yy_did_buffer_switch_on_eof) = 1;
1469}
1470
1471    void yyFlexLexer::yy_load_buffer_state()
1472{
1473        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1474        (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1475        yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1476        (yy_hold_char) = *(yy_c_buf_p);
1477}
1478
1479/** Allocate and initialize an input buffer state.
1480 * @param file A readable stream.
1481 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1482 *
1483 * @return the allocated buffer state.
1484 */
1485    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1486{
1487        YY_BUFFER_STATE b;
1488   
1489        b = (YY_BUFFER_STATE) Meshalloc(sizeof( struct yy_buffer_state )  );
1490        if ( ! b )
1491                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1492
1493        b->yy_buf_size = size;
1494
1495        /* yy_ch_buf has to be 2 characters longer than the size given because
1496         * we need to put in 2 end-of-buffer characters.
1497         */
1498        b->yy_ch_buf = (char *) Meshalloc(b->yy_buf_size + 2  );
1499        if ( ! b->yy_ch_buf )
1500                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1501
1502        b->yy_is_our_buffer = 1;
1503
1504        yy_init_buffer( b, file );
1505
1506        return b;
1507}
1508
1509/** Destroy the buffer.
1510 * @param b a buffer created with yy_create_buffer()
1511 *
1512 */
1513    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1514{
1515   
1516        if ( ! b )
1517                return;
1518
1519        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1520                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1521
1522        if ( b->yy_is_our_buffer )
1523                Meshfree((void *) b->yy_ch_buf  );
1524
1525        Meshfree((void *) b  );
1526}
1527
1528extern "C" int isatty (int );
1529
1530/* Initializes or reinitializes a buffer.
1531 * This function is sometimes called more than once on the same buffer,
1532 * such as during a yyrestart() or at EOF.
1533 */
1534    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1535
1536{
1537        int oerrno = errno;
1538   
1539        yy_flush_buffer( b );
1540
1541        b->yy_input_file = file;
1542        b->yy_fill_buffer = 1;
1543
1544    /* If b is the current buffer, then yy_init_buffer was _probably_
1545     * called from yyrestart() or through yy_get_next_buffer.
1546     * In that case, we don't want to reset the lineno or column.
1547     */
1548    if (b != YY_CURRENT_BUFFER){
1549        b->yy_bs_lineno = 1;
1550        b->yy_bs_column = 0;
1551    }
1552
1553        b->yy_is_interactive = 0;
1554        errno = oerrno;
1555}
1556
1557/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1558 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1559 *
1560 */
1561    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1562{
1563        if ( ! b )
1564                return;
1565
1566        b->yy_n_chars = 0;
1567
1568        /* We always need two end-of-buffer characters.  The first causes
1569         * a transition to the end-of-buffer state.  The second causes
1570         * a jam in that state.
1571         */
1572        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1573        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1574
1575        b->yy_buf_pos = &b->yy_ch_buf[0];
1576
1577        b->yy_at_bol = 1;
1578        b->yy_buffer_status = YY_BUFFER_NEW;
1579
1580        if ( b == YY_CURRENT_BUFFER )
1581                yy_load_buffer_state(  );
1582}
1583
1584/** Pushes the new state onto the stack. The new state becomes
1585 *  the current state. This function will allocate the stack
1586 *  if necessary.
1587 *  @param new_buffer The new state.
1588 * 
1589 */
1590void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1591{
1592        if (new_buffer == NULL)
1593                return;
1594
1595        yyensure_buffer_stack();
1596
1597        /* This block is copied from yy_switch_to_buffer. */
1598        if ( YY_CURRENT_BUFFER )
1599                {
1600                /* Flush out information for old buffer. */
1601                *(yy_c_buf_p) = (yy_hold_char);
1602                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1603                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1604                }
1605
1606        /* Only push if top exists. Otherwise, replace top. */
1607        if (YY_CURRENT_BUFFER)
1608                (yy_buffer_stack_top)++;
1609        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1610
1611        /* copied from yy_switch_to_buffer. */
1612        yy_load_buffer_state(  );
1613        (yy_did_buffer_switch_on_eof) = 1;
1614}
1615
1616/** Removes and deletes the top of the stack, if present.
1617 *  The next element becomes the new top.
1618 * 
1619 */
1620void yyFlexLexer::yypop_buffer_state (void)
1621{
1622        if (!YY_CURRENT_BUFFER)
1623                return;
1624
1625        yy_delete_buffer(YY_CURRENT_BUFFER );
1626        YY_CURRENT_BUFFER_LVALUE = NULL;
1627        if ((yy_buffer_stack_top) > 0)
1628                --(yy_buffer_stack_top);
1629
1630        if (YY_CURRENT_BUFFER) {
1631                yy_load_buffer_state(  );
1632                (yy_did_buffer_switch_on_eof) = 1;
1633        }
1634}
1635
1636/* Allocates the stack if it does not exist.
1637 *  Guarantees space for at least one push.
1638 */
1639void yyFlexLexer::yyensure_buffer_stack(void)
1640{
1641        int num_to_alloc;
1642   
1643        if (!(yy_buffer_stack)) {
1644
1645                /* First allocation is just for 2 elements, since we don't know if this
1646                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1647                 * immediate realloc on the next call.
1648         */
1649                num_to_alloc = 1;
1650                (yy_buffer_stack) = (struct yy_buffer_state**)Meshalloc
1651                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
1652                                                                );
1653                if ( ! (yy_buffer_stack) )
1654                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1655                                                                 
1656                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1657                               
1658                (yy_buffer_stack_max) = num_to_alloc;
1659                (yy_buffer_stack_top) = 0;
1660                return;
1661        }
1662
1663        if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1664
1665                /* Increase the buffer to prepare for a possible push. */
1666                int grow_size = 8 /* arbitrary grow size */;
1667
1668                num_to_alloc = (yy_buffer_stack_max) + grow_size;
1669                (yy_buffer_stack) = (struct yy_buffer_state**)Meshrealloc
1670                                                                ((yy_buffer_stack),
1671                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
1672                                                                );
1673                if ( ! (yy_buffer_stack) )
1674                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1675
1676                /* zero only the new slots.*/
1677                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1678                (yy_buffer_stack_max) = num_to_alloc;
1679        }
1680}
1681
1682    void yyFlexLexer::yy_push_state( int new_state )
1683{
1684        if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1685                {
1686                yy_size_t new_size;
1687
1688                (yy_start_stack_depth) += YY_START_STACK_INCR;
1689                new_size = (yy_start_stack_depth) * sizeof( int );
1690
1691                if ( ! (yy_start_stack) )
1692                        (yy_start_stack) = (int *) Meshalloc(new_size  );
1693
1694                else
1695                        (yy_start_stack) = (int *) Meshrealloc((void *) (yy_start_stack),new_size  );
1696
1697                if ( ! (yy_start_stack) )
1698                        YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
1699                }
1700
1701        (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1702
1703        BEGIN(new_state);
1704}
1705
1706    void yyFlexLexer::yy_pop_state()
1707{
1708        if ( --(yy_start_stack_ptr) < 0 )
1709                YY_FATAL_ERROR( "start-condition stack underflow" );
1710
1711        BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1712}
1713
1714    int yyFlexLexer::yy_top_state()
1715{
1716        return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1717}
1718
1719#ifndef YY_EXIT_FAILURE
1720#define YY_EXIT_FAILURE 2
1721#endif
1722
1723void yyFlexLexer::LexerError( yyconst char msg[] )
1724{
1725        std::cerr << msg << std::endl;
1726        exit( YY_EXIT_FAILURE );
1727}
1728
1729/* Redefine yyless() so it works in section 3 code. */
1730
1731#undef yyless
1732#define yyless(n) \
1733        do \
1734                { \
1735                /* Undo effects of setting up yytext. */ \
1736        int yyless_macro_arg = (n); \
1737        YY_LESS_LINENO(yyless_macro_arg);\
1738                yytext[yyleng] = (yy_hold_char); \
1739                (yy_c_buf_p) = yytext + yyless_macro_arg; \
1740                (yy_hold_char) = *(yy_c_buf_p); \
1741                *(yy_c_buf_p) = '\0'; \
1742                yyleng = yyless_macro_arg; \
1743                } \
1744        while ( 0 )
1745
1746/* Accessor  methods (get/set functions) to struct members. */
1747
1748/*
1749 * Internal utility routines.
1750 */
1751
1752#ifndef yytext_ptr
1753static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1754{
1755        register int i;
1756        for ( i = 0; i < n; ++i )
1757                s1[i] = s2[i];
1758}
1759#endif
1760
1761#ifdef YY_NEED_STRLEN
1762static int yy_flex_strlen (yyconst char * s )
1763{
1764        register int n;
1765        for ( n = 0; s[n]; ++n )
1766                ;
1767
1768        return n;
1769}
1770#endif
1771
1772void *Meshalloc (yy_size_t  size )
1773{
1774        return (void *) malloc( size );
1775}
1776
1777void *Meshrealloc  (void * ptr, yy_size_t  size )
1778{
1779        /* The cast to (char *) in the following accommodates both
1780         * implementations that use char* generic pointers, and those
1781         * that use void* generic pointers.  It works with the latter
1782         * because both ANSI C and C++ allow castless assignment from
1783         * any pointer type to void*, and deal with argument conversions
1784         * as though doing an assignment.
1785         */
1786        return (void *) realloc( (char *) ptr, size );
1787}
1788
1789void Meshfree (void * ptr )
1790{
1791        free( (char *) ptr );   /* see Meshrealloc() for (char *) cast */
1792}
1793
1794#define YYTABLES_NAME "yytables"
1795
1796#line 95 "mesh-scanner.l"
1797
1798
1799
1800orbital::MeshScanner::MeshScanner(char const *command)
1801    : MeshFlexLexer(0, 0),
1802      m_input(command)
1803{
1804}
1805
1806orbital::MeshScanner::~MeshScanner()
1807{
1808}
1809
1810int orbital::MeshScanner::LexerInput(char* buf, int max_size)
1811{
1812    buf[0] = m_input[0];
1813    if (buf[0])
1814        ++m_input;
1815    return buf[0] ? 1 : 0;
1816}
1817
1818#ifdef yylex
1819#undef yylex
1820#endif
1821int MeshFlexLexer::yylex()
1822{
1823    std::cerr << "in MeshFlexLexer::yylex() !" << std::endl;
1824    return 0;
1825}
1826
1827int MeshFlexLexer::yywrap()
1828{
1829    return 1;
1830}
1831
1832
Note: See TracBrowser for help on using the repository browser.