first commit - working example - needs pointer type recognition (actualy more than...
[CppToLua.git] / lex.yy.c
blob42926c4391d627a0752b8b12bbf109ef69848da6
2 #line 3 "lex.yy.c"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 35
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
24 /* end standard C headers. */
26 /* flex integer type definitions */
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX (4294967295U)
84 #endif
86 #endif /* ! C99 */
88 #endif /* ! FLEXINT_H */
90 #ifdef __cplusplus
92 /* The "const" storage-class-modifier is valid. */
93 #define YY_USE_CONST
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
100 #define YY_USE_CONST
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
105 #ifdef YY_USE_CONST
106 #define yyconst const
107 #else
108 #define yyconst
109 #endif
111 /* Returned upon end-of-file. */
112 #define YY_NULL 0
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index. If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
117 * double cast.
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 /* Enter a start condition. This macro really ought to take a parameter,
122 * but we do it the disgusting crufty way forced on us by the ()-less
123 * definition of BEGIN.
125 #define BEGIN (yy_start) = 1 + 2 *
127 /* Translate the current start state into a value that can be later handed
128 * to BEGIN to return to the state. The YYSTATE alias is for lex
129 * compatibility.
131 #define YY_START (((yy_start) - 1) / 2)
132 #define YYSTATE YY_START
134 /* Action number for EOF rule of a given start state. */
135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 /* Special action meaning "start processing a new file". */
138 #define YY_NEW_FILE yyrestart(yyin )
140 #define YY_END_OF_BUFFER_CHAR 0
142 /* Size of default input buffer. */
143 #ifndef YY_BUF_SIZE
144 #ifdef __ia64__
145 /* On IA-64, the buffer size is 16k, not 8k.
146 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
147 * Ditto for the __ia64__ case accordingly.
149 #define YY_BUF_SIZE 32768
150 #else
151 #define YY_BUF_SIZE 16384
152 #endif /* __ia64__ */
153 #endif
155 /* The state buf must be large enough to hold one state per character in the main buffer.
157 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
159 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
160 #define YY_TYPEDEF_YY_BUFFER_STATE
161 typedef struct yy_buffer_state *YY_BUFFER_STATE;
162 #endif
164 extern int yyleng;
166 extern FILE *yyin, *yyout;
168 #define EOB_ACT_CONTINUE_SCAN 0
169 #define EOB_ACT_END_OF_FILE 1
170 #define EOB_ACT_LAST_MATCH 2
172 #define YY_LESS_LINENO(n)
174 /* Return all but the first "n" matched characters back to the input stream. */
175 #define yyless(n) \
176 do \
178 /* Undo effects of setting up yytext. */ \
179 int yyless_macro_arg = (n); \
180 YY_LESS_LINENO(yyless_macro_arg);\
181 *yy_cp = (yy_hold_char); \
182 YY_RESTORE_YY_MORE_OFFSET \
183 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
184 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
186 while ( 0 )
188 #define unput(c) yyunput( c, (yytext_ptr) )
190 #ifndef YY_TYPEDEF_YY_SIZE_T
191 #define YY_TYPEDEF_YY_SIZE_T
192 typedef size_t yy_size_t;
193 #endif
195 #ifndef YY_STRUCT_YY_BUFFER_STATE
196 #define YY_STRUCT_YY_BUFFER_STATE
197 struct yy_buffer_state
199 FILE *yy_input_file;
201 char *yy_ch_buf; /* input buffer */
202 char *yy_buf_pos; /* current position in input buffer */
204 /* Size of input buffer in bytes, not including room for EOB
205 * characters.
207 yy_size_t yy_buf_size;
209 /* Number of characters read into yy_ch_buf, not including EOB
210 * characters.
212 int yy_n_chars;
214 /* Whether we "own" the buffer - i.e., we know we created it,
215 * and can realloc() it to grow it, and should free() it to
216 * delete it.
218 int yy_is_our_buffer;
220 /* Whether this is an "interactive" input source; if so, and
221 * if we're using stdio for input, then we want to use getc()
222 * instead of fread(), to make sure we stop fetching input after
223 * each newline.
225 int yy_is_interactive;
227 /* Whether we're considered to be at the beginning of a line.
228 * If so, '^' rules will be active on the next match, otherwise
229 * not.
231 int yy_at_bol;
233 int yy_bs_lineno; /**< The line count. */
234 int yy_bs_column; /**< The column count. */
236 /* Whether to try to fill the input buffer when we reach the
237 * end of it.
239 int yy_fill_buffer;
241 int yy_buffer_status;
243 #define YY_BUFFER_NEW 0
244 #define YY_BUFFER_NORMAL 1
245 /* When an EOF's been seen but there's still some text to process
246 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
247 * shouldn't try reading from the input source any more. We might
248 * still have a bunch of tokens to match, though, because of
249 * possible backing-up.
251 * When we actually see the EOF, we change the status to "new"
252 * (via yyrestart()), so that the user can continue scanning by
253 * just pointing yyin at a new input file.
255 #define YY_BUFFER_EOF_PENDING 2
258 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
260 /* Stack of input buffers. */
261 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
262 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
263 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
265 /* We provide macros for accessing buffer states in case in the
266 * future we want to put the buffer states in a more general
267 * "scanner state".
269 * Returns the top of the stack, or NULL.
271 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
272 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
273 : NULL)
275 /* Same as previous macro, but useful when we know that the buffer stack is not
276 * NULL or when we need an lvalue. For internal use only.
278 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
280 /* yy_hold_char holds the character lost when yytext is formed. */
281 static char yy_hold_char;
282 static int yy_n_chars; /* number of characters read into yy_ch_buf */
283 int yyleng;
285 /* Points to current character in buffer. */
286 static char *yy_c_buf_p = (char *) 0;
287 static int yy_init = 0; /* whether we need to initialize */
288 static int yy_start = 0; /* start state number */
290 /* Flag which is used to allow yywrap()'s to do buffer switches
291 * instead of setting up a fresh yyin. A bit of a hack ...
293 static int yy_did_buffer_switch_on_eof;
295 void yyrestart (FILE *input_file );
296 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
297 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
298 void yy_delete_buffer (YY_BUFFER_STATE b );
299 void yy_flush_buffer (YY_BUFFER_STATE b );
300 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
301 void yypop_buffer_state (void );
303 static void yyensure_buffer_stack (void );
304 static void yy_load_buffer_state (void );
305 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
307 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
309 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
310 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
311 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
313 void *yyalloc (yy_size_t );
314 void *yyrealloc (void *,yy_size_t );
315 void yyfree (void * );
317 #define yy_new_buffer yy_create_buffer
319 #define yy_set_interactive(is_interactive) \
321 if ( ! YY_CURRENT_BUFFER ){ \
322 yyensure_buffer_stack (); \
323 YY_CURRENT_BUFFER_LVALUE = \
324 yy_create_buffer(yyin,YY_BUF_SIZE ); \
326 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
329 #define yy_set_bol(at_bol) \
331 if ( ! YY_CURRENT_BUFFER ){\
332 yyensure_buffer_stack (); \
333 YY_CURRENT_BUFFER_LVALUE = \
334 yy_create_buffer(yyin,YY_BUF_SIZE ); \
336 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
339 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
341 /* Begin user sect3 */
343 typedef unsigned char YY_CHAR;
345 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
347 typedef int yy_state_type;
349 extern int yylineno;
351 int yylineno = 1;
353 extern char *yytext;
354 #define yytext_ptr yytext
356 static yy_state_type yy_get_previous_state (void );
357 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
358 static int yy_get_next_buffer (void );
359 static void yy_fatal_error (yyconst char msg[] );
361 /* Done after the current pattern has been matched and before the
362 * corresponding action - sets up yytext.
364 #define YY_DO_BEFORE_ACTION \
365 (yytext_ptr) = yy_bp; \
366 yyleng = (size_t) (yy_cp - yy_bp); \
367 (yy_hold_char) = *yy_cp; \
368 *yy_cp = '\0'; \
369 (yy_c_buf_p) = yy_cp;
371 #define YY_NUM_RULES 8
372 #define YY_END_OF_BUFFER 9
373 /* This struct is not used in this scanner,
374 but its presence is necessary. */
375 struct yy_trans_info
377 flex_int32_t yy_verify;
378 flex_int32_t yy_nxt;
380 static yyconst flex_int16_t yy_accept[27] =
381 { 0,
382 0, 0, 9, 7, 4, 4, 2, 7, 3, 3,
383 4, 0, 5, 3, 3, 0, 0, 0, 5, 3,
384 0, 0, 6, 3, 1, 0
387 static yyconst flex_int32_t yy_ec[256] =
388 { 0,
389 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
390 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 2, 1, 1, 1, 1, 1, 1, 1, 5,
393 5, 6, 1, 5, 1, 1, 7, 8, 8, 8,
394 8, 8, 8, 8, 8, 8, 8, 1, 5, 1,
395 1, 1, 1, 1, 8, 8, 8, 8, 8, 8,
396 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
397 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
398 1, 1, 1, 1, 8, 1, 9, 8, 10, 8,
400 8, 8, 8, 8, 8, 8, 8, 11, 8, 8,
401 8, 8, 8, 8, 12, 8, 8, 8, 8, 8,
402 8, 8, 5, 1, 5, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1
419 static yyconst flex_int32_t yy_meta[13] =
420 { 0,
421 1, 2, 3, 1, 1, 1, 1, 4, 4, 4,
422 4, 4
425 static yyconst flex_int16_t yy_base[32] =
426 { 0,
427 0, 0, 43, 44, 0, 0, 44, 7, 0, 31,
428 0, 12, 0, 0, 27, 16, 0, 20, 0, 13,
429 0, 0, 44, 9, 0, 44, 26, 13, 29, 33,
433 static yyconst flex_int16_t yy_def[32] =
434 { 0,
435 26, 1, 26, 26, 27, 27, 26, 26, 28, 28,
436 27, 29, 30, 28, 28, 29, 16, 31, 30, 28,
437 16, 16, 26, 28, 28, 0, 26, 26, 26, 26,
441 static yyconst flex_int16_t yy_nxt[57] =
442 { 0,
443 4, 5, 6, 4, 7, 4, 8, 9, 9, 10,
444 9, 9, 12, 13, 17, 17, 14, 18, 17, 17,
445 25, 18, 22, 22, 24, 18, 23, 11, 11, 16,
446 16, 16, 16, 19, 19, 20, 19, 21, 21, 21,
447 21, 15, 26, 3, 26, 26, 26, 26, 26, 26,
448 26, 26, 26, 26, 26, 26
451 static yyconst flex_int16_t yy_chk[57] =
452 { 0,
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 8, 8, 12, 12, 28, 12, 16, 16,
455 24, 16, 18, 18, 20, 18, 18, 27, 27, 29,
456 29, 29, 29, 30, 30, 15, 30, 31, 31, 31,
457 31, 10, 3, 26, 26, 26, 26, 26, 26, 26,
458 26, 26, 26, 26, 26, 26
461 static yy_state_type yy_last_accepting_state;
462 static char *yy_last_accepting_cpos;
464 extern int yy_flex_debug;
465 int yy_flex_debug = 0;
467 /* The intent behind this definition is that it'll catch
468 * any uses of REJECT which flex missed.
470 #define REJECT reject_used_but_not_detected
471 #define yymore() yymore_used_but_not_detected
472 #define YY_MORE_ADJ 0
473 #define YY_RESTORE_YY_MORE_OFFSET
474 char *yytext;
475 #line 1 "cpptolua.l"
476 #line 2 "cpptolua.l"
477 #include "y.tab.h"
478 #include <stdlib.h>
479 void yyerror(char *);
480 int idf(char *s);
481 #line 482 "lex.yy.c"
483 #define INITIAL 0
485 #ifndef YY_NO_UNISTD_H
486 /* Special case for "unistd.h", since it is non-ANSI. We include it way
487 * down here because we want the user's section 1 to have been scanned first.
488 * The user has a chance to override it with an option.
490 #include <unistd.h>
491 #endif
493 #ifndef YY_EXTRA_TYPE
494 #define YY_EXTRA_TYPE void *
495 #endif
497 static int yy_init_globals (void );
499 /* Accessor methods to globals.
500 These are made visible to non-reentrant scanners for convenience. */
502 int yylex_destroy (void );
504 int yyget_debug (void );
506 void yyset_debug (int debug_flag );
508 YY_EXTRA_TYPE yyget_extra (void );
510 void yyset_extra (YY_EXTRA_TYPE user_defined );
512 FILE *yyget_in (void );
514 void yyset_in (FILE * in_str );
516 FILE *yyget_out (void );
518 void yyset_out (FILE * out_str );
520 int yyget_leng (void );
522 char *yyget_text (void );
524 int yyget_lineno (void );
526 void yyset_lineno (int line_number );
528 /* Macros after this point can all be overridden by user definitions in
529 * section 1.
532 #ifndef YY_SKIP_YYWRAP
533 #ifdef __cplusplus
534 extern "C" int yywrap (void );
535 #else
536 extern int yywrap (void );
537 #endif
538 #endif
540 static void yyunput (int c,char *buf_ptr );
542 #ifndef yytext_ptr
543 static void yy_flex_strncpy (char *,yyconst char *,int );
544 #endif
546 #ifdef YY_NEED_STRLEN
547 static int yy_flex_strlen (yyconst char * );
548 #endif
550 #ifndef YY_NO_INPUT
552 #ifdef __cplusplus
553 static int yyinput (void );
554 #else
555 static int input (void );
556 #endif
558 #endif
560 /* Amount of stuff to slurp up with each read. */
561 #ifndef YY_READ_BUF_SIZE
562 #ifdef __ia64__
563 /* On IA-64, the buffer size is 16k, not 8k */
564 #define YY_READ_BUF_SIZE 16384
565 #else
566 #define YY_READ_BUF_SIZE 8192
567 #endif /* __ia64__ */
568 #endif
570 /* Copy whatever the last rule matched to the standard output. */
571 #ifndef ECHO
572 /* This used to be an fputs(), but since the string might contain NUL's,
573 * we now use fwrite().
575 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
576 #endif
578 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
579 * is returned in "result".
581 #ifndef YY_INPUT
582 #define YY_INPUT(buf,result,max_size) \
583 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
585 int c = '*'; \
586 size_t n; \
587 for ( n = 0; n < max_size && \
588 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
589 buf[n] = (char) c; \
590 if ( c == '\n' ) \
591 buf[n++] = (char) c; \
592 if ( c == EOF && ferror( yyin ) ) \
593 YY_FATAL_ERROR( "input in flex scanner failed" ); \
594 result = n; \
596 else \
598 errno=0; \
599 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
601 if( errno != EINTR) \
603 YY_FATAL_ERROR( "input in flex scanner failed" ); \
604 break; \
606 errno=0; \
607 clearerr(yyin); \
612 #endif
614 /* No semi-colon after return; correct usage is to write "yyterminate();" -
615 * we don't want an extra ';' after the "return" because that will cause
616 * some compilers to complain about unreachable statements.
618 #ifndef yyterminate
619 #define yyterminate() return YY_NULL
620 #endif
622 /* Number of entries by which start-condition stack grows. */
623 #ifndef YY_START_STACK_INCR
624 #define YY_START_STACK_INCR 25
625 #endif
627 /* Report a fatal error. */
628 #ifndef YY_FATAL_ERROR
629 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
630 #endif
632 /* end tables serialization structures and prototypes */
634 /* Default declaration of generated scanner - a define so the user can
635 * easily add parameters.
637 #ifndef YY_DECL
638 #define YY_DECL_IS_OURS 1
640 extern int yylex (void);
642 #define YY_DECL int yylex (void)
643 #endif /* !YY_DECL */
645 /* Code executed at the beginning of each rule, after yytext and yyleng
646 * have been set up.
648 #ifndef YY_USER_ACTION
649 #define YY_USER_ACTION
650 #endif
652 /* Code executed at the end of each rule. */
653 #ifndef YY_BREAK
654 #define YY_BREAK break;
655 #endif
657 #define YY_RULE_SETUP \
658 YY_USER_ACTION
660 /** The main scanner function which does all the work.
662 YY_DECL
664 register yy_state_type yy_current_state;
665 register char *yy_cp, *yy_bp;
666 register int yy_act;
668 #line 8 "cpptolua.l"
671 #line 672 "lex.yy.c"
673 if ( !(yy_init) )
675 (yy_init) = 1;
677 #ifdef YY_USER_INIT
678 YY_USER_INIT;
679 #endif
681 if ( ! (yy_start) )
682 (yy_start) = 1; /* first start state */
684 if ( ! yyin )
685 yyin = stdin;
687 if ( ! yyout )
688 yyout = stdout;
690 if ( ! YY_CURRENT_BUFFER ) {
691 yyensure_buffer_stack ();
692 YY_CURRENT_BUFFER_LVALUE =
693 yy_create_buffer(yyin,YY_BUF_SIZE );
696 yy_load_buffer_state( );
699 while ( 1 ) /* loops until end-of-file is reached */
701 yy_cp = (yy_c_buf_p);
703 /* Support of yytext. */
704 *yy_cp = (yy_hold_char);
706 /* yy_bp points to the position in yy_ch_buf of the start of
707 * the current run.
709 yy_bp = yy_cp;
711 yy_current_state = (yy_start);
712 yy_match:
715 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
716 if ( yy_accept[yy_current_state] )
718 (yy_last_accepting_state) = yy_current_state;
719 (yy_last_accepting_cpos) = yy_cp;
721 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
723 yy_current_state = (int) yy_def[yy_current_state];
724 if ( yy_current_state >= 27 )
725 yy_c = yy_meta[(unsigned int) yy_c];
727 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
728 ++yy_cp;
730 while ( yy_base[yy_current_state] != 44 );
732 yy_find_action:
733 yy_act = yy_accept[yy_current_state];
734 if ( yy_act == 0 )
735 { /* have to back up */
736 yy_cp = (yy_last_accepting_cpos);
737 yy_current_state = (yy_last_accepting_state);
738 yy_act = yy_accept[yy_current_state];
741 YY_DO_BEFORE_ACTION;
743 do_action: /* This label is used only to access EOF actions. */
745 switch ( yy_act )
746 { /* beginning of action switch */
747 case 0: /* must back up */
748 /* undo the effects of YY_DO_BEFORE_ACTION */
749 *yy_cp = (yy_hold_char);
750 yy_cp = (yy_last_accepting_cpos);
751 yy_current_state = (yy_last_accepting_state);
752 goto yy_find_action;
754 case 1:
755 YY_RULE_SETUP
756 #line 10 "cpptolua.l"
757 { return CLASS; }
758 YY_BREAK
759 case 2:
760 YY_RULE_SETUP
761 #line 11 "cpptolua.l"
763 yylval.name = strdup(yytext);
764 #ifdef DEBUG
765 printf("read: %c\n", *yytext);
766 #endif
767 return *yytext;
769 YY_BREAK
770 /* identifiers */
771 case 3:
772 YY_RULE_SETUP
773 #line 21 "cpptolua.l"
775 yylval.name = strdup(yytext);
776 #ifdef DEBUG
777 printf("read: %s\n", yytext);
778 printf("idf: %i\n", idf(yytext));
779 #endif
780 return idf(yytext);
782 YY_BREAK
783 /* skip whitespace */
784 case 4:
785 /* rule 4 can match eol */
786 YY_RULE_SETUP
787 #line 31 "cpptolua.l"
789 YY_BREAK
790 /* skip comments */
791 case 5:
792 YY_RULE_SETUP
793 #line 34 "cpptolua.l"
795 YY_BREAK
796 case 6:
797 /* rule 6 can match eol */
798 YY_RULE_SETUP
799 #line 35 "cpptolua.l"
801 YY_BREAK
802 /* anything else is an error */
803 case 7:
804 YY_RULE_SETUP
805 #line 38 "cpptolua.l"
807 printf("read: '%c'\n", *yytext);
808 yyerror((char *)"invalid character");
810 YY_BREAK
811 case 8:
812 YY_RULE_SETUP
813 #line 43 "cpptolua.l"
814 ECHO;
815 YY_BREAK
816 #line 817 "lex.yy.c"
817 case YY_STATE_EOF(INITIAL):
818 yyterminate();
820 case YY_END_OF_BUFFER:
822 /* Amount of text matched not including the EOB char. */
823 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
825 /* Undo the effects of YY_DO_BEFORE_ACTION. */
826 *yy_cp = (yy_hold_char);
827 YY_RESTORE_YY_MORE_OFFSET
829 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
831 /* We're scanning a new file or input source. It's
832 * possible that this happened because the user
833 * just pointed yyin at a new source and called
834 * yylex(). If so, then we have to assure
835 * consistency between YY_CURRENT_BUFFER and our
836 * globals. Here is the right place to do so, because
837 * this is the first action (other than possibly a
838 * back-up) that will match for the new input source.
840 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
841 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
842 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
845 /* Note that here we test for yy_c_buf_p "<=" to the position
846 * of the first EOB in the buffer, since yy_c_buf_p will
847 * already have been incremented past the NUL character
848 * (since all states make transitions on EOB to the
849 * end-of-buffer state). Contrast this with the test
850 * in input().
852 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
853 { /* This was really a NUL. */
854 yy_state_type yy_next_state;
856 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
858 yy_current_state = yy_get_previous_state( );
860 /* Okay, we're now positioned to make the NUL
861 * transition. We couldn't have
862 * yy_get_previous_state() go ahead and do it
863 * for us because it doesn't know how to deal
864 * with the possibility of jamming (and we don't
865 * want to build jamming into it because then it
866 * will run more slowly).
869 yy_next_state = yy_try_NUL_trans( yy_current_state );
871 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
873 if ( yy_next_state )
875 /* Consume the NUL. */
876 yy_cp = ++(yy_c_buf_p);
877 yy_current_state = yy_next_state;
878 goto yy_match;
881 else
883 yy_cp = (yy_c_buf_p);
884 goto yy_find_action;
888 else switch ( yy_get_next_buffer( ) )
890 case EOB_ACT_END_OF_FILE:
892 (yy_did_buffer_switch_on_eof) = 0;
894 if ( yywrap( ) )
896 /* Note: because we've taken care in
897 * yy_get_next_buffer() to have set up
898 * yytext, we can now set up
899 * yy_c_buf_p so that if some total
900 * hoser (like flex itself) wants to
901 * call the scanner after we return the
902 * YY_NULL, it'll still work - another
903 * YY_NULL will get returned.
905 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
907 yy_act = YY_STATE_EOF(YY_START);
908 goto do_action;
911 else
913 if ( ! (yy_did_buffer_switch_on_eof) )
914 YY_NEW_FILE;
916 break;
919 case EOB_ACT_CONTINUE_SCAN:
920 (yy_c_buf_p) =
921 (yytext_ptr) + yy_amount_of_matched_text;
923 yy_current_state = yy_get_previous_state( );
925 yy_cp = (yy_c_buf_p);
926 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
927 goto yy_match;
929 case EOB_ACT_LAST_MATCH:
930 (yy_c_buf_p) =
931 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
933 yy_current_state = yy_get_previous_state( );
935 yy_cp = (yy_c_buf_p);
936 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
937 goto yy_find_action;
939 break;
942 default:
943 YY_FATAL_ERROR(
944 "fatal flex scanner internal error--no action found" );
945 } /* end of action switch */
946 } /* end of scanning one token */
947 } /* end of yylex */
949 /* yy_get_next_buffer - try to read in a new buffer
951 * Returns a code representing an action:
952 * EOB_ACT_LAST_MATCH -
953 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
954 * EOB_ACT_END_OF_FILE - end of file
956 static int yy_get_next_buffer (void)
958 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
959 register char *source = (yytext_ptr);
960 register int number_to_move, i;
961 int ret_val;
963 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
964 YY_FATAL_ERROR(
965 "fatal flex scanner internal error--end of buffer missed" );
967 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
968 { /* Don't try to fill the buffer, so this is an EOF. */
969 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
971 /* We matched a single character, the EOB, so
972 * treat this as a final EOF.
974 return EOB_ACT_END_OF_FILE;
977 else
979 /* We matched some text prior to the EOB, first
980 * process it.
982 return EOB_ACT_LAST_MATCH;
986 /* Try to read more data. */
988 /* First move last chars to start of buffer. */
989 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
991 for ( i = 0; i < number_to_move; ++i )
992 *(dest++) = *(source++);
994 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
995 /* don't do the read, it's not guaranteed to return an EOF,
996 * just force an EOF
998 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1000 else
1002 int num_to_read =
1003 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1005 while ( num_to_read <= 0 )
1006 { /* Not enough room in the buffer - grow it. */
1008 /* just a shorter name for the current buffer */
1009 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1011 int yy_c_buf_p_offset =
1012 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1014 if ( b->yy_is_our_buffer )
1016 int new_size = b->yy_buf_size * 2;
1018 if ( new_size <= 0 )
1019 b->yy_buf_size += b->yy_buf_size / 8;
1020 else
1021 b->yy_buf_size *= 2;
1023 b->yy_ch_buf = (char *)
1024 /* Include room in for 2 EOB chars. */
1025 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1027 else
1028 /* Can't grow it, we don't own it. */
1029 b->yy_ch_buf = 0;
1031 if ( ! b->yy_ch_buf )
1032 YY_FATAL_ERROR(
1033 "fatal error - scanner input buffer overflow" );
1035 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1037 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1038 number_to_move - 1;
1042 if ( num_to_read > YY_READ_BUF_SIZE )
1043 num_to_read = YY_READ_BUF_SIZE;
1045 /* Read in more data. */
1046 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1047 (yy_n_chars), (size_t) num_to_read );
1049 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1052 if ( (yy_n_chars) == 0 )
1054 if ( number_to_move == YY_MORE_ADJ )
1056 ret_val = EOB_ACT_END_OF_FILE;
1057 yyrestart(yyin );
1060 else
1062 ret_val = EOB_ACT_LAST_MATCH;
1063 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1064 YY_BUFFER_EOF_PENDING;
1068 else
1069 ret_val = EOB_ACT_CONTINUE_SCAN;
1071 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1072 /* Extend the array by 50%, plus the number we really need. */
1073 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1074 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1075 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1076 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1079 (yy_n_chars) += number_to_move;
1080 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1081 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1083 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1085 return ret_val;
1088 /* yy_get_previous_state - get the state just before the EOB char was reached */
1090 static yy_state_type yy_get_previous_state (void)
1092 register yy_state_type yy_current_state;
1093 register char *yy_cp;
1095 yy_current_state = (yy_start);
1097 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1099 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1100 if ( yy_accept[yy_current_state] )
1102 (yy_last_accepting_state) = yy_current_state;
1103 (yy_last_accepting_cpos) = yy_cp;
1105 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1107 yy_current_state = (int) yy_def[yy_current_state];
1108 if ( yy_current_state >= 27 )
1109 yy_c = yy_meta[(unsigned int) yy_c];
1111 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1114 return yy_current_state;
1117 /* yy_try_NUL_trans - try to make a transition on the NUL character
1119 * synopsis
1120 * next_state = yy_try_NUL_trans( current_state );
1122 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1124 register int yy_is_jam;
1125 register char *yy_cp = (yy_c_buf_p);
1127 register YY_CHAR yy_c = 1;
1128 if ( yy_accept[yy_current_state] )
1130 (yy_last_accepting_state) = yy_current_state;
1131 (yy_last_accepting_cpos) = yy_cp;
1133 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1135 yy_current_state = (int) yy_def[yy_current_state];
1136 if ( yy_current_state >= 27 )
1137 yy_c = yy_meta[(unsigned int) yy_c];
1139 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1140 yy_is_jam = (yy_current_state == 26);
1142 return yy_is_jam ? 0 : yy_current_state;
1145 static void yyunput (int c, register char * yy_bp )
1147 register char *yy_cp;
1149 yy_cp = (yy_c_buf_p);
1151 /* undo effects of setting up yytext */
1152 *yy_cp = (yy_hold_char);
1154 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1155 { /* need to shift things up to make room */
1156 /* +2 for EOB chars. */
1157 register int number_to_move = (yy_n_chars) + 2;
1158 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1159 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1160 register char *source =
1161 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1163 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1164 *--dest = *--source;
1166 yy_cp += (int) (dest - source);
1167 yy_bp += (int) (dest - source);
1168 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1169 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1171 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1172 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1175 *--yy_cp = (char) c;
1177 (yytext_ptr) = yy_bp;
1178 (yy_hold_char) = *yy_cp;
1179 (yy_c_buf_p) = yy_cp;
1182 #ifndef YY_NO_INPUT
1183 #ifdef __cplusplus
1184 static int yyinput (void)
1185 #else
1186 static int input (void)
1187 #endif
1190 int c;
1192 *(yy_c_buf_p) = (yy_hold_char);
1194 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1196 /* yy_c_buf_p now points to the character we want to return.
1197 * If this occurs *before* the EOB characters, then it's a
1198 * valid NUL; if not, then we've hit the end of the buffer.
1200 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1201 /* This was really a NUL. */
1202 *(yy_c_buf_p) = '\0';
1204 else
1205 { /* need more input */
1206 int offset = (yy_c_buf_p) - (yytext_ptr);
1207 ++(yy_c_buf_p);
1209 switch ( yy_get_next_buffer( ) )
1211 case EOB_ACT_LAST_MATCH:
1212 /* This happens because yy_g_n_b()
1213 * sees that we've accumulated a
1214 * token and flags that we need to
1215 * try matching the token before
1216 * proceeding. But for input(),
1217 * there's no matching to consider.
1218 * So convert the EOB_ACT_LAST_MATCH
1219 * to EOB_ACT_END_OF_FILE.
1222 /* Reset buffer status. */
1223 yyrestart(yyin );
1225 /*FALLTHROUGH*/
1227 case EOB_ACT_END_OF_FILE:
1229 if ( yywrap( ) )
1230 return EOF;
1232 if ( ! (yy_did_buffer_switch_on_eof) )
1233 YY_NEW_FILE;
1234 #ifdef __cplusplus
1235 return yyinput();
1236 #else
1237 return input();
1238 #endif
1241 case EOB_ACT_CONTINUE_SCAN:
1242 (yy_c_buf_p) = (yytext_ptr) + offset;
1243 break;
1248 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1249 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1250 (yy_hold_char) = *++(yy_c_buf_p);
1252 return c;
1254 #endif /* ifndef YY_NO_INPUT */
1256 /** Immediately switch to a different input stream.
1257 * @param input_file A readable stream.
1259 * @note This function does not reset the start condition to @c INITIAL .
1261 void yyrestart (FILE * input_file )
1264 if ( ! YY_CURRENT_BUFFER ){
1265 yyensure_buffer_stack ();
1266 YY_CURRENT_BUFFER_LVALUE =
1267 yy_create_buffer(yyin,YY_BUF_SIZE );
1270 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1271 yy_load_buffer_state( );
1274 /** Switch to a different input buffer.
1275 * @param new_buffer The new input buffer.
1278 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1281 /* TODO. We should be able to replace this entire function body
1282 * with
1283 * yypop_buffer_state();
1284 * yypush_buffer_state(new_buffer);
1286 yyensure_buffer_stack ();
1287 if ( YY_CURRENT_BUFFER == new_buffer )
1288 return;
1290 if ( YY_CURRENT_BUFFER )
1292 /* Flush out information for old buffer. */
1293 *(yy_c_buf_p) = (yy_hold_char);
1294 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1295 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1298 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1299 yy_load_buffer_state( );
1301 /* We don't actually know whether we did this switch during
1302 * EOF (yywrap()) processing, but the only time this flag
1303 * is looked at is after yywrap() is called, so it's safe
1304 * to go ahead and always set it.
1306 (yy_did_buffer_switch_on_eof) = 1;
1309 static void yy_load_buffer_state (void)
1311 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1312 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1313 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1314 (yy_hold_char) = *(yy_c_buf_p);
1317 /** Allocate and initialize an input buffer state.
1318 * @param file A readable stream.
1319 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1321 * @return the allocated buffer state.
1323 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1325 YY_BUFFER_STATE b;
1327 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1328 if ( ! b )
1329 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1331 b->yy_buf_size = size;
1333 /* yy_ch_buf has to be 2 characters longer than the size given because
1334 * we need to put in 2 end-of-buffer characters.
1336 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1337 if ( ! b->yy_ch_buf )
1338 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1340 b->yy_is_our_buffer = 1;
1342 yy_init_buffer(b,file );
1344 return b;
1347 /** Destroy the buffer.
1348 * @param b a buffer created with yy_create_buffer()
1351 void yy_delete_buffer (YY_BUFFER_STATE b )
1354 if ( ! b )
1355 return;
1357 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1358 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1360 if ( b->yy_is_our_buffer )
1361 yyfree((void *) b->yy_ch_buf );
1363 yyfree((void *) b );
1366 #ifndef __cplusplus
1367 extern int isatty (int );
1368 #endif /* __cplusplus */
1370 /* Initializes or reinitializes a buffer.
1371 * This function is sometimes called more than once on the same buffer,
1372 * such as during a yyrestart() or at EOF.
1374 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1377 int oerrno = errno;
1379 yy_flush_buffer(b );
1381 b->yy_input_file = file;
1382 b->yy_fill_buffer = 1;
1384 /* If b is the current buffer, then yy_init_buffer was _probably_
1385 * called from yyrestart() or through yy_get_next_buffer.
1386 * In that case, we don't want to reset the lineno or column.
1388 if (b != YY_CURRENT_BUFFER){
1389 b->yy_bs_lineno = 1;
1390 b->yy_bs_column = 0;
1393 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1395 errno = oerrno;
1398 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1399 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1402 void yy_flush_buffer (YY_BUFFER_STATE b )
1404 if ( ! b )
1405 return;
1407 b->yy_n_chars = 0;
1409 /* We always need two end-of-buffer characters. The first causes
1410 * a transition to the end-of-buffer state. The second causes
1411 * a jam in that state.
1413 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1414 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1416 b->yy_buf_pos = &b->yy_ch_buf[0];
1418 b->yy_at_bol = 1;
1419 b->yy_buffer_status = YY_BUFFER_NEW;
1421 if ( b == YY_CURRENT_BUFFER )
1422 yy_load_buffer_state( );
1425 /** Pushes the new state onto the stack. The new state becomes
1426 * the current state. This function will allocate the stack
1427 * if necessary.
1428 * @param new_buffer The new state.
1431 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1433 if (new_buffer == NULL)
1434 return;
1436 yyensure_buffer_stack();
1438 /* This block is copied from yy_switch_to_buffer. */
1439 if ( YY_CURRENT_BUFFER )
1441 /* Flush out information for old buffer. */
1442 *(yy_c_buf_p) = (yy_hold_char);
1443 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1444 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1447 /* Only push if top exists. Otherwise, replace top. */
1448 if (YY_CURRENT_BUFFER)
1449 (yy_buffer_stack_top)++;
1450 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1452 /* copied from yy_switch_to_buffer. */
1453 yy_load_buffer_state( );
1454 (yy_did_buffer_switch_on_eof) = 1;
1457 /** Removes and deletes the top of the stack, if present.
1458 * The next element becomes the new top.
1461 void yypop_buffer_state (void)
1463 if (!YY_CURRENT_BUFFER)
1464 return;
1466 yy_delete_buffer(YY_CURRENT_BUFFER );
1467 YY_CURRENT_BUFFER_LVALUE = NULL;
1468 if ((yy_buffer_stack_top) > 0)
1469 --(yy_buffer_stack_top);
1471 if (YY_CURRENT_BUFFER) {
1472 yy_load_buffer_state( );
1473 (yy_did_buffer_switch_on_eof) = 1;
1477 /* Allocates the stack if it does not exist.
1478 * Guarantees space for at least one push.
1480 static void yyensure_buffer_stack (void)
1482 int num_to_alloc;
1484 if (!(yy_buffer_stack)) {
1486 /* First allocation is just for 2 elements, since we don't know if this
1487 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1488 * immediate realloc on the next call.
1490 num_to_alloc = 1;
1491 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1492 (num_to_alloc * sizeof(struct yy_buffer_state*)
1494 if ( ! (yy_buffer_stack) )
1495 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1497 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1499 (yy_buffer_stack_max) = num_to_alloc;
1500 (yy_buffer_stack_top) = 0;
1501 return;
1504 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1506 /* Increase the buffer to prepare for a possible push. */
1507 int grow_size = 8 /* arbitrary grow size */;
1509 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1510 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1511 ((yy_buffer_stack),
1512 num_to_alloc * sizeof(struct yy_buffer_state*)
1514 if ( ! (yy_buffer_stack) )
1515 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1517 /* zero only the new slots.*/
1518 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1519 (yy_buffer_stack_max) = num_to_alloc;
1523 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1524 * @param base the character buffer
1525 * @param size the size in bytes of the character buffer
1527 * @return the newly allocated buffer state object.
1529 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1531 YY_BUFFER_STATE b;
1533 if ( size < 2 ||
1534 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1535 base[size-1] != YY_END_OF_BUFFER_CHAR )
1536 /* They forgot to leave room for the EOB's. */
1537 return 0;
1539 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1540 if ( ! b )
1541 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1543 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1544 b->yy_buf_pos = b->yy_ch_buf = base;
1545 b->yy_is_our_buffer = 0;
1546 b->yy_input_file = 0;
1547 b->yy_n_chars = b->yy_buf_size;
1548 b->yy_is_interactive = 0;
1549 b->yy_at_bol = 1;
1550 b->yy_fill_buffer = 0;
1551 b->yy_buffer_status = YY_BUFFER_NEW;
1553 yy_switch_to_buffer(b );
1555 return b;
1558 /** Setup the input buffer state to scan a string. The next call to yylex() will
1559 * scan from a @e copy of @a str.
1560 * @param yystr a NUL-terminated string to scan
1562 * @return the newly allocated buffer state object.
1563 * @note If you want to scan bytes that may contain NUL values, then use
1564 * yy_scan_bytes() instead.
1566 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1569 return yy_scan_bytes(yystr,strlen(yystr) );
1572 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1573 * scan from a @e copy of @a bytes.
1574 * @param yybytes the byte buffer to scan
1575 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1577 * @return the newly allocated buffer state object.
1579 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1581 YY_BUFFER_STATE b;
1582 char *buf;
1583 yy_size_t n;
1584 int i;
1586 /* Get memory for full buffer, including space for trailing EOB's. */
1587 n = _yybytes_len + 2;
1588 buf = (char *) yyalloc(n );
1589 if ( ! buf )
1590 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1592 for ( i = 0; i < _yybytes_len; ++i )
1593 buf[i] = yybytes[i];
1595 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1597 b = yy_scan_buffer(buf,n );
1598 if ( ! b )
1599 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1601 /* It's okay to grow etc. this buffer, and we should throw it
1602 * away when we're done.
1604 b->yy_is_our_buffer = 1;
1606 return b;
1609 #ifndef YY_EXIT_FAILURE
1610 #define YY_EXIT_FAILURE 2
1611 #endif
1613 static void yy_fatal_error (yyconst char* msg )
1615 (void) fprintf( stderr, "%s\n", msg );
1616 exit( YY_EXIT_FAILURE );
1619 /* Redefine yyless() so it works in section 3 code. */
1621 #undef yyless
1622 #define yyless(n) \
1623 do \
1625 /* Undo effects of setting up yytext. */ \
1626 int yyless_macro_arg = (n); \
1627 YY_LESS_LINENO(yyless_macro_arg);\
1628 yytext[yyleng] = (yy_hold_char); \
1629 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1630 (yy_hold_char) = *(yy_c_buf_p); \
1631 *(yy_c_buf_p) = '\0'; \
1632 yyleng = yyless_macro_arg; \
1634 while ( 0 )
1636 /* Accessor methods (get/set functions) to struct members. */
1638 /** Get the current line number.
1641 int yyget_lineno (void)
1644 return yylineno;
1647 /** Get the input stream.
1650 FILE *yyget_in (void)
1652 return yyin;
1655 /** Get the output stream.
1658 FILE *yyget_out (void)
1660 return yyout;
1663 /** Get the length of the current token.
1666 int yyget_leng (void)
1668 return yyleng;
1671 /** Get the current token.
1675 char *yyget_text (void)
1677 return yytext;
1680 /** Set the current line number.
1681 * @param line_number
1684 void yyset_lineno (int line_number )
1687 yylineno = line_number;
1690 /** Set the input stream. This does not discard the current
1691 * input buffer.
1692 * @param in_str A readable stream.
1694 * @see yy_switch_to_buffer
1696 void yyset_in (FILE * in_str )
1698 yyin = in_str ;
1701 void yyset_out (FILE * out_str )
1703 yyout = out_str ;
1706 int yyget_debug (void)
1708 return yy_flex_debug;
1711 void yyset_debug (int bdebug )
1713 yy_flex_debug = bdebug ;
1716 static int yy_init_globals (void)
1718 /* Initialization is the same as for the non-reentrant scanner.
1719 * This function is called from yylex_destroy(), so don't allocate here.
1722 (yy_buffer_stack) = 0;
1723 (yy_buffer_stack_top) = 0;
1724 (yy_buffer_stack_max) = 0;
1725 (yy_c_buf_p) = (char *) 0;
1726 (yy_init) = 0;
1727 (yy_start) = 0;
1729 /* Defined in main.c */
1730 #ifdef YY_STDINIT
1731 yyin = stdin;
1732 yyout = stdout;
1733 #else
1734 yyin = (FILE *) 0;
1735 yyout = (FILE *) 0;
1736 #endif
1738 /* For future reference: Set errno on error, since we are called by
1739 * yylex_init()
1741 return 0;
1744 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1745 int yylex_destroy (void)
1748 /* Pop the buffer stack, destroying each element. */
1749 while(YY_CURRENT_BUFFER){
1750 yy_delete_buffer(YY_CURRENT_BUFFER );
1751 YY_CURRENT_BUFFER_LVALUE = NULL;
1752 yypop_buffer_state();
1755 /* Destroy the stack itself. */
1756 yyfree((yy_buffer_stack) );
1757 (yy_buffer_stack) = NULL;
1759 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1760 * yylex() is called, initialization will occur. */
1761 yy_init_globals( );
1763 return 0;
1767 * Internal utility routines.
1770 #ifndef yytext_ptr
1771 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1773 register int i;
1774 for ( i = 0; i < n; ++i )
1775 s1[i] = s2[i];
1777 #endif
1779 #ifdef YY_NEED_STRLEN
1780 static int yy_flex_strlen (yyconst char * s )
1782 register int n;
1783 for ( n = 0; s[n]; ++n )
1786 return n;
1788 #endif
1790 void *yyalloc (yy_size_t size )
1792 return (void *) malloc( size );
1795 void *yyrealloc (void * ptr, yy_size_t size )
1797 /* The cast to (char *) in the following accommodates both
1798 * implementations that use char* generic pointers, and those
1799 * that use void* generic pointers. It works with the latter
1800 * because both ANSI C and C++ allow castless assignment from
1801 * any pointer type to void*, and deal with argument conversions
1802 * as though doing an assignment.
1804 return (void *) realloc( (char *) ptr, size );
1807 void yyfree (void * ptr )
1809 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1812 #define YYTABLES_NAME "yytables"
1814 #line 43 "cpptolua.l"
1818 int yywrap(void) {
1819 return 1;
1822 int idf(char *s)
1824 char types[][99] = {"int", "float", ""};
1825 int i;
1826 for(i = 0; types[i][0]; i++) {
1827 if(!strcmp(types[i], s)) {
1828 return TYPE;
1831 return IDF;