zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Tokenizer.cpp
Go to the documentation of this file.
1 #line 16 "./Tokenizer.l"
2 //
3 // Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
6 //
7 
8 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
9 
10 
11 
12 #line 13 "./Tokenizer.cpp"
13 
14 #define YY_INT_ALIGNED short int
15 
16 /* A lexical scanner generated by flex */
17 
18 #define FLEX_SCANNER
19 #define YY_FLEX_MAJOR_VERSION 2
20 #define YY_FLEX_MINOR_VERSION 5
21 #define YY_FLEX_SUBMINOR_VERSION 35
22 #if YY_FLEX_SUBMINOR_VERSION > 0
23 #define FLEX_BETA
24 #endif
25 
26 /* First, we deal with platform-specific or compiler-specific issues. */
27 
28 /* begin standard C headers. */
29 #include <stdio.h>
30 #include <string.h>
31 #include <errno.h>
32 #include <stdlib.h>
33 
34 /* end standard C headers. */
35 
36 /* flex integer type definitions */
37 
38 #ifndef FLEXINT_H
39 #define FLEXINT_H
40 
41 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
42 
43 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
44 
45 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
46  * if you want the limit (max/min) macros for int types.
47  */
48 #ifndef __STDC_LIMIT_MACROS
49 #define __STDC_LIMIT_MACROS 1
50 #endif
51 
52 #include <inttypes.h>
53 typedef int8_t flex_int8_t;
54 typedef uint8_t flex_uint8_t;
55 typedef int16_t flex_int16_t;
56 typedef uint16_t flex_uint16_t;
57 typedef int32_t flex_int32_t;
58 typedef uint32_t flex_uint32_t;
59 typedef uint64_t flex_uint64_t;
60 #else
61 typedef signed char flex_int8_t;
62 typedef short int flex_int16_t;
63 typedef int flex_int32_t;
64 typedef unsigned char flex_uint8_t;
65 typedef unsigned short int flex_uint16_t;
66 typedef unsigned int flex_uint32_t;
67 #endif /* ! C99 */
68 
69 /* Limits of integral types. */
70 #ifndef INT8_MIN
71 #define INT8_MIN (-128)
72 #endif
73 #ifndef INT16_MIN
74 #define INT16_MIN (-32767-1)
75 #endif
76 #ifndef INT32_MIN
77 #define INT32_MIN (-2147483647-1)
78 #endif
79 #ifndef INT8_MAX
80 #define INT8_MAX (127)
81 #endif
82 #ifndef INT16_MAX
83 #define INT16_MAX (32767)
84 #endif
85 #ifndef INT32_MAX
86 #define INT32_MAX (2147483647)
87 #endif
88 #ifndef UINT8_MAX
89 #define UINT8_MAX (255U)
90 #endif
91 #ifndef UINT16_MAX
92 #define UINT16_MAX (65535U)
93 #endif
94 #ifndef UINT32_MAX
95 #define UINT32_MAX (4294967295U)
96 #endif
97 
98 #endif /* ! FLEXINT_H */
99 
100 #ifdef __cplusplus
101 
102 /* The "const" storage-class-modifier is valid. */
103 #define YY_USE_CONST
104 
105 #else /* ! __cplusplus */
106 
107 /* C99 requires __STDC__ to be defined as 1. */
108 #if defined (__STDC__)
109 
110 #define YY_USE_CONST
111 
112 #endif /* defined (__STDC__) */
113 #endif /* ! __cplusplus */
114 
115 #ifdef YY_USE_CONST
116 #define yyconst const
117 #else
118 #define yyconst
119 #endif
120 
121 /* Returned upon end-of-file. */
122 #define YY_NULL 0
123 
124 /* Promotes a possibly negative, possibly signed char to an unsigned
125  * integer for use as an array index. If the signed char is negative,
126  * we want to instead treat it as an 8-bit unsigned char, hence the
127  * double cast.
128  */
129 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
130 
131 /* An opaque pointer. */
132 #ifndef YY_TYPEDEF_YY_SCANNER_T
133 #define YY_TYPEDEF_YY_SCANNER_T
134 typedef void* yyscan_t;
135 #endif
136 
137 /* For convenience, these vars (plus the bison vars far below)
138  are macros in the reentrant scanner. */
139 #define yyin yyg->yyin_r
140 #define yyout yyg->yyout_r
141 #define yyextra yyg->yyextra_r
142 #define yyleng yyg->yyleng_r
143 #define yytext yyg->yytext_r
144 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
145 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
146 #define yy_flex_debug yyg->yy_flex_debug_r
147 
148 /* Enter a start condition. This macro really ought to take a parameter,
149  * but we do it the disgusting crufty way forced on us by the ()-less
150  * definition of BEGIN.
151  */
152 #define BEGIN yyg->yy_start = 1 + 2 *
153 
154 /* Translate the current start state into a value that can be later handed
155  * to BEGIN to return to the state. The YYSTATE alias is for lex
156  * compatibility.
157  */
158 #define YY_START ((yyg->yy_start - 1) / 2)
159 #define YYSTATE YY_START
160 
161 /* Action number for EOF rule of a given start state. */
162 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
163 
164 /* Special action meaning "start processing a new file". */
165 #define YY_NEW_FILE pprestart(yyin ,yyscanner )
166 
167 #define YY_END_OF_BUFFER_CHAR 0
168 
169 /* Size of default input buffer. */
170 #ifndef YY_BUF_SIZE
171 #define YY_BUF_SIZE 16384
172 #endif
173 
174 /* The state buf must be large enough to hold one state per character in the main buffer.
175  */
176 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177 
178 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
179 #define YY_TYPEDEF_YY_BUFFER_STATE
180 typedef struct yy_buffer_state *YY_BUFFER_STATE;
181 #endif
182 
183 #ifndef YY_TYPEDEF_YY_SIZE_T
184 #define YY_TYPEDEF_YY_SIZE_T
185 typedef size_t yy_size_t;
186 #endif
187 
188 #define EOB_ACT_CONTINUE_SCAN 0
189 #define EOB_ACT_END_OF_FILE 1
190 #define EOB_ACT_LAST_MATCH 2
191 
192  #define YY_LESS_LINENO(n)
193 
194 /* Return all but the first "n" matched characters back to the input stream. */
195 #define yyless(n) \
196  do \
197  { \
198  /* Undo effects of setting up yytext. */ \
199  int yyless_macro_arg = (n); \
200  YY_LESS_LINENO(yyless_macro_arg);\
201  *yy_cp = yyg->yy_hold_char; \
202  YY_RESTORE_YY_MORE_OFFSET \
203  yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
204  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
205  } \
206  while ( 0 )
207 
208 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
209 
210 #ifndef YY_STRUCT_YY_BUFFER_STATE
211 #define YY_STRUCT_YY_BUFFER_STATE
212 struct yy_buffer_state
213  {
214  FILE *yy_input_file;
215 
216  char *yy_ch_buf; /* input buffer */
217  char *yy_buf_pos; /* current position in input buffer */
218 
219  /* Size of input buffer in bytes, not including room for EOB
220  * characters.
221  */
222  yy_size_t yy_buf_size;
223 
224  /* Number of characters read into yy_ch_buf, not including EOB
225  * characters.
226  */
227  yy_size_t yy_n_chars;
228 
229  /* Whether we "own" the buffer - i.e., we know we created it,
230  * and can realloc() it to grow it, and should free() it to
231  * delete it.
232  */
233  int yy_is_our_buffer;
234 
235  /* Whether this is an "interactive" input source; if so, and
236  * if we're using stdio for input, then we want to use getc()
237  * instead of fread(), to make sure we stop fetching input after
238  * each newline.
239  */
240  int yy_is_interactive;
241 
242  /* Whether we're considered to be at the beginning of a line.
243  * If so, '^' rules will be active on the next match, otherwise
244  * not.
245  */
246  int yy_at_bol;
247 
248  int yy_bs_lineno;
249  int yy_bs_column;
251  /* Whether to try to fill the input buffer when we reach the
252  * end of it.
253  */
254  int yy_fill_buffer;
255 
256  int yy_buffer_status;
257 
258 #define YY_BUFFER_NEW 0
259 #define YY_BUFFER_NORMAL 1
260  /* When an EOF's been seen but there's still some text to process
261  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
262  * shouldn't try reading from the input source any more. We might
263  * still have a bunch of tokens to match, though, because of
264  * possible backing-up.
265  *
266  * When we actually see the EOF, we change the status to "new"
267  * (via pprestart()), so that the user can continue scanning by
268  * just pointing yyin at a new input file.
269  */
270 #define YY_BUFFER_EOF_PENDING 2
271 
272  };
273 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
274 
275 /* We provide macros for accessing buffer states in case in the
276  * future we want to put the buffer states in a more general
277  * "scanner state".
278  *
279  * Returns the top of the stack, or NULL.
280  */
281 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
282  ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
283  : NULL)
284 
285 /* Same as previous macro, but useful when we know that the buffer stack is not
286  * NULL or when we need an lvalue. For internal use only.
287  */
288 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
289 
290 void pprestart (FILE *input_file ,yyscan_t yyscanner );
291 void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
292 YY_BUFFER_STATE pp_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
293 void pp_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
294 void pp_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
295 void pppush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
296 void pppop_buffer_state (yyscan_t yyscanner );
297 
298 static void ppensure_buffer_stack (yyscan_t yyscanner );
299 static void pp_load_buffer_state (yyscan_t yyscanner );
300 static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
301 
302 #define YY_FLUSH_BUFFER pp_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
303 
304 YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
305 YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
306 YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
307 
308 void *ppalloc (yy_size_t ,yyscan_t yyscanner );
309 void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
310 void ppfree (void * ,yyscan_t yyscanner );
311 
312 #define yy_new_buffer pp_create_buffer
313 
314 #define yy_set_interactive(is_interactive) \
315  { \
316  if ( ! YY_CURRENT_BUFFER ){ \
317  ppensure_buffer_stack (yyscanner); \
318  YY_CURRENT_BUFFER_LVALUE = \
319  pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
320  } \
321  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
322  }
323 
324 #define yy_set_bol(at_bol) \
325  { \
326  if ( ! YY_CURRENT_BUFFER ){\
327  ppensure_buffer_stack (yyscanner); \
328  YY_CURRENT_BUFFER_LVALUE = \
329  pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
330  } \
331  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
332  }
333 
334 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
335 
336 /* Begin user sect3 */
337 
338 #define ppwrap(n) 1
339 #define YY_SKIP_YYWRAP
340 
341 typedef unsigned char YY_CHAR;
342 
343 typedef int yy_state_type;
344 
345 #define yytext_ptr yytext_r
346 
347 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
348 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
349 static int yy_get_next_buffer (yyscan_t yyscanner );
350 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
351 
352 /* Done after the current pattern has been matched and before the
353  * corresponding action - sets up yytext.
354  */
355 #define YY_DO_BEFORE_ACTION \
356  yyg->yytext_ptr = yy_bp; \
357  yyleng = (yy_size_t) (yy_cp - yy_bp); \
358  yyg->yy_hold_char = *yy_cp; \
359  *yy_cp = '\0'; \
360  yyg->yy_c_buf_p = yy_cp;
361 
362 #define YY_NUM_RULES 38
363 #define YY_END_OF_BUFFER 39
364 /* This struct is not used in this scanner,
365  but its presence is necessary. */
366 struct yy_trans_info
367  {
368  flex_int32_t yy_verify;
370  };
372  { 0,
373  0, 0, 0, 0, 39, 37, 34, 35, 35, 33,
374  7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
375  9, 33, 33, 33, 8, 37, 33, 33, 3, 5,
376  5, 4, 34, 35, 19, 27, 20, 30, 25, 12,
377  23, 13, 24, 10, 2, 1, 26, 10, 9, 11,
378  11, 11, 11, 9, 14, 16, 18, 17, 15, 8,
379  36, 36, 31, 21, 32, 22, 3, 5, 6, 11,
380  10, 11, 1, 10, 11, 0, 10, 9, 28, 29,
381  0, 10, 10, 10, 10, 0
382  } ;
383 
385  { 0,
386  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
387  2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
388  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389  1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
390  9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
391  16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
392  19, 20, 9, 1, 21, 21, 21, 21, 22, 21,
393  23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
394  23, 23, 23, 23, 23, 23, 23, 24, 23, 23,
395  9, 25, 9, 26, 23, 1, 21, 21, 21, 21,
396 
397  22, 21, 23, 23, 23, 23, 23, 23, 23, 23,
398  23, 23, 23, 23, 23, 23, 23, 23, 23, 24,
399  23, 23, 9, 27, 9, 9, 1, 1, 1, 1,
400  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402  1, 1, 1, 1, 1, 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 
408  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410  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
414  } ;
415 
417  { 0,
418  1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
419  1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
420  5, 5, 5, 5, 1, 1, 1
421  } ;
422 
424  { 0,
425  0, 0, 25, 27, 162, 163, 159, 163, 152, 132,
426  163, 131, 24, 163, 116, 22, 26, 31, 30, 37,
427  40, 44, 115, 46, 0, 64, 50, 15, 0, 163,
428  124, 91, 88, 163, 163, 163, 163, 163, 163, 163,
429  163, 163, 163, 64, 163, 0, 163, 76, 54, 58,
430  79, 91, 91, 0, 56, 163, 163, 163, 32, 0,
431  163, 36, 163, 163, 163, 163, 0, 163, 163, 94,
432  0, 106, 0, 0, 113, 55, 72, 113, 163, 163,
433  116, 101, 108, 123, 126, 163, 143, 31, 148, 153,
434  155
435 
436  } ;
437 
439  { 0,
440  86, 1, 87, 87, 86, 86, 86, 86, 86, 86,
441  86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
442  20, 86, 86, 86, 88, 86, 86, 86, 89, 86,
443  86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
444  86, 86, 86, 86, 86, 90, 86, 86, 20, 20,
445  48, 51, 91, 21, 86, 86, 86, 86, 86, 88,
446  86, 86, 86, 86, 86, 86, 89, 86, 86, 44,
447  44, 70, 90, 48, 51, 86, 52, 91, 86, 86,
448  86, 72, 75, 86, 86, 0, 86, 86, 86, 86,
449  86
450 
451  } ;
452 
454  { 0,
455  6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
456  16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
457  25, 25, 25, 25, 26, 27, 28, 30, 31, 30,
458  31, 37, 40, 65, 32, 60, 32, 42, 61, 45,
459  41, 66, 38, 46, 43, 44, 44, 44, 47, 48,
460  80, 49, 49, 50, 54, 54, 54, 51, 52, 51,
461  53, 55, 56, 51, 58, 59, 61, 62, 63, 84,
462  84, 84, 50, 50, 79, 64, 70, 51, 71, 71,
463  71, 51, 86, 86, 70, 72, 70, 70, 51, 33,
464  74, 74, 74, 51, 51, 51, 51, 75, 51, 51,
465 
466  51, 76, 76, 51, 69, 77, 77, 77, 70, 70,
467  70, 86, 86, 51, 51, 70, 81, 81, 86, 86,
468  82, 82, 82, 81, 81, 51, 68, 83, 83, 83,
469  85, 85, 85, 57, 39, 51, 51, 84, 84, 84,
470  85, 85, 85, 29, 29, 29, 29, 29, 67, 36,
471  35, 67, 67, 73, 34, 73, 73, 73, 78, 78,
472  33, 86, 5, 86, 86, 86, 86, 86, 86, 86,
473  86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
474  86, 86, 86, 86, 86, 86, 86, 86, 86, 86
475  } ;
476 
478  { 0,
479  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
480  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
481  1, 1, 1, 1, 1, 1, 1, 3, 3, 4,
482  4, 13, 16, 28, 3, 88, 4, 17, 62, 19,
483  16, 28, 13, 19, 17, 18, 18, 18, 19, 20,
484  59, 20, 20, 20, 21, 21, 21, 20, 20, 20,
485  20, 22, 22, 21, 24, 24, 26, 26, 27, 76,
486  76, 76, 50, 50, 55, 27, 44, 49, 44, 44,
487  44, 50, 77, 77, 44, 44, 44, 44, 48, 33,
488  48, 48, 48, 51, 51, 51, 48, 48, 48, 48,
489 
490  51, 52, 52, 53, 32, 52, 52, 52, 70, 70,
491  70, 82, 82, 53, 53, 70, 72, 72, 83, 83,
492  72, 72, 72, 75, 75, 78, 31, 75, 75, 75,
493  81, 81, 81, 23, 15, 78, 78, 84, 84, 84,
494  85, 85, 85, 87, 87, 87, 87, 87, 89, 12,
495  10, 89, 89, 90, 9, 90, 90, 90, 91, 91,
496  7, 5, 86, 86, 86, 86, 86, 86, 86, 86,
497  86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
498  86, 86, 86, 86, 86, 86, 86, 86, 86, 86
499  } ;
500 
501 /* The intent behind this definition is that it'll catch
502  * any uses of REJECT which flex missed.
503  */
504 #define REJECT reject_used_but_not_detected
505 #define yymore() yymore_used_but_not_detected
506 #define YY_MORE_ADJ 0
507 #define YY_RESTORE_YY_MORE_OFFSET
508 /*
509 //
510 // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
511 // Use of this source code is governed by a BSD-style license that can be
512 // found in the LICENSE file.
513 //
514 
515 This file contains the Lex specification for GLSL ES preprocessor.
516 Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
517 http://msdn.microsoft.com/en-us/library/2scxys89.aspx
518 
519 IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
520 */
521 
522 #include "Tokenizer.h"
523 
524 #include "DiagnosticsBase.h"
525 #include "Token.h"
526 
527 #if defined(__GNUC__)
528 // Triggered by the auto-generated yy_fatal_error function.
529 #pragma GCC diagnostic ignored "-Wmissing-noreturn"
530 #endif
531 
534 
535 // Use the unused yycolumn variable to track file (string) number.
536 #define yyfileno yycolumn
537 
538 #define YY_USER_INIT \
539  do { \
540  yyfileno = 0; \
541  yylineno = 1; \
542  yyextra->leadingSpace = false; \
543  yyextra->lineStart = true; \
544  } while(0);
545 
546 #define YY_USER_ACTION \
547  do \
548  { \
549  pp::Input* input = &yyextra->input; \
550  pp::Input::Location* scanLoc = &yyextra->scanLoc; \
551  while ((scanLoc->sIndex < input->count()) && \
552  (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
553  { \
554  scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
555  ++yyfileno; yylineno = 1; \
556  } \
557  yylloc->file = yyfileno; \
558  yylloc->line = yylineno; \
559  scanLoc->cIndex += yyleng; \
560  } while(0);
561 
562 #define YY_INPUT(buf, result, maxSize) \
563  result = yyextra->input.read(buf, maxSize);
564 
565 #define INITIAL 0
566 #define COMMENT 1
567 
568 #define YY_EXTRA_TYPE pp::Tokenizer::Context*
569 
570 /* Holds the entire state of the reentrant scanner. */
571 struct yyguts_t
572  {
573 
574  /* User-defined. Not touched by flex. */
575  YY_EXTRA_TYPE yyextra_r;
576 
577  /* The rest are the same as the globals declared in the non-reentrant scanner. */
578  FILE *yyin_r, *yyout_r;
579  size_t yy_buffer_stack_top;
580  size_t yy_buffer_stack_max;
581  YY_BUFFER_STATE * yy_buffer_stack;
582  char yy_hold_char;
583  yy_size_t yy_n_chars;
584  yy_size_t yyleng_r;
585  char *yy_c_buf_p;
586  int yy_init;
587  int yy_start;
588  int yy_did_buffer_switch_on_eof;
589  int yy_start_stack_ptr;
590  int yy_start_stack_depth;
591  int *yy_start_stack;
592  yy_state_type yy_last_accepting_state;
593  char* yy_last_accepting_cpos;
594 
595  int yylineno_r;
596  int yy_flex_debug_r;
597 
598  char *yytext_r;
599  int yy_more_flag;
600  int yy_more_len;
601 
602  YYSTYPE * yylval_r;
603 
604  YYLTYPE * yylloc_r;
605 
606  }; /* end struct yyguts_t */
607 
608 static int yy_init_globals (yyscan_t yyscanner );
609 
610  /* This must go here because YYSTYPE and YYLTYPE are included
611  * from bison output in section 1.*/
612  # define yylval yyg->yylval_r
613 
614  # define yylloc yyg->yylloc_r
615 
616 int pplex_init (yyscan_t* scanner);
617 
618 int pplex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
619 
620 /* Accessor methods to globals.
621  These are made visible to non-reentrant scanners for convenience. */
622 
623 int pplex_destroy (yyscan_t yyscanner );
624 
625 int ppget_debug (yyscan_t yyscanner );
626 
627 void ppset_debug (int debug_flag ,yyscan_t yyscanner );
628 
629 YY_EXTRA_TYPE ppget_extra (yyscan_t yyscanner );
630 
631 void ppset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
632 
633 FILE *ppget_in (yyscan_t yyscanner );
634 
635 void ppset_in (FILE * in_str ,yyscan_t yyscanner );
636 
637 FILE *ppget_out (yyscan_t yyscanner );
638 
639 void ppset_out (FILE * out_str ,yyscan_t yyscanner );
640 
641 yy_size_t ppget_leng (yyscan_t yyscanner );
642 
643 char *ppget_text (yyscan_t yyscanner );
644 
645 int ppget_lineno (yyscan_t yyscanner );
646 
647 void ppset_lineno (int line_number ,yyscan_t yyscanner );
648 
649 YYSTYPE * ppget_lval (yyscan_t yyscanner );
650 
651 void ppset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
652 
653  YYLTYPE *ppget_lloc (yyscan_t yyscanner );
654 
655  void ppset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
656 
657 /* Macros after this point can all be overridden by user definitions in
658  * section 1.
659  */
660 
661 #ifndef YY_SKIP_YYWRAP
662 #ifdef __cplusplus
663 extern "C" int ppwrap (yyscan_t yyscanner );
664 #else
665 extern int ppwrap (yyscan_t yyscanner );
666 #endif
667 #endif
668 
669 #ifndef yytext_ptr
670 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
671 #endif
672 
673 #ifdef YY_NEED_STRLEN
674 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
675 #endif
676 
677 #ifndef YY_NO_INPUT
678 
679 #ifdef __cplusplus
680 static int yyinput (yyscan_t yyscanner );
681 #else
682 static int input (yyscan_t yyscanner );
683 #endif
684 
685 #endif
686 
687 /* Amount of stuff to slurp up with each read. */
688 #ifndef YY_READ_BUF_SIZE
689 #define YY_READ_BUF_SIZE 8192
690 #endif
691 
692 /* Copy whatever the last rule matched to the standard output. */
693 #ifndef ECHO
694 /* This used to be an fputs(), but since the string might contain NUL's,
695  * we now use fwrite().
696  */
697 #define ECHO fwrite( yytext, yyleng, 1, yyout )
698 #endif
699 
700 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
701  * is returned in "result".
702  */
703 #ifndef YY_INPUT
704 #define YY_INPUT(buf,result,max_size) \
705  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
706  { \
707  int c = '*'; \
708  yy_size_t n; \
709  for ( n = 0; n < max_size && \
710  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
711  buf[n] = (char) c; \
712  if ( c == '\n' ) \
713  buf[n++] = (char) c; \
714  if ( c == EOF && ferror( yyin ) ) \
715  YY_FATAL_ERROR( "input in flex scanner failed" ); \
716  result = n; \
717  } \
718  else \
719  { \
720  errno=0; \
721  while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
722  { \
723  if( errno != EINTR) \
724  { \
725  YY_FATAL_ERROR( "input in flex scanner failed" ); \
726  break; \
727  } \
728  errno=0; \
729  clearerr(yyin); \
730  } \
731  }\
732 \
733 
734 #endif
735 
736 /* No semi-colon after return; correct usage is to write "yyterminate();" -
737  * we don't want an extra ';' after the "return" because that will cause
738  * some compilers to complain about unreachable statements.
739  */
740 #ifndef yyterminate
741 #define yyterminate() return YY_NULL
742 #endif
743 
744 /* Number of entries by which start-condition stack grows. */
745 #ifndef YY_START_STACK_INCR
746 #define YY_START_STACK_INCR 25
747 #endif
748 
749 /* Report a fatal error. */
750 #ifndef YY_FATAL_ERROR
751 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
752 #endif
753 
754 /* end tables serialization structures and prototypes */
755 
756 /* Default declaration of generated scanner - a define so the user can
757  * easily add parameters.
758  */
759 #ifndef YY_DECL
760 #define YY_DECL_IS_OURS 1
761 
762 extern int pplex \
763  (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
764 
765 #define YY_DECL int pplex \
766  (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
767 #endif /* !YY_DECL */
768 
769 /* Code executed at the beginning of each rule, after yytext and yyleng
770  * have been set up.
771  */
772 #ifndef YY_USER_ACTION
773 #define YY_USER_ACTION
774 #endif
775 
776 /* Code executed at the end of each rule. */
777 #ifndef YY_BREAK
778 #define YY_BREAK break;
779 #endif
780 
781 #define YY_RULE_SETUP \
782  YY_USER_ACTION
783 
786 YY_DECL
787 {
788  register yy_state_type yy_current_state;
789  register char *yy_cp, *yy_bp;
790  register int yy_act;
791  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
792 
793  /* Line comment */
794 
795  yylval = yylval_param;
796 
797  yylloc = yylloc_param;
798 
799  if ( !yyg->yy_init )
800  {
801  yyg->yy_init = 1;
802 
803 #ifdef YY_USER_INIT
804  YY_USER_INIT;
805 #endif
806 
807  if ( ! yyg->yy_start )
808  yyg->yy_start = 1; /* first start state */
809 
810  if ( ! yyin )
811  yyin = stdin;
812 
813  if ( ! yyout )
814  yyout = stdout;
815 
816  if ( ! YY_CURRENT_BUFFER ) {
817  ppensure_buffer_stack (yyscanner);
819  pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
820  }
821 
822  pp_load_buffer_state(yyscanner );
823  }
824 
825  while ( 1 ) /* loops until end-of-file is reached */
826  {
827  yy_cp = yyg->yy_c_buf_p;
828 
829  /* Support of yytext. */
830  *yy_cp = yyg->yy_hold_char;
831 
832  /* yy_bp points to the position in yy_ch_buf of the start of
833  * the current run.
834  */
835  yy_bp = yy_cp;
836 
837  yy_current_state = yyg->yy_start;
838 yy_match:
839  do
840  {
841  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
842  if ( yy_accept[yy_current_state] )
843  {
844  yyg->yy_last_accepting_state = yy_current_state;
845  yyg->yy_last_accepting_cpos = yy_cp;
846  }
847  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
848  {
849  yy_current_state = (int) yy_def[yy_current_state];
850  if ( yy_current_state >= 87 )
851  yy_c = yy_meta[(unsigned int) yy_c];
852  }
853  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
854  ++yy_cp;
855  }
856  while ( yy_current_state != 86 );
857  yy_cp = yyg->yy_last_accepting_cpos;
858  yy_current_state = yyg->yy_last_accepting_state;
859 
860 yy_find_action:
861  yy_act = yy_accept[yy_current_state];
862 
864 
865 do_action: /* This label is used only to access EOF actions. */
866 
867  switch ( yy_act )
868  { /* beginning of action switch */
869  case 0: /* must back up */
870  /* undo the effects of YY_DO_BEFORE_ACTION */
871  *yy_cp = yyg->yy_hold_char;
872  yy_cp = yyg->yy_last_accepting_cpos;
873  yy_current_state = yyg->yy_last_accepting_state;
874  goto yy_find_action;
875 
876 case 1:
878 
879  YY_BREAK
880 /* Block comment */
881 /* Line breaks are just counted - not returned. */
882 /* The comment is replaced by a single space. */
883 case 2:
885 { BEGIN(COMMENT); }
886  YY_BREAK
887 case 3:
889 
890  YY_BREAK
891 case 4:
893 
894  YY_BREAK
895 case 5:
896 /* rule 5 can match eol */
898 { ++yylineno; }
899  YY_BREAK
900 case 6:
902 {
903  yyextra->leadingSpace = true;
904  BEGIN(INITIAL);
905 }
906  YY_BREAK
907 case 7:
909 {
910  // # is only valid at start of line for preprocessor directives.
911  yylval->assign(1, yytext[0]);
912  return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
913 }
914  YY_BREAK
915 case 8:
917 {
918  yylval->assign(yytext, yyleng);
919  return pp::Token::IDENTIFIER;
920 }
921  YY_BREAK
922 case 9:
924 {
925  yylval->assign(yytext, yyleng);
926  return pp::Token::CONST_INT;
927 }
928  YY_BREAK
929 case 10:
931 {
932  yylval->assign(yytext, yyleng);
933  return pp::Token::CONST_FLOAT;
934 }
935  YY_BREAK
936 /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
937 /* Rule to catch all invalid integers and floats. */
938 case 11:
940 {
941  yylval->assign(yytext, yyleng);
942  return pp::Token::PP_NUMBER;
943 }
944  YY_BREAK
945 case 12:
947 {
948  yylval->assign(yytext, yyleng);
949  return pp::Token::OP_INC;
950 }
951  YY_BREAK
952 case 13:
954 {
955  yylval->assign(yytext, yyleng);
956  return pp::Token::OP_DEC;
957 }
958  YY_BREAK
959 case 14:
961 {
962  yylval->assign(yytext, yyleng);
963  return pp::Token::OP_LEFT;
964 }
965  YY_BREAK
966 case 15:
968 {
969  yylval->assign(yytext, yyleng);
970  return pp::Token::OP_RIGHT;
971 }
972  YY_BREAK
973 case 16:
975 {
976  yylval->assign(yytext, yyleng);
977  return pp::Token::OP_LE;
978 }
979  YY_BREAK
980 case 17:
982 {
983  yylval->assign(yytext, yyleng);
984  return pp::Token::OP_GE;
985 }
986  YY_BREAK
987 case 18:
989 {
990  yylval->assign(yytext, yyleng);
991  return pp::Token::OP_EQ;
992 }
993  YY_BREAK
994 case 19:
996 {
997  yylval->assign(yytext, yyleng);
998  return pp::Token::OP_NE;
999 }
1000  YY_BREAK
1001 case 20:
1003 {
1004  yylval->assign(yytext, yyleng);
1005  return pp::Token::OP_AND;
1006 }
1007  YY_BREAK
1008 case 21:
1010 {
1011  yylval->assign(yytext, yyleng);
1012  return pp::Token::OP_XOR;
1013 }
1014  YY_BREAK
1015 case 22:
1017 {
1018  yylval->assign(yytext, yyleng);
1019  return pp::Token::OP_OR;
1020 }
1021  YY_BREAK
1022 case 23:
1024 {
1025  yylval->assign(yytext, yyleng);
1026  return pp::Token::OP_ADD_ASSIGN;
1027 }
1028  YY_BREAK
1029 case 24:
1031 {
1032  yylval->assign(yytext, yyleng);
1033  return pp::Token::OP_SUB_ASSIGN;
1034 }
1035  YY_BREAK
1036 case 25:
1038 {
1039  yylval->assign(yytext, yyleng);
1040  return pp::Token::OP_MUL_ASSIGN;
1041 }
1042  YY_BREAK
1043 case 26:
1045 {
1046  yylval->assign(yytext, yyleng);
1047  return pp::Token::OP_DIV_ASSIGN;
1048 }
1049  YY_BREAK
1050 case 27:
1052 {
1053  yylval->assign(yytext, yyleng);
1054  return pp::Token::OP_MOD_ASSIGN;
1055 }
1056  YY_BREAK
1057 case 28:
1059 {
1060  yylval->assign(yytext, yyleng);
1062 }
1063  YY_BREAK
1064 case 29:
1066 {
1067  yylval->assign(yytext, yyleng);
1069 }
1070  YY_BREAK
1071 case 30:
1073 {
1074  yylval->assign(yytext, yyleng);
1075  return pp::Token::OP_AND_ASSIGN;
1076 }
1077  YY_BREAK
1078 case 31:
1080 {
1081  yylval->assign(yytext, yyleng);
1082  return pp::Token::OP_XOR_ASSIGN;
1083 }
1084  YY_BREAK
1085 case 32:
1087 {
1088  yylval->assign(yytext, yyleng);
1089  return pp::Token::OP_OR_ASSIGN;
1090 }
1091  YY_BREAK
1092 case 33:
1094 {
1095  yylval->assign(1, yytext[0]);
1096  return yytext[0];
1097 }
1098  YY_BREAK
1099 case 34:
1101 { yyextra->leadingSpace = true; }
1102  YY_BREAK
1103 case 35:
1104 /* rule 35 can match eol */
1106 {
1107  ++yylineno;
1108  yylval->assign(1, '\n');
1109  return '\n';
1110 }
1111  YY_BREAK
1112 case 36:
1113 /* rule 36 can match eol */
1115 { ++yylineno; }
1116  YY_BREAK
1117 case 37:
1119 {
1120  yylval->assign(1, yytext[0]);
1121  return pp::Token::PP_OTHER;
1122 }
1123  YY_BREAK
1124 case YY_STATE_EOF(INITIAL):
1125 case YY_STATE_EOF(COMMENT):
1126 {
1127  // YY_USER_ACTION is not invoked for handling EOF.
1128  // Set the location for EOF token manually.
1129  pp::Input* input = &yyextra->input;
1130  pp::Input::Location* scanLoc = &yyextra->scanLoc;
1131  yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
1132  if (scanLoc->sIndex != sIndexMax)
1133  {
1134  // We can only reach here if there are empty strings at the
1135  // end of the input.
1136  scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
1137  // FIXME: this is not 64-bit clean.
1138  yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
1139  }
1140  yylloc->file = yyfileno;
1141  yylloc->line = yylineno;
1142  yylval->clear();
1143 
1144  if (YY_START == COMMENT)
1145  {
1146  yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
1148  "");
1149  }
1150  yyterminate();
1151 }
1152  YY_BREAK
1153 case 38:
1155 ECHO;
1156  YY_BREAK
1157 
1158  case YY_END_OF_BUFFER:
1159  {
1160  /* Amount of text matched not including the EOB char. */
1161  int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1162 
1163  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1164  *yy_cp = yyg->yy_hold_char;
1166 
1167  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1168  {
1169  /* We're scanning a new file or input source. It's
1170  * possible that this happened because the user
1171  * just pointed yyin at a new source and called
1172  * pplex(). If so, then we have to assure
1173  * consistency between YY_CURRENT_BUFFER and our
1174  * globals. Here is the right place to do so, because
1175  * this is the first action (other than possibly a
1176  * back-up) that will match for the new input source.
1177  */
1178  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1179  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1180  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1181  }
1182 
1183  /* Note that here we test for yy_c_buf_p "<=" to the position
1184  * of the first EOB in the buffer, since yy_c_buf_p will
1185  * already have been incremented past the NUL character
1186  * (since all states make transitions on EOB to the
1187  * end-of-buffer state). Contrast this with the test
1188  * in input().
1189  */
1190  if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1191  { /* This was really a NUL. */
1192  yy_state_type yy_next_state;
1193 
1194  yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1195 
1196  yy_current_state = yy_get_previous_state( yyscanner );
1197 
1198  /* Okay, we're now positioned to make the NUL
1199  * transition. We couldn't have
1200  * yy_get_previous_state() go ahead and do it
1201  * for us because it doesn't know how to deal
1202  * with the possibility of jamming (and we don't
1203  * want to build jamming into it because then it
1204  * will run more slowly).
1205  */
1206 
1207  yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1208 
1209  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1210 
1211  if ( yy_next_state )
1212  {
1213  /* Consume the NUL. */
1214  yy_cp = ++yyg->yy_c_buf_p;
1215  yy_current_state = yy_next_state;
1216  goto yy_match;
1217  }
1218 
1219  else
1220  {
1221  yy_cp = yyg->yy_last_accepting_cpos;
1222  yy_current_state = yyg->yy_last_accepting_state;
1223  goto yy_find_action;
1224  }
1225  }
1226 
1227  else switch ( yy_get_next_buffer( yyscanner ) )
1228  {
1229  case EOB_ACT_END_OF_FILE:
1230  {
1231  yyg->yy_did_buffer_switch_on_eof = 0;
1232 
1233  if ( ppwrap(yyscanner ) )
1234  {
1235  /* Note: because we've taken care in
1236  * yy_get_next_buffer() to have set up
1237  * yytext, we can now set up
1238  * yy_c_buf_p so that if some total
1239  * hoser (like flex itself) wants to
1240  * call the scanner after we return the
1241  * YY_NULL, it'll still work - another
1242  * YY_NULL will get returned.
1243  */
1244  yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1245 
1246  yy_act = YY_STATE_EOF(YY_START);
1247  goto do_action;
1248  }
1249 
1250  else
1251  {
1252  if ( ! yyg->yy_did_buffer_switch_on_eof )
1253  YY_NEW_FILE;
1254  }
1255  break;
1256  }
1257 
1258  case EOB_ACT_CONTINUE_SCAN:
1259  yyg->yy_c_buf_p =
1260  yyg->yytext_ptr + yy_amount_of_matched_text;
1261 
1262  yy_current_state = yy_get_previous_state( yyscanner );
1263 
1264  yy_cp = yyg->yy_c_buf_p;
1265  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1266  goto yy_match;
1267 
1268  case EOB_ACT_LAST_MATCH:
1269  yyg->yy_c_buf_p =
1270  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1271 
1272  yy_current_state = yy_get_previous_state( yyscanner );
1273 
1274  yy_cp = yyg->yy_c_buf_p;
1275  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1276  goto yy_find_action;
1277  }
1278  break;
1279  }
1280 
1281  default:
1283  "fatal flex scanner internal error--no action found" );
1284  } /* end of action switch */
1285  } /* end of scanning one token */
1286 } /* end of pplex */
1287 
1288 /* yy_get_next_buffer - try to read in a new buffer
1289  *
1290  * Returns a code representing an action:
1291  * EOB_ACT_LAST_MATCH -
1292  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1293  * EOB_ACT_END_OF_FILE - end of file
1294  */
1295 static int yy_get_next_buffer (yyscan_t yyscanner)
1296 {
1297  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1298  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1299  register char *source = yyg->yytext_ptr;
1300  register int number_to_move, i;
1301  int ret_val;
1302 
1303  if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1305  "fatal flex scanner internal error--end of buffer missed" );
1306 
1307  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1308  { /* Don't try to fill the buffer, so this is an EOF. */
1309  if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1310  {
1311  /* We matched a single character, the EOB, so
1312  * treat this as a final EOF.
1313  */
1314  return EOB_ACT_END_OF_FILE;
1315  }
1316 
1317  else
1318  {
1319  /* We matched some text prior to the EOB, first
1320  * process it.
1321  */
1322  return EOB_ACT_LAST_MATCH;
1323  }
1324  }
1325 
1326  /* Try to read more data. */
1327 
1328  /* First move last chars to start of buffer. */
1329  number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1330 
1331  for ( i = 0; i < number_to_move; ++i )
1332  *(dest++) = *(source++);
1333 
1334  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1335  /* don't do the read, it's not guaranteed to return an EOF,
1336  * just force an EOF
1337  */
1338  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1339 
1340  else
1341  {
1342  yy_size_t num_to_read =
1343  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1344 
1345  while ( num_to_read <= 0 )
1346  { /* Not enough room in the buffer - grow it. */
1347 
1348  /* just a shorter name for the current buffer */
1350 
1351  int yy_c_buf_p_offset =
1352  (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1353 
1354  if ( b->yy_is_our_buffer )
1355  {
1356  yy_size_t new_size = b->yy_buf_size * 2;
1357 
1358  if ( new_size <= 0 )
1359  b->yy_buf_size += b->yy_buf_size / 8;
1360  else
1361  b->yy_buf_size *= 2;
1362 
1363  b->yy_ch_buf = (char *)
1364  /* Include room in for 2 EOB chars. */
1365  pprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1366  }
1367  else
1368  /* Can't grow it, we don't own it. */
1369  b->yy_ch_buf = 0;
1370 
1371  if ( ! b->yy_ch_buf )
1373  "fatal error - scanner input buffer overflow" );
1374 
1375  yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1376 
1377  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1378  number_to_move - 1;
1379 
1380  }
1381 
1382  if ( num_to_read > YY_READ_BUF_SIZE )
1383  num_to_read = YY_READ_BUF_SIZE;
1384 
1385  /* Read in more data. */
1386  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1387  yyg->yy_n_chars, num_to_read );
1388 
1389  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1390  }
1391 
1392  if ( yyg->yy_n_chars == 0 )
1393  {
1394  if ( number_to_move == YY_MORE_ADJ )
1395  {
1396  ret_val = EOB_ACT_END_OF_FILE;
1397  pprestart(yyin ,yyscanner);
1398  }
1399 
1400  else
1401  {
1402  ret_val = EOB_ACT_LAST_MATCH;
1403  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1405  }
1406  }
1407 
1408  else
1409  ret_val = EOB_ACT_CONTINUE_SCAN;
1410 
1411  if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1412  /* Extend the array by 50%, plus the number we really need. */
1413  yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1414  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1415  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1416  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1417  }
1418 
1419  yyg->yy_n_chars += number_to_move;
1420  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1421  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1422 
1423  yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1424 
1425  return ret_val;
1426 }
1427 
1428 /* yy_get_previous_state - get the state just before the EOB char was reached */
1429 
1431 {
1432  register yy_state_type yy_current_state;
1433  register char *yy_cp;
1434  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1435 
1436  yy_current_state = yyg->yy_start;
1437 
1438  for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1439  {
1440  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1441  if ( yy_accept[yy_current_state] )
1442  {
1443  yyg->yy_last_accepting_state = yy_current_state;
1444  yyg->yy_last_accepting_cpos = yy_cp;
1445  }
1446  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1447  {
1448  yy_current_state = (int) yy_def[yy_current_state];
1449  if ( yy_current_state >= 87 )
1450  yy_c = yy_meta[(unsigned int) yy_c];
1451  }
1452  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1453  }
1454 
1455  return yy_current_state;
1456 }
1457 
1458 /* yy_try_NUL_trans - try to make a transition on the NUL character
1459  *
1460  * synopsis
1461  * next_state = yy_try_NUL_trans( current_state );
1462  */
1463  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1464 {
1465  register int yy_is_jam;
1466  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1467  register char *yy_cp = yyg->yy_c_buf_p;
1468 
1469  register YY_CHAR yy_c = 1;
1470  if ( yy_accept[yy_current_state] )
1471  {
1472  yyg->yy_last_accepting_state = yy_current_state;
1473  yyg->yy_last_accepting_cpos = yy_cp;
1474  }
1475  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1476  {
1477  yy_current_state = (int) yy_def[yy_current_state];
1478  if ( yy_current_state >= 87 )
1479  yy_c = yy_meta[(unsigned int) yy_c];
1480  }
1481  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1482  yy_is_jam = (yy_current_state == 86);
1483 
1484  return yy_is_jam ? 0 : yy_current_state;
1485 }
1486 
1487 #ifndef YY_NO_INPUT
1488 #ifdef __cplusplus
1489  static int yyinput (yyscan_t yyscanner)
1490 #else
1491  static int input (yyscan_t yyscanner)
1492 #endif
1493 
1494 {
1495  int c;
1496  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1497 
1498  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1499 
1500  if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1501  {
1502  /* yy_c_buf_p now points to the character we want to return.
1503  * If this occurs *before* the EOB characters, then it's a
1504  * valid NUL; if not, then we've hit the end of the buffer.
1505  */
1506  if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1507  /* This was really a NUL. */
1508  *yyg->yy_c_buf_p = '\0';
1509 
1510  else
1511  { /* need more input */
1512  yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1513  ++yyg->yy_c_buf_p;
1514 
1515  switch ( yy_get_next_buffer( yyscanner ) )
1516  {
1517  case EOB_ACT_LAST_MATCH:
1518  /* This happens because yy_g_n_b()
1519  * sees that we've accumulated a
1520  * token and flags that we need to
1521  * try matching the token before
1522  * proceeding. But for input(),
1523  * there's no matching to consider.
1524  * So convert the EOB_ACT_LAST_MATCH
1525  * to EOB_ACT_END_OF_FILE.
1526  */
1527 
1528  /* Reset buffer status. */
1529  pprestart(yyin ,yyscanner);
1530 
1531  /*FALLTHROUGH*/
1532 
1533  case EOB_ACT_END_OF_FILE:
1534  {
1535  if ( ppwrap(yyscanner ) )
1536  return EOF;
1537 
1538  if ( ! yyg->yy_did_buffer_switch_on_eof )
1539  YY_NEW_FILE;
1540 #ifdef __cplusplus
1541  return yyinput(yyscanner);
1542 #else
1543  return input(yyscanner);
1544 #endif
1545  }
1546 
1547  case EOB_ACT_CONTINUE_SCAN:
1548  yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1549  break;
1550  }
1551  }
1552  }
1553 
1554  c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1555  *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1556  yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1557 
1558  return c;
1559 }
1560 #endif /* ifndef YY_NO_INPUT */
1561 
1567  void pprestart (FILE * input_file , yyscan_t yyscanner)
1568 {
1569  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1570 
1571  if ( ! YY_CURRENT_BUFFER ){
1572  ppensure_buffer_stack (yyscanner);
1574  pp_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1575  }
1576 
1577  pp_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1578  pp_load_buffer_state(yyscanner );
1579 }
1580 
1585  void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1586 {
1587  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1588 
1589  /* TODO. We should be able to replace this entire function body
1590  * with
1591  * pppop_buffer_state();
1592  * pppush_buffer_state(new_buffer);
1593  */
1594  ppensure_buffer_stack (yyscanner);
1595  if ( YY_CURRENT_BUFFER == new_buffer )
1596  return;
1597 
1598  if ( YY_CURRENT_BUFFER )
1599  {
1600  /* Flush out information for old buffer. */
1601  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1602  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1603  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1604  }
1605 
1606  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1607  pp_load_buffer_state(yyscanner );
1608 
1609  /* We don't actually know whether we did this switch during
1610  * EOF (ppwrap()) processing, but the only time this flag
1611  * is looked at is after ppwrap() is called, so it's safe
1612  * to go ahead and always set it.
1613  */
1614  yyg->yy_did_buffer_switch_on_eof = 1;
1615 }
1616 
1617 static void pp_load_buffer_state (yyscan_t yyscanner)
1618 {
1619  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1620  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1621  yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1622  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1623  yyg->yy_hold_char = *yyg->yy_c_buf_p;
1624 }
1625 
1633 {
1635 
1636  b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1637  if ( ! b )
1638  YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
1639 
1640  b->yy_buf_size = size;
1641 
1642  /* yy_ch_buf has to be 2 characters longer than the size given because
1643  * we need to put in 2 end-of-buffer characters.
1644  */
1645  b->yy_ch_buf = (char *) ppalloc(b->yy_buf_size + 2 ,yyscanner );
1646  if ( ! b->yy_ch_buf )
1647  YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
1648 
1649  b->yy_is_our_buffer = 1;
1650 
1651  pp_init_buffer(b,file ,yyscanner);
1652 
1653  return b;
1654 }
1655 
1661 {
1662  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1663 
1664  if ( ! b )
1665  return;
1666 
1667  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1669 
1670  if ( b->yy_is_our_buffer )
1671  ppfree((void *) b->yy_ch_buf ,yyscanner );
1672 
1673  ppfree((void *) b ,yyscanner );
1674 }
1675 
1676 /* Initializes or reinitializes a buffer.
1677  * This function is sometimes called more than once on the same buffer,
1678  * such as during a pprestart() or at EOF.
1679  */
1680  static void pp_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1681 
1682 {
1683  int oerrno = errno;
1684  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1685 
1686  pp_flush_buffer(b ,yyscanner);
1687 
1688  b->yy_input_file = file;
1689  b->yy_fill_buffer = 1;
1690 
1691  /* If b is the current buffer, then pp_init_buffer was _probably_
1692  * called from pprestart() or through yy_get_next_buffer.
1693  * In that case, we don't want to reset the lineno or column.
1694  */
1695  if (b != YY_CURRENT_BUFFER){
1696  b->yy_bs_lineno = 1;
1697  b->yy_bs_column = 0;
1698  }
1699 
1700  b->yy_is_interactive = 0;
1701 
1702  errno = oerrno;
1703 }
1704 
1710 {
1711  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1712  if ( ! b )
1713  return;
1714 
1715  b->yy_n_chars = 0;
1716 
1717  /* We always need two end-of-buffer characters. The first causes
1718  * a transition to the end-of-buffer state. The second causes
1719  * a jam in that state.
1720  */
1721  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1722  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1723 
1724  b->yy_buf_pos = &b->yy_ch_buf[0];
1725 
1726  b->yy_at_bol = 1;
1727  b->yy_buffer_status = YY_BUFFER_NEW;
1728 
1729  if ( b == YY_CURRENT_BUFFER )
1730  pp_load_buffer_state(yyscanner );
1731 }
1732 
1739 void pppush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1740 {
1741  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1742  if (new_buffer == NULL)
1743  return;
1744 
1745  ppensure_buffer_stack(yyscanner);
1746 
1747  /* This block is copied from pp_switch_to_buffer. */
1748  if ( YY_CURRENT_BUFFER )
1749  {
1750  /* Flush out information for old buffer. */
1751  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1752  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1753  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1754  }
1755 
1756  /* Only push if top exists. Otherwise, replace top. */
1757  if (YY_CURRENT_BUFFER)
1758  yyg->yy_buffer_stack_top++;
1759  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1760 
1761  /* copied from pp_switch_to_buffer. */
1762  pp_load_buffer_state(yyscanner );
1763  yyg->yy_did_buffer_switch_on_eof = 1;
1764 }
1765 
1771 {
1772  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1773  if (!YY_CURRENT_BUFFER)
1774  return;
1775 
1776  pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1778  if (yyg->yy_buffer_stack_top > 0)
1779  --yyg->yy_buffer_stack_top;
1780 
1781  if (YY_CURRENT_BUFFER) {
1782  pp_load_buffer_state(yyscanner );
1783  yyg->yy_did_buffer_switch_on_eof = 1;
1784  }
1785 }
1786 
1787 /* Allocates the stack if it does not exist.
1788  * Guarantees space for at least one push.
1789  */
1790 static void ppensure_buffer_stack (yyscan_t yyscanner)
1791 {
1792  yy_size_t num_to_alloc;
1793  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1794 
1795  if (!yyg->yy_buffer_stack) {
1796 
1797  /* First allocation is just for 2 elements, since we don't know if this
1798  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1799  * immediate realloc on the next call.
1800  */
1801  num_to_alloc = 1;
1802  yyg->yy_buffer_stack = (struct yy_buffer_state**)ppalloc
1803  (num_to_alloc * sizeof(struct yy_buffer_state*)
1804  , yyscanner);
1805  if ( ! yyg->yy_buffer_stack )
1806  YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
1807 
1808  memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1809 
1810  yyg->yy_buffer_stack_max = num_to_alloc;
1811  yyg->yy_buffer_stack_top = 0;
1812  return;
1813  }
1814 
1815  if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1816 
1817  /* Increase the buffer to prepare for a possible push. */
1818  int grow_size = 8 /* arbitrary grow size */;
1819 
1820  num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1821  yyg->yy_buffer_stack = (struct yy_buffer_state**)pprealloc
1822  (yyg->yy_buffer_stack,
1823  num_to_alloc * sizeof(struct yy_buffer_state*)
1824  , yyscanner);
1825  if ( ! yyg->yy_buffer_stack )
1826  YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
1827 
1828  /* zero only the new slots.*/
1829  memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1830  yyg->yy_buffer_stack_max = num_to_alloc;
1831  }
1832 }
1833 
1841 {
1843 
1844  if ( size < 2 ||
1845  base[size-2] != YY_END_OF_BUFFER_CHAR ||
1846  base[size-1] != YY_END_OF_BUFFER_CHAR )
1847  /* They forgot to leave room for the EOB's. */
1848  return 0;
1849 
1850  b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1851  if ( ! b )
1852  YY_FATAL_ERROR( "out of dynamic memory in pp_scan_buffer()" );
1853 
1854  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1855  b->yy_buf_pos = b->yy_ch_buf = base;
1856  b->yy_is_our_buffer = 0;
1857  b->yy_input_file = 0;
1858  b->yy_n_chars = b->yy_buf_size;
1859  b->yy_is_interactive = 0;
1860  b->yy_at_bol = 1;
1861  b->yy_fill_buffer = 0;
1862  b->yy_buffer_status = YY_BUFFER_NEW;
1863 
1864  pp_switch_to_buffer(b ,yyscanner );
1865 
1866  return b;
1867 }
1868 
1878 {
1879 
1880  return pp_scan_bytes(yystr,strlen(yystr) ,yyscanner);
1881 }
1882 
1890 YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
1891 {
1893  char *buf;
1894  yy_size_t n, i;
1895 
1896  /* Get memory for full buffer, including space for trailing EOB's. */
1897  n = _yybytes_len + 2;
1898  buf = (char *) ppalloc(n ,yyscanner );
1899  if ( ! buf )
1900  YY_FATAL_ERROR( "out of dynamic memory in pp_scan_bytes()" );
1901 
1902  for ( i = 0; i < _yybytes_len; ++i )
1903  buf[i] = yybytes[i];
1904 
1905  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1906 
1907  b = pp_scan_buffer(buf,n ,yyscanner);
1908  if ( ! b )
1909  YY_FATAL_ERROR( "bad buffer in pp_scan_bytes()" );
1910 
1911  /* It's okay to grow etc. this buffer, and we should throw it
1912  * away when we're done.
1913  */
1914  b->yy_is_our_buffer = 1;
1915 
1916  return b;
1917 }
1918 
1919 #ifndef YY_EXIT_FAILURE
1920 #define YY_EXIT_FAILURE 2
1921 #endif
1922 
1923 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1924 {
1925  (void) fprintf( stderr, "%s\n", msg );
1926  exit( YY_EXIT_FAILURE );
1927 }
1928 
1929 /* Redefine yyless() so it works in section 3 code. */
1930 
1931 #undef yyless
1932 #define yyless(n) \
1933  do \
1934  { \
1935  /* Undo effects of setting up yytext. */ \
1936  int yyless_macro_arg = (n); \
1937  YY_LESS_LINENO(yyless_macro_arg);\
1938  yytext[yyleng] = yyg->yy_hold_char; \
1939  yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1940  yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1941  *yyg->yy_c_buf_p = '\0'; \
1942  yyleng = yyless_macro_arg; \
1943  } \
1944  while ( 0 )
1945 
1946 /* Accessor methods (get/set functions) to struct members. */
1947 
1952 {
1953  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1954  return yyextra;
1955 }
1956 
1960 int ppget_lineno (yyscan_t yyscanner)
1961 {
1962  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1963 
1964  if (! YY_CURRENT_BUFFER)
1965  return 0;
1966 
1967  return yylineno;
1968 }
1969 
1973 int ppget_column (yyscan_t yyscanner)
1974 {
1975  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1976 
1977  if (! YY_CURRENT_BUFFER)
1978  return 0;
1979 
1980  return yycolumn;
1981 }
1982 
1986 FILE *ppget_in (yyscan_t yyscanner)
1987 {
1988  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1989  return yyin;
1990 }
1991 
1995 FILE *ppget_out (yyscan_t yyscanner)
1996 {
1997  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1998  return yyout;
1999 }
2000 
2005 {
2006  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2007  return yyleng;
2008 }
2009 
2014 char *ppget_text (yyscan_t yyscanner)
2015 {
2016  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2017  return yytext;
2018 }
2019 
2024 void ppset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2025 {
2026  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2027  yyextra = user_defined ;
2028 }
2029 
2034 void ppset_lineno (int line_number , yyscan_t yyscanner)
2035 {
2036  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2037 
2038  /* lineno is only valid if an input buffer exists. */
2039  if (! YY_CURRENT_BUFFER )
2040  yy_fatal_error( "ppset_lineno called with no buffer" , yyscanner);
2041 
2042  yylineno = line_number;
2043 }
2044 
2049 void ppset_column (int column_no , yyscan_t yyscanner)
2050 {
2051  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2052 
2053  /* column is only valid if an input buffer exists. */
2054  if (! YY_CURRENT_BUFFER )
2055  yy_fatal_error( "ppset_column called with no buffer" , yyscanner);
2056 
2057  yycolumn = column_no;
2058 }
2059 
2066 void ppset_in (FILE * in_str , yyscan_t yyscanner)
2067 {
2068  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2069  yyin = in_str ;
2070 }
2071 
2072 void ppset_out (FILE * out_str , yyscan_t yyscanner)
2073 {
2074  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2075  yyout = out_str ;
2076 }
2077 
2078 int ppget_debug (yyscan_t yyscanner)
2079 {
2080  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2081  return yy_flex_debug;
2082 }
2083 
2084 void ppset_debug (int bdebug , yyscan_t yyscanner)
2085 {
2086  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2087  yy_flex_debug = bdebug ;
2088 }
2089 
2090 /* Accessor methods for yylval and yylloc */
2091 
2093 {
2094  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2095  return yylval;
2096 }
2097 
2098 void ppset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2099 {
2100  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2101  yylval = yylval_param;
2102 }
2103 
2105 {
2106  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2107  return yylloc;
2108 }
2109 
2110 void ppset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2111 {
2112  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2113  yylloc = yylloc_param;
2114 }
2115 
2116 /* User-visible API */
2117 
2118 /* pplex_init is special because it creates the scanner itself, so it is
2119  * the ONLY reentrant function that doesn't take the scanner as the last argument.
2120  * That's why we explicitly handle the declaration, instead of using our macros.
2121  */
2122 
2123 int pplex_init(yyscan_t* ptr_yy_globals)
2124 
2125 {
2126  if (ptr_yy_globals == NULL){
2127  errno = EINVAL;
2128  return 1;
2129  }
2130 
2131  *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), NULL );
2132 
2133  if (*ptr_yy_globals == NULL){
2134  errno = ENOMEM;
2135  return 1;
2136  }
2137 
2138  /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2139  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2140 
2141  return yy_init_globals ( *ptr_yy_globals );
2142 }
2143 
2144 /* pplex_init_extra has the same functionality as pplex_init, but follows the
2145  * convention of taking the scanner as the last argument. Note however, that
2146  * this is a *pointer* to a scanner, as it will be allocated by this call (and
2147  * is the reason, too, why this function also must handle its own declaration).
2148  * The user defined value in the first argument will be available to ppalloc in
2149  * the yyextra field.
2150  */
2151 
2152 int pplex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2153 
2154 {
2155  struct yyguts_t dummy_yyguts;
2156 
2157  ppset_extra (yy_user_defined, &dummy_yyguts);
2158 
2159  if (ptr_yy_globals == NULL){
2160  errno = EINVAL;
2161  return 1;
2162  }
2163 
2164  *ptr_yy_globals = (yyscan_t) ppalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2165 
2166  if (*ptr_yy_globals == NULL){
2167  errno = ENOMEM;
2168  return 1;
2169  }
2170 
2171  /* By setting to 0xAA, we expose bugs in
2172  yy_init_globals. Leave at 0x00 for releases. */
2173  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2174 
2175  ppset_extra (yy_user_defined, *ptr_yy_globals);
2176 
2177  return yy_init_globals ( *ptr_yy_globals );
2178 }
2179 
2180 static int yy_init_globals (yyscan_t yyscanner)
2181 {
2182  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2183  /* Initialization is the same as for the non-reentrant scanner.
2184  * This function is called from pplex_destroy(), so don't allocate here.
2185  */
2186 
2187  yyg->yy_buffer_stack = 0;
2188  yyg->yy_buffer_stack_top = 0;
2189  yyg->yy_buffer_stack_max = 0;
2190  yyg->yy_c_buf_p = (char *) 0;
2191  yyg->yy_init = 0;
2192  yyg->yy_start = 0;
2193 
2194  yyg->yy_start_stack_ptr = 0;
2195  yyg->yy_start_stack_depth = 0;
2196  yyg->yy_start_stack = NULL;
2197 
2198 /* Defined in main.c */
2199 #ifdef YY_STDINIT
2200  yyin = stdin;
2201  yyout = stdout;
2202 #else
2203  yyin = (FILE *) 0;
2204  yyout = (FILE *) 0;
2205 #endif
2206 
2207  /* For future reference: Set errno on error, since we are called by
2208  * pplex_init()
2209  */
2210  return 0;
2211 }
2212 
2213 /* pplex_destroy is for both reentrant and non-reentrant scanners. */
2214 int pplex_destroy (yyscan_t yyscanner)
2215 {
2216  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2217 
2218  /* Pop the buffer stack, destroying each element. */
2219  while(YY_CURRENT_BUFFER){
2220  pp_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2222  pppop_buffer_state(yyscanner);
2223  }
2224 
2225  /* Destroy the stack itself. */
2226  ppfree(yyg->yy_buffer_stack ,yyscanner);
2227  yyg->yy_buffer_stack = NULL;
2228 
2229  /* Destroy the start condition stack. */
2230  ppfree(yyg->yy_start_stack ,yyscanner );
2231  yyg->yy_start_stack = NULL;
2232 
2233  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2234  * pplex() is called, initialization will occur. */
2235  yy_init_globals( yyscanner);
2236 
2237  /* Destroy the main struct (reentrant only). */
2238  ppfree ( yyscanner , yyscanner );
2239  yyscanner = NULL;
2240  return 0;
2241 }
2242 
2243 /*
2244  * Internal utility routines.
2245  */
2246 
2247 #ifndef yytext_ptr
2248 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2249 {
2250  register int i;
2251  for ( i = 0; i < n; ++i )
2252  s1[i] = s2[i];
2253 }
2254 #endif
2255 
2256 #ifdef YY_NEED_STRLEN
2257 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2258 {
2259  register int n;
2260  for ( n = 0; s[n]; ++n )
2261  ;
2262 
2263  return n;
2264 }
2265 #endif
2266 
2267 void *ppalloc (yy_size_t size , yyscan_t yyscanner)
2268 {
2269  return (void *) malloc( size );
2270 }
2271 
2272 void *pprealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2273 {
2274  /* The cast to (char *) in the following accommodates both
2275  * implementations that use char* generic pointers, and those
2276  * that use void* generic pointers. It works with the latter
2277  * because both ANSI C and C++ allow castless assignment from
2278  * any pointer type to void*, and deal with argument conversions
2279  * as though doing an assignment.
2280  */
2281  return (void *) realloc( (char *) ptr, size );
2282 }
2283 
2284 void ppfree (void * ptr , yyscan_t yyscanner)
2285 {
2286  free( (char *) ptr ); /* see pprealloc() for (char *) cast */
2287 }
2288 
2289 #define YYTABLES_NAME "yytables"
2290 
2291 namespace pp {
2292 
2293 // TODO(alokp): Maximum token length should ideally be specified by
2294 // the preprocessor client, i.e., the compiler.
2295 const size_t Tokenizer::kMaxTokenLength = 256;
2296 
2297 Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
2298 {
2299  mContext.diagnostics = diagnostics;
2300 }
2301 
2303 {
2304  destroyScanner();
2305 }
2306 
2307 bool Tokenizer::init(size_t count, const char* const string[], const int length[])
2308 {
2309  if ((count > 0) && (string == 0)) return false;
2310 
2311  mContext.input = Input(count, string, length);
2312  return initScanner();
2313 }
2314 
2316 {
2317  // We use column number as file number.
2318  // See macro yyfileno.
2319  ppset_column(file,mHandle);
2320 }
2321 
2323 {
2324  ppset_lineno(line,mHandle);
2325 }
2326 
2327 void Tokenizer::lex(Token* token)
2328 {
2329  token->type = pplex(&token->text,&token->location,mHandle);
2330  if (token->text.size() > kMaxTokenLength)
2331  {
2333  token->location, token->text);
2334  token->text.erase(kMaxTokenLength);
2335  }
2336 
2337  token->flags = 0;
2338 
2339  token->setAtStartOfLine(mContext.lineStart);
2340  mContext.lineStart = token->type == '\n';
2341 
2342  token->setHasLeadingSpace(mContext.leadingSpace);
2343  mContext.leadingSpace = false;
2344 }
2345 
2346 bool Tokenizer::initScanner()
2347 {
2348  if ((mHandle == NULL) && pplex_init_extra(&mContext,&mHandle))
2349  return false;
2350 
2351  pprestart(0,mHandle);
2352  return true;
2353 }
2354 
2355 void Tokenizer::destroyScanner()
2356 {
2357  if (mHandle == NULL)
2358  return;
2359 
2360  pplex_destroy(mHandle);
2361  mHandle = NULL;
2362 }
2363 
2364 } // namespace pp
2365 
#define YY_BUFFER_EOF_PENDING
Definition: Tokenizer.cpp:270
#define INITIAL
Definition: Tokenizer.cpp:565
#define YY_INPUT(buf, result, maxSize)
Definition: Tokenizer.cpp:562
size_t cIndex
Definition: Input.h:32
void ppset_out(FILE *out_str, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2072
GLdouble s
Definition: glew.h:1376
#define yyconst
Definition: Tokenizer.cpp:118
#define YY_START
Definition: Tokenizer.cpp:158
static yyconst flex_int16_t yy_def[92]
Definition: Tokenizer.cpp:438
void pppush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1739
#define yyfileno
Definition: Tokenizer.cpp:536
YY_BUFFER_STATE pp_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1840
void pp_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1709
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
YY_BUFFER_STATE pp_scan_string(yyconst char *yy_str, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1877
int pplex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
#define yylloc
#define YY_END_OF_BUFFER
Definition: Tokenizer.cpp:363
#define YY_NEW_FILE
Definition: Tokenizer.cpp:165
#define NULL
Definition: ftobjs.h:61
void ppfree(void *, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2284
#define yyextra
Definition: Tokenizer.cpp:141
int pplex_destroy(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2214
unsigned short uint16_t
YYSTYPE * ppget_lval(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2092
yy_size_t ppget_leng(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2004
void ppset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2098
GLclampd n
Definition: glew.h:7287
static const std::size_t kMaxTokenLength
Definition: Tokenizer.h:35
bool init(size_t count, const char *const string[], const int length[])
Definition: Tokenizer.cpp:2307
#define YY_DO_BEFORE_ACTION
Definition: Tokenizer.cpp:355
SDL_EventEntry * free
Definition: SDL_events.c:80
struct yyguts_t * yyg
char * ppget_text(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2014
unsigned long long uint64_t
#define YY_BUF_SIZE
Definition: Tokenizer.cpp:171
png_sPLT_entryp pp
Definition: pngrutil.c:1375
#define YY_FATAL_ERROR(msg)
Definition: Tokenizer.cpp:751
#define memset
Definition: SDL_malloc.c:633
int pplex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner)
Definition: Tokenizer.cpp:2152
FILE * file
Definition: visualinfo.c:88
void setAtStartOfLine(bool start)
Definition: Token.cpp:32
#define YY_STATE_EOF(state)
Definition: Tokenizer.cpp:162
#define YY_READ_BUF_SIZE
Definition: Tokenizer.cpp:689
unsigned int flags
Definition: Token.h:88
#define YY_END_OF_BUFFER_CHAR
Definition: Tokenizer.cpp:167
long int32_t
Definition: types.h:9
void ppset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2024
#define YY_EXIT_FAILURE
Definition: Tokenizer.cpp:1920
GLenum GLsizei len
Definition: glew.h:7035
void * ppalloc(yy_size_t, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2267
#define yylineno
Definition: Tokenizer.cpp:144
YYLTYPE * ppget_lloc(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2104
#define YY_MORE_ADJ
Definition: Tokenizer.cpp:506
void * pprealloc(void *, yy_size_t, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2272
static yyconst flex_int16_t yy_accept[87]
Definition: Tokenizer.cpp:371
YY_BUFFER_STATE pp_create_buffer(FILE *file, int size, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1632
signed char flex_int8_t
Definition: glslang_lex.cpp:73
#define yyleng
Definition: Tokenizer.cpp:142
#define yyin
Definition: Tokenizer.cpp:139
static void yy_fatal_error(yyconst char msg[], yyscan_t yyscanner)
void setFileNumber(int file)
Definition: Tokenizer.cpp:2315
unsigned int flex_uint32_t
Definition: glslang_lex.cpp:78
void pprestart(FILE *input_file, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1567
unsigned char flex_uint8_t
Definition: glslang_lex.cpp:76
void setLineNumber(int line)
Definition: Tokenizer.cpp:2322
#define YY_USER_INIT
Definition: Tokenizer.cpp:538
#define EOB_ACT_CONTINUE_SCAN
Definition: Tokenizer.cpp:188
struct yy_buffer_state * YY_BUFFER_STATE
static yy_state_type yy_get_previous_state(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1430
int ppget_lineno(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1960
#define YY_DECL
static yyconst flex_int32_t yy_meta[28]
Definition: Tokenizer.cpp:416
int ppget_debug(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2078
static yyconst flex_int16_t yy_base[92]
Definition: Tokenizer.cpp:423
int
Definition: SDL_systhread.c:37
size_t sIndex
Definition: Input.h:31
GLsizei GLsizei * length
Definition: gl2ext.h:792
#define yylval
YY_BUFFER_STATE pp_scan_bytes(yyconst char *bytes, yy_size_t len, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1890
FILE * ppget_out(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1995
void ppset_lineno(int line_number, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2034
GLint GLsizei count
Definition: gl2ext.h:1011
static yyconst flex_int32_t yy_ec[256]
Definition: Tokenizer.cpp:384
#define YY_SC_TO_UI(c)
Definition: Tokenizer.cpp:129
Diagnostics * diagnostics
Definition: Tokenizer.h:24
void ppset_column(int column_no, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2049
const GLfloat * c
Definition: glew.h:14913
#define ppwrap(n)
Definition: Tokenizer.cpp:338
#define YY_BUFFER_NORMAL
Definition: Tokenizer.cpp:259
static void ppensure_buffer_stack(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1790
#define YY_BREAK
Definition: Tokenizer.cpp:778
#define realloc
Definition: SDL_malloc.c:637
#define yyout
Definition: Tokenizer.cpp:140
SourceLocation location
Definition: Token.h:89
register int yy_act
#define EOB_ACT_LAST_MATCH
Definition: Tokenizer.cpp:190
#define COMMENT
Definition: Tokenizer.cpp:566
void report(ID id, const SourceLocation &loc, const std::string &text)
static yyconst flex_int16_t yy_nxt[191]
Definition: Tokenizer.cpp:453
short int flex_int16_t
Definition: glslang_lex.cpp:74
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: glew.h:11582
#define ECHO
YY_EXTRA_TYPE ppget_extra(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1951
void pp_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1585
#define EOF
Definition: afmparse.c:57
virtual void lex(Token *token)
Definition: Tokenizer.cpp:2327
short int16_t
Definition: types.h:8
#define YY_RESTORE_YY_MORE_OFFSET
Definition: Tokenizer.cpp:507
#define BEGIN
Definition: Tokenizer.cpp:152
FILE * ppget_in(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1986
static int yy_get_next_buffer(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1295
#define yytext
Definition: Tokenizer.cpp:143
#define YY_CURRENT_BUFFER_LVALUE
Definition: Tokenizer.cpp:288
Tokenizer(Diagnostics *diagnostics)
Definition: Tokenizer.cpp:2297
unsigned char uint8_t
unsigned int uint32_t
#define malloc
Definition: SDL_malloc.c:635
void pppop_buffer_state(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1770
void ppset_debug(int debug_flag, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2084
signed char int8_t
GLenum GLenum GLenum input
Definition: glew.h:12631
#define yycolumn
Definition: Tokenizer.cpp:145
#define YY_RULE_SETUP
Definition: Tokenizer.cpp:781
std::string text
Definition: Token.h:90
GLintptr offset
Definition: glew.h:1668
union YYSTYPE YYSTYPE
size_t yy_size_t
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2539
register char * yy_bp
static void pp_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1680
GLsizei const GLcharARB ** string
Definition: glew.h:5638
void setHasLeadingSpace(bool space)
Definition: Token.cpp:40
pp::SourceLocation YYLTYPE
Definition: Tokenizer.cpp:533
int yy_state_type
GLdouble GLdouble GLdouble b
Definition: glew.h:8383
#define yyterminate()
Definition: Tokenizer.cpp:741
#define yy_flex_debug
Definition: Tokenizer.cpp:146
static yyconst flex_int16_t yy_chk[191]
Definition: Tokenizer.cpp:477
#define YY_EXTRA_TYPE
Definition: Tokenizer.cpp:568
void * yyscan_t
static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1463
#define YY_CURRENT_BUFFER
Definition: Tokenizer.cpp:281
int type
Definition: Token.h:87
static void pp_load_buffer_state(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1617
void ppset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2110
int i
Definition: pngrutil.c:1377
static int yy_init_globals(yyscan_t yyscanner)
Definition: Tokenizer.cpp:2180
int ppget_column(yyscan_t yyscanner)
Definition: Tokenizer.cpp:1973
void ppset_in(FILE *in_str, yyscan_t yyscanner)
Definition: Tokenizer.cpp:2066
void pp_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
Definition: Tokenizer.cpp:1660
unsigned char YY_CHAR
GLsizei GLsizei GLchar * source
Definition: gl2ext.h:994
int pplex_init(yyscan_t *scanner)
Definition: Tokenizer.cpp:2123
int flex_int32_t
Definition: glslang_lex.cpp:75
#define YY_BUFFER_NEW
Definition: Tokenizer.cpp:258
register char * yy_cp
size_t count() const
Definition: Input.h:23
#define EOB_ACT_END_OF_FILE
Definition: Tokenizer.cpp:189
unsigned short int flex_uint16_t
Definition: glslang_lex.cpp:77
GLsizei size
Definition: gl2ext.h:1467