/* */
This source file includes following definitions.
- yy_get_next_buffer
- yy_get_previous_state
- yy_try_NUL_trans
- yyunput
- yyinput
- php_restart
- php__switch_to_buffer
- php__load_buffer_state
- php__create_buffer
- php__delete_buffer
- php__init_buffer
- php__flush_buffer
- php_push_buffer_state
- php_pop_buffer_state
- php_ensure_buffer_stack
- php__scan_buffer
- php__scan_string
- php__scan_bytes
- yy_push_state
- yy_pop_state
- yy_fatal_error
- php_get_lineno
- php_get_in
- php_get_out
- php_get_leng
- php_get_text
- php_set_lineno
- php_set_in
- php_set_out
- php_get_debug
- php_set_debug
- yy_init_globals
- php_lex_destroy
- yy_flex_strncpy
- yy_flex_strlen
- php_alloc
- php_realloc
- php_free
- php_parser_init
1 #line 2 "php.c"
2
3 #line 4 "php.c"
4
5 #define YY_INT_ALIGNED short int
6
7 /* A lexical scanner generated by flex */
8
9 #define yy_create_buffer php__create_buffer
10 #define yy_delete_buffer php__delete_buffer
11 #define yy_flex_debug php__flex_debug
12 #define yy_init_buffer php__init_buffer
13 #define yy_flush_buffer php__flush_buffer
14 #define yy_load_buffer_state php__load_buffer_state
15 #define yy_switch_to_buffer php__switch_to_buffer
16 #define yyin php_in
17 #define yyleng php_leng
18 #define yylex php_lex
19 #define yylineno php_lineno
20 #define yyout php_out
21 #define yyrestart php_restart
22 #define yytext php_text
23 #define yywrap php_wrap
24 #define yyalloc php_alloc
25 #define yyrealloc php_realloc
26 #define yyfree php_free
27
28 #define FLEX_SCANNER
29 #define YY_FLEX_MAJOR_VERSION 2
30 #define YY_FLEX_MINOR_VERSION 5
31 #define YY_FLEX_SUBMINOR_VERSION 35
32 #if YY_FLEX_SUBMINOR_VERSION > 0
33 #define FLEX_BETA
34 #endif
35
36 /* First, we deal with platform-specific or compiler-specific issues. */
37
38 /* begin standard C headers. */
39 #include <stdio.h>
40 #include <string.h>
41 #include <errno.h>
42 #include <stdlib.h>
43
44 /* end standard C headers. */
45
46 /* flex integer type definitions */
47
48 #ifndef FLEXINT_H
49 #define FLEXINT_H
50
51 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52
53 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54
55 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56 * if you want the limit (max/min) macros for int types.
57 */
58 #ifndef __STDC_LIMIT_MACROS
59 #define __STDC_LIMIT_MACROS 1
60 #endif
61
62 #include <inttypes.h>
63 typedef int8_t flex_int8_t;
64 typedef uint8_t flex_uint8_t;
65 typedef int16_t flex_int16_t;
66 typedef uint16_t flex_uint16_t;
67 typedef int32_t flex_int32_t;
68 typedef uint32_t flex_uint32_t;
69 #else
70 typedef signed char flex_int8_t;
71 typedef short int flex_int16_t;
72 typedef int flex_int32_t;
73 typedef unsigned char flex_uint8_t;
74 typedef unsigned short int flex_uint16_t;
75 typedef unsigned int flex_uint32_t;
76 #endif /* ! C99 */
77
78 /* Limits of integral types. */
79 #ifndef INT8_MIN
80 #define INT8_MIN (-128)
81 #endif
82 #ifndef INT16_MIN
83 #define INT16_MIN (-32767-1)
84 #endif
85 #ifndef INT32_MIN
86 #define INT32_MIN (-2147483647-1)
87 #endif
88 #ifndef INT8_MAX
89 #define INT8_MAX (127)
90 #endif
91 #ifndef INT16_MAX
92 #define INT16_MAX (32767)
93 #endif
94 #ifndef INT32_MAX
95 #define INT32_MAX (2147483647)
96 #endif
97 #ifndef UINT8_MAX
98 #define UINT8_MAX (255U)
99 #endif
100 #ifndef UINT16_MAX
101 #define UINT16_MAX (65535U)
102 #endif
103 #ifndef UINT32_MAX
104 #define UINT32_MAX (4294967295U)
105 #endif
106
107 #endif /* ! FLEXINT_H */
108
109 #ifdef __cplusplus
110
111 /* The "const" storage-class-modifier is valid. */
112 #define YY_USE_CONST
113
114 #else /* ! __cplusplus */
115
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
118
119 #define YY_USE_CONST
120
121 #endif /* defined (__STDC__) */
122 #endif /* ! __cplusplus */
123
124 #ifdef YY_USE_CONST
125 #define yyconst const
126 #else
127 #define yyconst
128 #endif
129
130 /* Returned upon end-of-file. */
131 #define YY_NULL 0
132
133 /* Promotes a possibly negative, possibly signed char to an unsigned
134 * integer for use as an array index. If the signed char is negative,
135 * we want to instead treat it as an 8-bit unsigned char, hence the
136 * double cast.
137 */
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139
140 /* Enter a start condition. This macro really ought to take a parameter,
141 * but we do it the disgusting crufty way forced on us by the ()-less
142 * definition of BEGIN.
143 */
144 #define BEGIN (yy_start) = 1 + 2 *
145
146 /* Translate the current start state into a value that can be later handed
147 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 * compatibility.
149 */
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
152
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE php_restart(php_in )
158
159 #define YY_END_OF_BUFFER_CHAR 0
160
161 /* Size of default input buffer. */
162 #ifndef YY_BUF_SIZE
163 #define YY_BUF_SIZE 16384
164 #endif
165
166 /* The state buf must be large enough to hold one state per character in the main buffer.
167 */
168 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
169
170 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
171 #define YY_TYPEDEF_YY_BUFFER_STATE
172 typedef struct yy_buffer_state *YY_BUFFER_STATE;
173 #endif
174
175 extern int php_leng;
176
177 extern FILE *php_in, *php_out;
178
179 #define EOB_ACT_CONTINUE_SCAN 0
180 #define EOB_ACT_END_OF_FILE 1
181 #define EOB_ACT_LAST_MATCH 2
182
183 #define YY_LESS_LINENO(n)
184
185 /* Return all but the first "n" matched characters back to the input stream. */
186 #define yyless(n) \
187 do \
188 { \
189 /* Undo effects of setting up php_text. */ \
190 int yyless_macro_arg = (n); \
191 YY_LESS_LINENO(yyless_macro_arg);\
192 *yy_cp = (yy_hold_char); \
193 YY_RESTORE_YY_MORE_OFFSET \
194 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
195 YY_DO_BEFORE_ACTION; /* set up php_text again */ \
196 } \
197 while ( 0 )
198
199 #define unput(c) yyunput( c, (yytext_ptr) )
200
201 #ifndef YY_TYPEDEF_YY_SIZE_T
202 #define YY_TYPEDEF_YY_SIZE_T
203 typedef size_t yy_size_t;
204 #endif
205
206 #ifndef YY_STRUCT_YY_BUFFER_STATE
207 #define YY_STRUCT_YY_BUFFER_STATE
208 struct yy_buffer_state
209 {
210 FILE *yy_input_file;
211
212 char *yy_ch_buf; /* input buffer */
213 char *yy_buf_pos; /* current position in input buffer */
214
215 /* Size of input buffer in bytes, not including room for EOB
216 * characters.
217 */
218 yy_size_t yy_buf_size;
219
220 /* Number of characters read into yy_ch_buf, not including EOB
221 * characters.
222 */
223 int yy_n_chars;
224
225 /* Whether we "own" the buffer - i.e., we know we created it,
226 * and can realloc() it to grow it, and should free() it to
227 * delete it.
228 */
229 int yy_is_our_buffer;
230
231 /* Whether this is an "interactive" input source; if so, and
232 * if we're using stdio for input, then we want to use getc()
233 * instead of fread(), to make sure we stop fetching input after
234 * each newline.
235 */
236 int yy_is_interactive;
237
238 /* Whether we're considered to be at the beginning of a line.
239 * If so, '^' rules will be active on the next match, otherwise
240 * not.
241 */
242 int yy_at_bol;
243
244 int yy_bs_lineno; /**< The line count. */
245 int yy_bs_column; /**< The column count. */
246
247 /* Whether to try to fill the input buffer when we reach the
248 * end of it.
249 */
250 int yy_fill_buffer;
251
252 int yy_buffer_status;
253
254 #define YY_BUFFER_NEW 0
255 #define YY_BUFFER_NORMAL 1
256 /* When an EOF's been seen but there's still some text to process
257 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
258 * shouldn't try reading from the input source any more. We might
259 * still have a bunch of tokens to match, though, because of
260 * possible backing-up.
261 *
262 * When we actually see the EOF, we change the status to "new"
263 * (via php_restart()), so that the user can continue scanning by
264 * just pointing php_in at a new input file.
265 */
266 #define YY_BUFFER_EOF_PENDING 2
267
268 };
269 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
270
271 /* Stack of input buffers. */
272 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
273 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
274 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
275
276 /* We provide macros for accessing buffer states in case in the
277 * future we want to put the buffer states in a more general
278 * "scanner state".
279 *
280 * Returns the top of the stack, or NULL.
281 */
282 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
283 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
284 : NULL)
285
286 /* Same as previous macro, but useful when we know that the buffer stack is not
287 * NULL or when we need an lvalue. For internal use only.
288 */
289 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
290
291 /* yy_hold_char holds the character lost when php_text is formed. */
292 static char yy_hold_char;
293 static int yy_n_chars; /* number of characters read into yy_ch_buf */
294 int php_leng;
295
296 /* Points to current character in buffer. */
297 static char *yy_c_buf_p = (char *) 0;
298 static int yy_init = 0; /* whether we need to initialize */
299 static int yy_start = 0; /* start state number */
300
301 /* Flag which is used to allow php_wrap()'s to do buffer switches
302 * instead of setting up a fresh php_in. A bit of a hack ...
303 */
304 static int yy_did_buffer_switch_on_eof;
305
306 void php_restart (FILE *input_file );
307 void php__switch_to_buffer (YY_BUFFER_STATE new_buffer );
308 YY_BUFFER_STATE php__create_buffer (FILE *file,int size );
309 void php__delete_buffer (YY_BUFFER_STATE b );
310 void php__flush_buffer (YY_BUFFER_STATE b );
311 void php_push_buffer_state (YY_BUFFER_STATE new_buffer );
312 void php_pop_buffer_state (void );
313
314 static void php_ensure_buffer_stack (void );
315 static void php__load_buffer_state (void );
316 static void php__init_buffer (YY_BUFFER_STATE b,FILE *file );
317
318 #define YY_FLUSH_BUFFER php__flush_buffer(YY_CURRENT_BUFFER )
319
320 YY_BUFFER_STATE php__scan_buffer (char *base,yy_size_t size );
321 YY_BUFFER_STATE php__scan_string (yyconst char *yy_str );
322 YY_BUFFER_STATE php__scan_bytes (yyconst char *bytes,int len );
323
324 void *php_alloc (yy_size_t );
325 void *php_realloc (void *,yy_size_t );
326 void php_free (void * );
327
328 #define yy_new_buffer php__create_buffer
329
330 #define yy_set_interactive(is_interactive) \
331 { \
332 if ( ! YY_CURRENT_BUFFER ){ \
333 php_ensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 php__create_buffer(php_in,YY_BUF_SIZE ); \
336 } \
337 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
338 }
339
340 #define yy_set_bol(at_bol) \
341 { \
342 if ( ! YY_CURRENT_BUFFER ){\
343 php_ensure_buffer_stack (); \
344 YY_CURRENT_BUFFER_LVALUE = \
345 php__create_buffer(php_in,YY_BUF_SIZE ); \
346 } \
347 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
348 }
349
350 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
351
352 /* Begin user sect3 */
353
354 #define php_wrap(n) 1
355 #define YY_SKIP_YYWRAP
356
357 typedef unsigned char YY_CHAR;
358
359 FILE *php_in = (FILE *) 0, *php_out = (FILE *) 0;
360
361 typedef int yy_state_type;
362
363 extern int php_lineno;
364
365 int php_lineno = 1;
366
367 extern char *php_text;
368 #define yytext_ptr php_text
369
370 static yy_state_type yy_get_previous_state (void );
371 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
372 static int yy_get_next_buffer (void );
373 static void yy_fatal_error (yyconst char msg[] );
374
375 /* Done after the current pattern has been matched and before the
376 * corresponding action - sets up php_text.
377 */
378 #define YY_DO_BEFORE_ACTION \
379 (yytext_ptr) = yy_bp; \
380 php_leng = (size_t) (yy_cp - yy_bp); \
381 (yy_hold_char) = *yy_cp; \
382 *yy_cp = '\0'; \
383 (yy_c_buf_p) = yy_cp;
384
385 #define YY_NUM_RULES 31
386 #define YY_END_OF_BUFFER 32
387 /* This struct is not used in this scanner,
388 but its presence is necessary. */
389 struct yy_trans_info
390 {
391 flex_int32_t yy_verify;
392 flex_int32_t yy_nxt;
393 };
394 static yyconst flex_int16_t yy_accept[163] =
395 { 0,
396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
397 0, 0, 0, 0, 0, 0, 0, 0, 32, 6,
398 29, 6, 30, 15, 13, 30, 30, 18, 30, 30,
399 30, 24, 30, 30, 27, 28, 30, 27, 27, 12,
400 12, 16, 30, 19, 30, 30, 22, 4, 2, 0,
401 25, 0, 8, 0, 24, 24, 10, 14, 0, 24,
402 0, 0, 7, 27, 0, 0, 0, 27, 27, 11,
403 17, 20, 0, 22, 22, 1, 0, 0, 25, 0,
404 0, 24, 0, 0, 0, 0, 27, 27, 0, 0,
405 0, 26, 0, 24, 0, 0, 21, 0, 0, 27,
406
407 27, 3, 0, 0, 24, 0, 21, 0, 0, 27,
408 27, 0, 0, 0, 0, 27, 27, 0, 0, 0,
409 0, 23, 23, 0, 0, 23, 23, 27, 0, 9,
410 0, 27, 0, 0, 27, 0, 0, 27, 0, 0,
411 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
413 5, 0
414 } ;
415
416 static yyconst flex_int32_t yy_ec[256] =
417 { 0,
418 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421 1, 4, 1, 5, 6, 7, 8, 1, 9, 10,
422 11, 12, 13, 1, 14, 15, 16, 17, 17, 17,
423 17, 17, 17, 17, 17, 17, 17, 1, 1, 18,
424 19, 20, 21, 1, 22, 22, 22, 22, 23, 22,
425 22, 22, 22, 22, 22, 24, 22, 22, 22, 22,
426 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
427 25, 26, 27, 1, 28, 1, 29, 22, 30, 31,
428
429 32, 22, 33, 34, 35, 22, 22, 36, 22, 37,
430 38, 39, 40, 41, 42, 43, 44, 22, 22, 22,
431 22, 22, 45, 1, 46, 1, 1, 22, 22, 22,
432 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
433 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
434 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
435 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
436 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
437 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
438 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
439
440 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
441 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
442 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
443 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
444 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
445 22, 22, 22, 22, 22
446 } ;
447
448 static yyconst flex_int32_t yy_meta[47] =
449 { 0,
450 1, 2, 3, 2, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 4, 1, 1, 1,
452 1, 5, 5, 5, 1, 1, 1, 5, 5, 5,
453 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
454 5, 5, 5, 5, 6, 7
455 } ;
456
457 static yyconst flex_int16_t yy_base[177] =
458 { 0,
459 0, 1, 19, 64, 2, 3, 306, 305, 304, 303,
460 64, 67, 70, 72, 4, 105, 302, 301, 303, 310,
461 310, 144, 310, 310, 310, 257, 281, 310, 61, 283,
462 0, 65, 67, 279, 0, 310, 152, 261, 265, 310,
463 280, 310, 0, 310, 0, 6, 0, 310, 58, 265,
464 0, 0, 310, 277, 71, 136, 310, 310, 276, 310,
465 250, 273, 310, 0, 153, 253, 257, 258, 247, 310,
466 310, 310, 90, 0, 0, 310, 252, 244, 0, 238,
467 87, 141, 253, 0, 252, 241, 244, 235, 239, 242,
468 230, 310, 258, 257, 149, 232, 0, 236, 227, 226,
469
470 234, 310, 229, 250, 249, 230, 0, 220, 228, 231,
471 220, 217, 220, 227, 216, 224, 223, 229, 210, 220,
472 219, 0, 222, 245, 228, 310, 216, 198, 233, 310,
473 191, 185, 165, 154, 160, 176, 155, 152, 147, 150,
474 152, 143, 146, 134, 148, 143, 143, 155, 162, 166,
475 159, 148, 128, 127, 121, 93, 97, 80, 66, 64,
476 310, 310, 194, 201, 208, 211, 214, 219, 226, 232,
477 234, 236, 8, 238, 4, 242
478 } ;
479
480 static yyconst flex_int16_t yy_def[177] =
481 { 0,
482 163, 163, 162, 3, 164, 164, 165, 165, 165, 165,
483 165, 165, 165, 165, 165, 162, 165, 165, 162, 162,
484 162, 162, 162, 162, 162, 166, 162, 162, 162, 162,
485 162, 162, 162, 162, 167, 162, 162, 167, 167, 162,
486 162, 162, 168, 162, 169, 170, 171, 162, 162, 162,
487 172, 173, 162, 162, 162, 162, 162, 162, 162, 162,
488 162, 162, 162, 167, 162, 162, 162, 167, 167, 162,
489 162, 162, 170, 171, 171, 162, 162, 162, 172, 174,
490 162, 162, 162, 175, 162, 162, 167, 167, 162, 162,
491 174, 162, 162, 162, 162, 162, 176, 162, 162, 167,
492
493 167, 162, 162, 162, 162, 162, 176, 162, 162, 167,
494 167, 162, 162, 162, 162, 167, 167, 162, 162, 162,
495 162, 167, 167, 162, 162, 162, 162, 167, 162, 162,
496 162, 167, 162, 162, 167, 162, 162, 167, 162, 162,
497 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
498 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
499 162, 0, 162, 162, 162, 162, 162, 162, 162, 162,
500 162, 162, 162, 162, 162, 162
501 } ;
502
503 static yyconst flex_int16_t yy_nxt[357] =
504 { 0,
505 162, 162, 21, 21, 21, 21, 21, 73, 97, 73,
506 26, 57, 80, 41, 41, 58, 162, 22, 22, 23,
507 23, 21, 23, 24, 25, 26, 27, 28, 23, 23,
508 23, 23, 29, 30, 31, 32, 33, 23, 23, 34,
509 35, 35, 35, 23, 23, 23, 35, 35, 35, 35,
510 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
511 35, 35, 35, 36, 36, 37, 21, 37, 42, 21,
512 26, 42, 21, 26, 21, 54, 76, 55, 44, 59,
513 44, 55, 61, 161, 62, 59, 160, 55, 60, 43,
514 159, 73, 43, 73, 60, 45, 77, 45, 38, 93,
515
516 93, 158, 157, 94, 39, 23, 46, 21, 46, 23,
517 23, 26, 23, 23, 23, 23, 23, 23, 23, 23,
518 23, 23, 23, 23, 23, 23, 47, 47, 47, 23,
519 23, 23, 47, 47, 47, 47, 47, 47, 47, 47,
520 47, 47, 47, 47, 47, 47, 47, 47, 47, 23,
521 23, 48, 56, 65, 65, 65, 65, 82, 81, 156,
522 155, 104, 104, 95, 49, 105, 154, 81, 153, 152,
523 151, 150, 95, 149, 148, 147, 146, 145, 144, 143,
524 142, 126, 141, 122, 140, 50, 66, 66, 139, 138,
525 137, 136, 67, 67, 20, 20, 20, 20, 20, 20,
526
527 20, 40, 40, 40, 40, 40, 40, 40, 23, 23,
528 23, 23, 23, 23, 23, 51, 51, 64, 64, 71,
529 71, 135, 71, 71, 71, 71, 72, 72, 134, 72,
530 72, 72, 72, 74, 133, 132, 74, 75, 75, 79,
531 79, 91, 91, 131, 91, 107, 107, 130, 129, 128,
532 127, 126, 125, 124, 123, 122, 121, 120, 119, 118,
533 117, 116, 115, 114, 113, 105, 105, 112, 111, 110,
534 109, 108, 106, 94, 94, 92, 103, 102, 101, 100,
535 99, 98, 96, 92, 90, 89, 88, 87, 86, 85,
536 84, 83, 82, 56, 78, 70, 69, 68, 63, 56,
537
538 53, 52, 162, 21, 21, 21, 21, 21, 21, 19,
539 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
540 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
541 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
542 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
543 162, 162, 162, 162, 162, 162
544 } ;
545
546 static yyconst flex_int16_t yy_chk[357] =
547 { 0,
548 0, 0, 1, 2, 5, 6, 15, 46, 175, 46,
549 15, 31, 173, 5, 6, 31, 0, 1, 2, 3,
550 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
551 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
552 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
553 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
554 3, 3, 3, 3, 3, 4, 11, 4, 11, 12,
555 11, 12, 13, 12, 14, 29, 49, 29, 13, 32,
556 14, 32, 33, 160, 33, 55, 159, 55, 32, 11,
557 158, 73, 12, 73, 55, 13, 49, 14, 4, 81,
558
559 81, 157, 156, 81, 4, 16, 16, 16, 16, 16,
560 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
561 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
562 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
563 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
564 16, 22, 56, 37, 65, 37, 65, 82, 56, 155,
565 154, 95, 95, 82, 22, 95, 153, 56, 152, 151,
566 150, 149, 82, 148, 147, 146, 145, 144, 143, 142,
567 141, 140, 139, 138, 137, 22, 37, 65, 136, 135,
568 134, 133, 37, 65, 163, 163, 163, 163, 163, 163,
569
570 163, 164, 164, 164, 164, 164, 164, 164, 165, 165,
571 165, 165, 165, 165, 165, 166, 166, 167, 167, 168,
572 168, 132, 168, 168, 168, 168, 169, 169, 131, 169,
573 169, 169, 169, 170, 129, 128, 170, 171, 171, 172,
574 172, 174, 174, 127, 174, 176, 176, 125, 124, 123,
575 121, 120, 119, 118, 117, 116, 115, 114, 113, 112,
576 111, 110, 109, 108, 106, 105, 104, 103, 101, 100,
577 99, 98, 96, 94, 93, 91, 90, 89, 88, 87,
578 86, 85, 83, 80, 78, 77, 69, 68, 67, 66,
579 62, 61, 59, 54, 50, 41, 39, 38, 34, 30,
580
581 27, 26, 19, 18, 17, 10, 9, 8, 7, 162,
582 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
583 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
584 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
585 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
586 162, 162, 162, 162, 162, 162
587 } ;
588
589 static yy_state_type yy_last_accepting_state;
590 static char *yy_last_accepting_cpos;
591
592 extern int php__flex_debug;
593 int php__flex_debug = 0;
594
595 /* The intent behind this definition is that it'll catch
596 * any uses of REJECT which flex missed.
597 */
598 #define REJECT reject_used_but_not_detected
599 #define yymore() yymore_used_but_not_detected
600 #define YY_MORE_ADJ 0
601 #define YY_RESTORE_YY_MORE_OFFSET
602 char *php_text;
603 #line 1 "php.l"
604 #line 2 "php.l"
605 /*
606 * Copyright (c) 2002, 2004, 2005, 2006, 2008 Tama Communications Corporation
607 *
608 * This file is part of GNU GLOBAL.
609 *
610 * This program is free software: you can redistribute it and/or modify
611 * it under the terms of the GNU General Public License as published by
612 * the Free Software Foundation, either version 3 of the License, or
613 * (at your option) any later version.
614 *
615 * This program is distributed in the hope that it will be useful,
616 * but WITHOUT ANY WARRANTY; without even the implied warranty of
617 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
618 * GNU General Public License for more details.
619 *
620 * You should have received a copy of the GNU General Public License
621 * along with this program. If not, see <http://www.gnu.org/licenses/>.
622 */
623
624 /*
625 * scanner for php source code.
626 */
627 #ifdef HAVE_CONFIG_H
628 #include <config.h>
629 #endif
630 #include <stdio.h>
631 #ifdef STDC_HEADERS
632 #include <stdlib.h>
633 #endif
634 #ifdef HAVE_STRING_H
635 #include <string.h>
636 #else
637 #include <strings.h>
638 #endif
639 #include "global.h"
640 #include "anchor.h"
641 #include "common.h"
642 #include "incop.h"
643 #include "htags.h"
644 #include "../libparser/php_res.h"
645
646 #define lex_symbol_generation_rule(x) php_ ## x
647 #include "lexcommon.h"
648
649 #ifdef ECHO
650 #undef ECHO
651 #endif
652 #define ECHO echos(LEXTEXT)
653
654 #define YY_USER_ACTION DEFAULT_YY_USER_ACTION
655 #define LEFT_BRACE '('
656
657 static int pre_here_document;
658 static char end_of_here_document[IDENTLEN];
659
660 /* Definitions */
661
662 #line 663 "php.c"
663
664 #define INITIAL 0
665 #define PHP 1
666 #define C_COMMENT 2
667 #define CPP_COMMENT 3
668 #define SHELL_COMMENT 4
669 #define STRING 5
670 #define LITERAL 6
671 #define HEREDOCUMENT 7
672 #define PREPROCESSOR_LINE 8
673
674 #ifndef YY_NO_UNISTD_H
675 /* Special case for "unistd.h", since it is non-ANSI. We include it way
676 * down here because we want the user's section 1 to have been scanned first.
677 * The user has a chance to override it with an option.
678 */
679 #include <unistd.h>
680 #endif
681
682 #ifndef YY_EXTRA_TYPE
683 #define YY_EXTRA_TYPE void *
684 #endif
685
686 static int yy_init_globals (void );
687
688 /* Accessor methods to globals.
689 These are made visible to non-reentrant scanners for convenience. */
690
691 int php_lex_destroy (void );
692
693 int php_get_debug (void );
694
695 void php_set_debug (int debug_flag );
696
697 YY_EXTRA_TYPE php_get_extra (void );
698
699 void php_set_extra (YY_EXTRA_TYPE user_defined );
700
701 FILE *php_get_in (void );
702
703 void php_set_in (FILE * in_str );
704
705 FILE *php_get_out (void );
706
707 void php_set_out (FILE * out_str );
708
709 int php_get_leng (void );
710
711 char *php_get_text (void );
712
713 int php_get_lineno (void );
714
715 void php_set_lineno (int line_number );
716
717 /* Macros after this point can all be overridden by user definitions in
718 * section 1.
719 */
720
721 #ifndef YY_SKIP_YYWRAP
722 #ifdef __cplusplus
723 extern "C" int php_wrap (void );
724 #else
725 extern int php_wrap (void );
726 #endif
727 #endif
728
729 static void yyunput (int c,char *buf_ptr );
730
731 #ifndef yytext_ptr
732 static void yy_flex_strncpy (char *,yyconst char *,int );
733 #endif
734
735 #ifdef YY_NEED_STRLEN
736 static int yy_flex_strlen (yyconst char * );
737 #endif
738
739 #ifndef YY_NO_INPUT
740
741 #ifdef __cplusplus
742 static int yyinput (void );
743 #else
744 static int input (void );
745 #endif
746
747 #endif
748
749 static int yy_start_stack_ptr = 0;
750 static int yy_start_stack_depth = 0;
751 static int *yy_start_stack = NULL;
752
753 static void yy_push_state (int new_state );
754
755 static void yy_pop_state (void );
756
757 /* Amount of stuff to slurp up with each read. */
758 #ifndef YY_READ_BUF_SIZE
759 #define YY_READ_BUF_SIZE 8192
760 #endif
761
762 /* Copy whatever the last rule matched to the standard output. */
763 #ifndef ECHO
764 /* This used to be an fputs(), but since the string might contain NUL's,
765 * we now use fwrite().
766 */
767 #define ECHO fwrite( php_text, php_leng, 1, php_out )
768 #endif
769
770 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
771 * is returned in "result".
772 */
773 #ifndef YY_INPUT
774 #define YY_INPUT(buf,result,max_size) \
775 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
776 { \
777 int c = '*'; \
778 int n; \
779 for ( n = 0; n < max_size && \
780 (c = getc( php_in )) != EOF && c != '\n'; ++n ) \
781 buf[n] = (char) c; \
782 if ( c == '\n' ) \
783 buf[n++] = (char) c; \
784 if ( c == EOF && ferror( php_in ) ) \
785 YY_FATAL_ERROR( "input in flex scanner failed" ); \
786 result = n; \
787 } \
788 else \
789 { \
790 errno=0; \
791 while ( (result = fread(buf, 1, max_size, php_in))==0 && ferror(php_in)) \
792 { \
793 if( errno != EINTR) \
794 { \
795 YY_FATAL_ERROR( "input in flex scanner failed" ); \
796 break; \
797 } \
798 errno=0; \
799 clearerr(php_in); \
800 } \
801 }\
802 \
803
804 #endif
805
806 /* No semi-colon after return; correct usage is to write "yyterminate();" -
807 * we don't want an extra ';' after the "return" because that will cause
808 * some compilers to complain about unreachable statements.
809 */
810 #ifndef yyterminate
811 #define yyterminate() return YY_NULL
812 #endif
813
814 /* Number of entries by which start-condition stack grows. */
815 #ifndef YY_START_STACK_INCR
816 #define YY_START_STACK_INCR 25
817 #endif
818
819 /* Report a fatal error. */
820 #ifndef YY_FATAL_ERROR
821 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
822 #endif
823
824 /* end tables serialization structures and prototypes */
825
826 /* Default declaration of generated scanner - a define so the user can
827 * easily add parameters.
828 */
829 #ifndef YY_DECL
830 #define YY_DECL_IS_OURS 1
831
832 extern int php_lex (void);
833
834 #define YY_DECL int php_lex (void)
835 #endif /* !YY_DECL */
836
837 /* Code executed at the beginning of each rule, after php_text and php_leng
838 * have been set up.
839 */
840 #ifndef YY_USER_ACTION
841 #define YY_USER_ACTION
842 #endif
843
844 /* Code executed at the end of each rule. */
845 #ifndef YY_BREAK
846 #define YY_BREAK break;
847 #endif
848
849 #define YY_RULE_SETUP \
850 if ( php_leng > 0 ) \
851 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
852 (php_text[php_leng - 1] == '\n'); \
853 YY_USER_ACTION
854
855 /** The main scanner function which does all the work.
856 */
857 YY_DECL
858 {
859 register yy_state_type yy_current_state;
860 register char *yy_cp, *yy_bp;
861 register int yy_act;
862
863 #line 71 "php.l"
864
865 /* Start PHP */
866 #line 867 "php.c"
867
868 if ( !(yy_init) )
869 {
870 (yy_init) = 1;
871
872 #ifdef YY_USER_INIT
873 YY_USER_INIT;
874 #endif
875
876 if ( ! (yy_start) )
877 (yy_start) = 1; /* first start state */
878
879 if ( ! php_in )
880 php_in = stdin;
881
882 if ( ! php_out )
883 php_out = stdout;
884
885 if ( ! YY_CURRENT_BUFFER ) {
886 php_ensure_buffer_stack ();
887 YY_CURRENT_BUFFER_LVALUE =
888 php__create_buffer(php_in,YY_BUF_SIZE );
889 }
890
891 php__load_buffer_state( );
892 }
893
894 while ( 1 ) /* loops until end-of-file is reached */
895 {
896 yy_cp = (yy_c_buf_p);
897
898 /* Support of php_text. */
899 *yy_cp = (yy_hold_char);
900
901 /* yy_bp points to the position in yy_ch_buf of the start of
902 * the current run.
903 */
904 yy_bp = yy_cp;
905
906 yy_current_state = (yy_start);
907 yy_current_state += YY_AT_BOL();
908 yy_match:
909 do
910 {
911 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
912 if ( yy_accept[yy_current_state] )
913 {
914 (yy_last_accepting_state) = yy_current_state;
915 (yy_last_accepting_cpos) = yy_cp;
916 }
917 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
918 {
919 yy_current_state = (int) yy_def[yy_current_state];
920 if ( yy_current_state >= 163 )
921 yy_c = yy_meta[(unsigned int) yy_c];
922 }
923 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
924 ++yy_cp;
925 }
926 while ( yy_current_state != 162 );
927 yy_cp = (yy_last_accepting_cpos);
928 yy_current_state = (yy_last_accepting_state);
929
930 yy_find_action:
931 yy_act = yy_accept[yy_current_state];
932
933 YY_DO_BEFORE_ACTION;
934
935 do_action: /* This label is used only to access EOF actions. */
936
937 switch ( yy_act )
938 { /* beginning of action switch */
939 case 0: /* must back up */
940 /* undo the effects of YY_DO_BEFORE_ACTION */
941 *yy_cp = (yy_hold_char);
942 yy_cp = (yy_last_accepting_cpos);
943 yy_current_state = (yy_last_accepting_state);
944 goto yy_find_action;
945
946 case 1:
947 YY_RULE_SETUP
948 #line 73 "php.l"
949 { put_string(LEXTEXT); BEGIN PHP; }
950 YY_BREAK
951 case 2:
952 YY_RULE_SETUP
953 #line 74 "php.l"
954 { put_string(LEXTEXT); BEGIN PHP; }
955 YY_BREAK
956 case 3:
957 YY_RULE_SETUP
958 #line 75 "php.l"
959 { put_string(LEXTEXT); BEGIN PHP; }
960 YY_BREAK
961 case 4:
962 YY_RULE_SETUP
963 #line 76 "php.l"
964 { put_string(LEXTEXT); BEGIN PHP; }
965 YY_BREAK
966 case 5:
967 YY_RULE_SETUP
968 #line 77 "php.l"
969 { put_string(LEXTEXT); BEGIN PHP; }
970 YY_BREAK
971 /* Ignore HTML */
972 case 6:
973 YY_RULE_SETUP
974 #line 79 "php.l"
975 put_string(LEXTEXT);
976 YY_BREAK
977 /* End of PHP */
978 case 7:
979 YY_RULE_SETUP
980 #line 81 "php.l"
981 { put_string(LEXTEXT); BEGIN INITIAL; }
982 YY_BREAK
983 case 8:
984 YY_RULE_SETUP
985 #line 82 "php.l"
986 { put_string(LEXTEXT); BEGIN INITIAL; }
987 YY_BREAK
988 case 9:
989 YY_RULE_SETUP
990 #line 83 "php.l"
991 { put_string(LEXTEXT); BEGIN INITIAL; }
992 YY_BREAK
993 /* Comment */
994 case 10:
995 YY_RULE_SETUP
996 #line 86 "php.l"
997 { echos(comment_begin); ECHO; yy_push_state(C_COMMENT); }
998 YY_BREAK
999 case 11:
1000 YY_RULE_SETUP
1001 #line 87 "php.l"
1002 { ECHO; echos(comment_end); yy_pop_state(); }
1003 YY_BREAK
1004 case 12:
1005 YY_RULE_SETUP
1006 #line 88 "php.l"
1007 { put_char(LEXTEXT[0]); }
1008 YY_BREAK
1009 case 13:
1010 YY_RULE_SETUP
1011 #line 89 "php.l"
1012 { echos(comment_begin); ECHO; yy_push_state(SHELL_COMMENT); }
1013 YY_BREAK
1014 case 14:
1015 YY_RULE_SETUP
1016 #line 90 "php.l"
1017 { echos(comment_begin); ECHO; yy_push_state(CPP_COMMENT); }
1018 YY_BREAK
1019 /* String */
1020 case 15:
1021 YY_RULE_SETUP
1022 #line 93 "php.l"
1023 { ECHO; yy_push_state(STRING); }
1024 YY_BREAK
1025 case 16:
1026 YY_RULE_SETUP
1027 #line 94 "php.l"
1028 { ECHO; yy_pop_state(); }
1029 YY_BREAK
1030 case 17:
1031 YY_RULE_SETUP
1032 #line 95 "php.l"
1033 { put_char(LEXTEXT[0]); put_char(LEXTEXT[1]); }
1034 YY_BREAK
1035 /* Literal */
1036 case 18:
1037 YY_RULE_SETUP
1038 #line 98 "php.l"
1039 { ECHO; yy_push_state(LITERAL); }
1040 YY_BREAK
1041 case 19:
1042 YY_RULE_SETUP
1043 #line 99 "php.l"
1044 { ECHO; yy_pop_state(); }
1045 YY_BREAK
1046 case 20:
1047 YY_RULE_SETUP
1048 #line 100 "php.l"
1049 { put_char(LEXTEXT[0]); put_char(LEXTEXT[1]); }
1050 YY_BREAK
1051 /* Here document */
1052 case 21:
1053 YY_RULE_SETUP
1054 #line 103 "php.l"
1055 {
1056 /* extract word and save */
1057 if (LEXLENG - 3 > IDENTLEN)
1058 die("Too long name '%s'.", LEXTEXT + 3);
1059 strcpy(end_of_here_document, LEXTEXT + 3);
1060 put_string("<<<");
1061 put_reserved_word(end_of_here_document);
1062 /* begin here document from the next line */
1063 pre_here_document = 1;
1064 }
1065 YY_BREAK
1066 case 22:
1067 YY_RULE_SETUP
1068 #line 113 "php.l"
1069 {
1070 const char *keyword = strtrim((const char *)LEXTEXT, TRIM_HEAD, NULL);
1071 put_reserved_word(LEXTEXT);
1072 if (!strcmp(end_of_here_document, keyword)) {
1073 end_of_here_document[0] = '\0';
1074 yy_pop_state();
1075 }
1076 }
1077 YY_BREAK
1078 case 23:
1079 YY_RULE_SETUP
1080 #line 121 "php.l"
1081 {
1082 int c;
1083
1084 put_reserved_word(LEXTEXT);
1085 /*
1086 * include ('aaa/bbb.h');
1087 * include 'aaa/bbb.h';
1088 * ^
1089 */
1090 while ((c = input()) && c != EOF && c != '\n' && isspace(c))
1091 echoc(c);
1092 if (c == EOF)
1093 c = '\n';
1094 if (c == '\n')
1095 unput(c);
1096 else if (c) {
1097 char path[MAXPATHLEN], *p = path;
1098 int sep = 0;
1099
1100 if (c == LEFT_BRACE) {
1101 c = input();
1102 if (c == EOF)
1103 c = '\n';
1104 }
1105 if (c == '"' || c == '\'')
1106 sep = c;
1107 echoc(c);
1108
1109 /* pick up path name */
1110 while ((c = input()) && c != EOF && c != '\n' && c != sep)
1111 *p++ = c;
1112 *p = '\0';
1113 if (c == EOF)
1114 c = '\n';
1115 if (c == sep) {
1116 char tmp[MAXPATHLEN];
1117 char normalized_path[MAXPATHLEN];
1118
1119 snprintf(tmp, sizeof(tmp), "%s/%s", get_current_dir(), path);
1120 /*
1121 * pick up the file only when it exists.
1122 */
1123 if (normalize(tmp, get_root_with_slash(), get_cwd(), normalized_path, sizeof(normalized_path))
1124 && test("f", normalized_path))
1125 put_include_anchor_direct(normalized_path, path);
1126 else
1127 echos(path);
1128 echoc(sep);
1129 } else {
1130 echos(path);
1131 if (c)
1132 unput(c);
1133 }
1134 }
1135 }
1136 YY_BREAK
1137 case 24:
1138 YY_RULE_SETUP
1139 #line 176 "php.l"
1140 ECHO;
1141 YY_BREAK
1142 case 25:
1143 #line 178 "php.l"
1144 case 26:
1145 YY_RULE_SETUP
1146 #line 178 "php.l"
1147 {
1148 struct anchor *a = NULL;
1149 const char *p = LEXTEXT + 1; /* skip '$' */
1150 int brace = 0, i = 0;
1151
1152 /*
1153 * extract name.
1154 */
1155 if (*p == '{') {
1156 char buf[IDENTLEN];
1157
1158 brace = 1;
1159 for (p++; *p && *p != '}'; p++) {
1160 buf[i++] = *p;
1161 if (i >= sizeof(buf))
1162 die("Too long name '%s'.", LEXTEXT);
1163 }
1164 buf[i] = '\0';
1165 p = buf;
1166 } else {
1167 i = LEXLENG - 1;
1168 }
1169 if ((a = anchor_get(p, i, 'Y', LINENO)) != NULL) {
1170 echoc('$');
1171 if (brace)
1172 echoc('{');
1173 put_anchor(gettag(a), a->type, LINENO);
1174 if (brace)
1175 echoc('}');
1176 a->done = 1;
1177 } else if (grtags_is_empty) {
1178 echoc('$');
1179 if (brace)
1180 echoc('{');
1181 put_anchor_force(LEXTEXT, LEXLENG, LINENO);
1182 if (brace)
1183 echoc('}');
1184 } else {
1185 ECHO;
1186 }
1187 }
1188 YY_BREAK
1189 case 27:
1190 YY_RULE_SETUP
1191 #line 219 "php.l"
1192 {
1193 struct anchor *a = NULL;
1194 if (php_reserved_word(LEXTEXT, LEXLENG))
1195 put_reserved_word(LEXTEXT);
1196 else {
1197 a = anchor_get(LEXTEXT, LEXLENG, 0, LINENO);
1198 if (a) {
1199 put_anchor(gettag(a), a->type, LINENO);
1200 a->done = 1;
1201 } else if (grtags_is_empty) {
1202 put_anchor_force(LEXTEXT, LEXLENG, LINENO);
1203 } else {
1204 ECHO;
1205 }
1206 }
1207 }
1208 YY_BREAK
1209 case 28:
1210 YY_RULE_SETUP
1211 #line 235 "php.l"
1212 { put_brace(LEXTEXT); }
1213 YY_BREAK
1214 /* New line */
1215 case 29:
1216 /* rule 29 can match eol */
1217 YY_RULE_SETUP
1218 #line 237 "php.l"
1219 {
1220 DEFAULT_END_OF_LINE_ACTION
1221 if (pre_here_document == 1) {
1222 pre_here_document = 0;
1223 yy_push_state(HEREDOCUMENT);
1224 }
1225 }
1226 YY_BREAK
1227 case 30:
1228 YY_RULE_SETUP
1229 #line 244 "php.l"
1230 { put_char(LEXTEXT[0]); }
1231 YY_BREAK
1232 case 31:
1233 YY_RULE_SETUP
1234 #line 246 "php.l"
1235 ECHO;
1236 YY_BREAK
1237 #line 1238 "php.c"
1238 case YY_STATE_EOF(INITIAL):
1239 case YY_STATE_EOF(PHP):
1240 case YY_STATE_EOF(C_COMMENT):
1241 case YY_STATE_EOF(CPP_COMMENT):
1242 case YY_STATE_EOF(SHELL_COMMENT):
1243 case YY_STATE_EOF(STRING):
1244 case YY_STATE_EOF(LITERAL):
1245 case YY_STATE_EOF(HEREDOCUMENT):
1246 case YY_STATE_EOF(PREPROCESSOR_LINE):
1247 yyterminate();
1248
1249 case YY_END_OF_BUFFER:
1250 {
1251 /* Amount of text matched not including the EOB char. */
1252 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1253
1254 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1255 *yy_cp = (yy_hold_char);
1256 YY_RESTORE_YY_MORE_OFFSET
1257
1258 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1259 {
1260 /* We're scanning a new file or input source. It's
1261 * possible that this happened because the user
1262 * just pointed php_in at a new source and called
1263 * php_lex(). If so, then we have to assure
1264 * consistency between YY_CURRENT_BUFFER and our
1265 * globals. Here is the right place to do so, because
1266 * this is the first action (other than possibly a
1267 * back-up) that will match for the new input source.
1268 */
1269 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1270 YY_CURRENT_BUFFER_LVALUE->yy_input_file = php_in;
1271 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1272 }
1273
1274 /* Note that here we test for yy_c_buf_p "<=" to the position
1275 * of the first EOB in the buffer, since yy_c_buf_p will
1276 * already have been incremented past the NUL character
1277 * (since all states make transitions on EOB to the
1278 * end-of-buffer state). Contrast this with the test
1279 * in input().
1280 */
1281 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1282 { /* This was really a NUL. */
1283 yy_state_type yy_next_state;
1284
1285 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1286
1287 yy_current_state = yy_get_previous_state( );
1288
1289 /* Okay, we're now positioned to make the NUL
1290 * transition. We couldn't have
1291 * yy_get_previous_state() go ahead and do it
1292 * for us because it doesn't know how to deal
1293 * with the possibility of jamming (and we don't
1294 * want to build jamming into it because then it
1295 * will run more slowly).
1296 */
1297
1298 yy_next_state = yy_try_NUL_trans( yy_current_state );
1299
1300 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1301
1302 if ( yy_next_state )
1303 {
1304 /* Consume the NUL. */
1305 yy_cp = ++(yy_c_buf_p);
1306 yy_current_state = yy_next_state;
1307 goto yy_match;
1308 }
1309
1310 else
1311 {
1312 yy_cp = (yy_last_accepting_cpos);
1313 yy_current_state = (yy_last_accepting_state);
1314 goto yy_find_action;
1315 }
1316 }
1317
1318 else switch ( yy_get_next_buffer( ) )
1319 {
1320 case EOB_ACT_END_OF_FILE:
1321 {
1322 (yy_did_buffer_switch_on_eof) = 0;
1323
1324 if ( php_wrap( ) )
1325 {
1326 /* Note: because we've taken care in
1327 * yy_get_next_buffer() to have set up
1328 * php_text, we can now set up
1329 * yy_c_buf_p so that if some total
1330 * hoser (like flex itself) wants to
1331 * call the scanner after we return the
1332 * YY_NULL, it'll still work - another
1333 * YY_NULL will get returned.
1334 */
1335 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1336
1337 yy_act = YY_STATE_EOF(YY_START);
1338 goto do_action;
1339 }
1340
1341 else
1342 {
1343 if ( ! (yy_did_buffer_switch_on_eof) )
1344 YY_NEW_FILE;
1345 }
1346 break;
1347 }
1348
1349 case EOB_ACT_CONTINUE_SCAN:
1350 (yy_c_buf_p) =
1351 (yytext_ptr) + yy_amount_of_matched_text;
1352
1353 yy_current_state = yy_get_previous_state( );
1354
1355 yy_cp = (yy_c_buf_p);
1356 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1357 goto yy_match;
1358
1359 case EOB_ACT_LAST_MATCH:
1360 (yy_c_buf_p) =
1361 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1362
1363 yy_current_state = yy_get_previous_state( );
1364
1365 yy_cp = (yy_c_buf_p);
1366 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1367 goto yy_find_action;
1368 }
1369 break;
1370 }
1371
1372 default:
1373 YY_FATAL_ERROR(
1374 "fatal flex scanner internal error--no action found" );
1375 } /* end of action switch */
1376 } /* end of scanning one token */
1377 } /* end of php_lex */
1378
1379 /* yy_get_next_buffer - try to read in a new buffer
1380 *
1381 * Returns a code representing an action:
1382 * EOB_ACT_LAST_MATCH -
1383 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1384 * EOB_ACT_END_OF_FILE - end of file
1385 */
1386 static int yy_get_next_buffer (void)
1387 {
1388 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1389 register char *source = (yytext_ptr);
1390 register int number_to_move, i;
1391 int ret_val;
1392
1393 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1394 YY_FATAL_ERROR(
1395 "fatal flex scanner internal error--end of buffer missed" );
1396
1397 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1398 { /* Don't try to fill the buffer, so this is an EOF. */
1399 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1400 {
1401 /* We matched a single character, the EOB, so
1402 * treat this as a final EOF.
1403 */
1404 return EOB_ACT_END_OF_FILE;
1405 }
1406
1407 else
1408 {
1409 /* We matched some text prior to the EOB, first
1410 * process it.
1411 */
1412 return EOB_ACT_LAST_MATCH;
1413 }
1414 }
1415
1416 /* Try to read more data. */
1417
1418 /* First move last chars to start of buffer. */
1419 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1420
1421 for ( i = 0; i < number_to_move; ++i )
1422 *(dest++) = *(source++);
1423
1424 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1425 /* don't do the read, it's not guaranteed to return an EOF,
1426 * just force an EOF
1427 */
1428 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1429
1430 else
1431 {
1432 int num_to_read =
1433 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1434
1435 while ( num_to_read <= 0 )
1436 { /* Not enough room in the buffer - grow it. */
1437
1438 /* just a shorter name for the current buffer */
1439 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1440
1441 int yy_c_buf_p_offset =
1442 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1443
1444 if ( b->yy_is_our_buffer )
1445 {
1446 int new_size = b->yy_buf_size * 2;
1447
1448 if ( new_size <= 0 )
1449 b->yy_buf_size += b->yy_buf_size / 8;
1450 else
1451 b->yy_buf_size *= 2;
1452
1453 b->yy_ch_buf = (char *)
1454 /* Include room in for 2 EOB chars. */
1455 php_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1456 }
1457 else
1458 /* Can't grow it, we don't own it. */
1459 b->yy_ch_buf = 0;
1460
1461 if ( ! b->yy_ch_buf )
1462 YY_FATAL_ERROR(
1463 "fatal error - scanner input buffer overflow" );
1464
1465 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1466
1467 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1468 number_to_move - 1;
1469
1470 }
1471
1472 if ( num_to_read > YY_READ_BUF_SIZE )
1473 num_to_read = YY_READ_BUF_SIZE;
1474
1475 /* Read in more data. */
1476 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1477 (yy_n_chars), (size_t) num_to_read );
1478
1479 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1480 }
1481
1482 if ( (yy_n_chars) == 0 )
1483 {
1484 if ( number_to_move == YY_MORE_ADJ )
1485 {
1486 ret_val = EOB_ACT_END_OF_FILE;
1487 php_restart(php_in );
1488 }
1489
1490 else
1491 {
1492 ret_val = EOB_ACT_LAST_MATCH;
1493 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1494 YY_BUFFER_EOF_PENDING;
1495 }
1496 }
1497
1498 else
1499 ret_val = EOB_ACT_CONTINUE_SCAN;
1500
1501 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1502 /* Extend the array by 50%, plus the number we really need. */
1503 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1504 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) php_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1505 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1506 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1507 }
1508
1509 (yy_n_chars) += number_to_move;
1510 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1511 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1512
1513 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1514
1515 return ret_val;
1516 }
1517
1518 /* yy_get_previous_state - get the state just before the EOB char was reached */
1519
1520 static yy_state_type yy_get_previous_state (void)
1521 {
1522 register yy_state_type yy_current_state;
1523 register char *yy_cp;
1524
1525 yy_current_state = (yy_start);
1526 yy_current_state += YY_AT_BOL();
1527
1528 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1529 {
1530 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1531 if ( yy_accept[yy_current_state] )
1532 {
1533 (yy_last_accepting_state) = yy_current_state;
1534 (yy_last_accepting_cpos) = yy_cp;
1535 }
1536 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1537 {
1538 yy_current_state = (int) yy_def[yy_current_state];
1539 if ( yy_current_state >= 163 )
1540 yy_c = yy_meta[(unsigned int) yy_c];
1541 }
1542 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1543 }
1544
1545 return yy_current_state;
1546 }
1547
1548 /* yy_try_NUL_trans - try to make a transition on the NUL character
1549 *
1550 * synopsis
1551 * next_state = yy_try_NUL_trans( current_state );
1552 */
1553 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1554 {
1555 register int yy_is_jam;
1556 register char *yy_cp = (yy_c_buf_p);
1557
1558 register YY_CHAR yy_c = 1;
1559 if ( yy_accept[yy_current_state] )
1560 {
1561 (yy_last_accepting_state) = yy_current_state;
1562 (yy_last_accepting_cpos) = yy_cp;
1563 }
1564 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1565 {
1566 yy_current_state = (int) yy_def[yy_current_state];
1567 if ( yy_current_state >= 163 )
1568 yy_c = yy_meta[(unsigned int) yy_c];
1569 }
1570 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1571 yy_is_jam = (yy_current_state == 162);
1572
1573 return yy_is_jam ? 0 : yy_current_state;
1574 }
1575
1576 static void yyunput (int c, register char * yy_bp )
1577 {
1578 register char *yy_cp;
1579
1580 yy_cp = (yy_c_buf_p);
1581
1582 /* undo effects of setting up php_text */
1583 *yy_cp = (yy_hold_char);
1584
1585 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1586 { /* need to shift things up to make room */
1587 /* +2 for EOB chars. */
1588 register int number_to_move = (yy_n_chars) + 2;
1589 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1590 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1591 register char *source =
1592 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1593
1594 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1595 *--dest = *--source;
1596
1597 yy_cp += (int) (dest - source);
1598 yy_bp += (int) (dest - source);
1599 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1600 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1601
1602 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1603 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1604 }
1605
1606 *--yy_cp = (char) c;
1607
1608 (yytext_ptr) = yy_bp;
1609 (yy_hold_char) = *yy_cp;
1610 (yy_c_buf_p) = yy_cp;
1611 }
1612
1613 #ifndef YY_NO_INPUT
1614 #ifdef __cplusplus
1615 static int yyinput (void)
1616 #else
1617 static int input (void)
1618 #endif
1619
1620 {
1621 int c;
1622
1623 *(yy_c_buf_p) = (yy_hold_char);
1624
1625 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1626 {
1627 /* yy_c_buf_p now points to the character we want to return.
1628 * If this occurs *before* the EOB characters, then it's a
1629 * valid NUL; if not, then we've hit the end of the buffer.
1630 */
1631 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1632 /* This was really a NUL. */
1633 *(yy_c_buf_p) = '\0';
1634
1635 else
1636 { /* need more input */
1637 int offset = (yy_c_buf_p) - (yytext_ptr);
1638 ++(yy_c_buf_p);
1639
1640 switch ( yy_get_next_buffer( ) )
1641 {
1642 case EOB_ACT_LAST_MATCH:
1643 /* This happens because yy_g_n_b()
1644 * sees that we've accumulated a
1645 * token and flags that we need to
1646 * try matching the token before
1647 * proceeding. But for input(),
1648 * there's no matching to consider.
1649 * So convert the EOB_ACT_LAST_MATCH
1650 * to EOB_ACT_END_OF_FILE.
1651 */
1652
1653 /* Reset buffer status. */
1654 php_restart(php_in );
1655
1656 /*FALLTHROUGH*/
1657
1658 case EOB_ACT_END_OF_FILE:
1659 {
1660 if ( php_wrap( ) )
1661 return EOF;
1662
1663 if ( ! (yy_did_buffer_switch_on_eof) )
1664 YY_NEW_FILE;
1665 #ifdef __cplusplus
1666 return yyinput();
1667 #else
1668 return input();
1669 #endif
1670 }
1671
1672 case EOB_ACT_CONTINUE_SCAN:
1673 (yy_c_buf_p) = (yytext_ptr) + offset;
1674 break;
1675 }
1676 }
1677 }
1678
1679 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1680 *(yy_c_buf_p) = '\0'; /* preserve php_text */
1681 (yy_hold_char) = *++(yy_c_buf_p);
1682
1683 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1684
1685 return c;
1686 }
1687 #endif /* ifndef YY_NO_INPUT */
1688
1689 /** Immediately switch to a different input stream.
1690 * @param input_file A readable stream.
1691 *
1692 * @note This function does not reset the start condition to @c INITIAL .
1693 */
1694 void php_restart (FILE * input_file )
1695 {
1696
1697 if ( ! YY_CURRENT_BUFFER ){
1698 php_ensure_buffer_stack ();
1699 YY_CURRENT_BUFFER_LVALUE =
1700 php__create_buffer(php_in,YY_BUF_SIZE );
1701 }
1702
1703 php__init_buffer(YY_CURRENT_BUFFER,input_file );
1704 php__load_buffer_state( );
1705 }
1706
1707 /** Switch to a different input buffer.
1708 * @param new_buffer The new input buffer.
1709 *
1710 */
1711 void php__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1712 {
1713
1714 /* TODO. We should be able to replace this entire function body
1715 * with
1716 * php_pop_buffer_state();
1717 * php_push_buffer_state(new_buffer);
1718 */
1719 php_ensure_buffer_stack ();
1720 if ( YY_CURRENT_BUFFER == new_buffer )
1721 return;
1722
1723 if ( YY_CURRENT_BUFFER )
1724 {
1725 /* Flush out information for old buffer. */
1726 *(yy_c_buf_p) = (yy_hold_char);
1727 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1728 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1729 }
1730
1731 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1732 php__load_buffer_state( );
1733
1734 /* We don't actually know whether we did this switch during
1735 * EOF (php_wrap()) processing, but the only time this flag
1736 * is looked at is after php_wrap() is called, so it's safe
1737 * to go ahead and always set it.
1738 */
1739 (yy_did_buffer_switch_on_eof) = 1;
1740 }
1741
1742 static void php__load_buffer_state (void)
1743 {
1744 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1745 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1746 php_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1747 (yy_hold_char) = *(yy_c_buf_p);
1748 }
1749
1750 /** Allocate and initialize an input buffer state.
1751 * @param file A readable stream.
1752 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1753 *
1754 * @return the allocated buffer state.
1755 */
1756 YY_BUFFER_STATE php__create_buffer (FILE * file, int size )
1757 {
1758 YY_BUFFER_STATE b;
1759
1760 b = (YY_BUFFER_STATE) php_alloc(sizeof( struct yy_buffer_state ) );
1761 if ( ! b )
1762 YY_FATAL_ERROR( "out of dynamic memory in php__create_buffer()" );
1763
1764 b->yy_buf_size = size;
1765
1766 /* yy_ch_buf has to be 2 characters longer than the size given because
1767 * we need to put in 2 end-of-buffer characters.
1768 */
1769 b->yy_ch_buf = (char *) php_alloc(b->yy_buf_size + 2 );
1770 if ( ! b->yy_ch_buf )
1771 YY_FATAL_ERROR( "out of dynamic memory in php__create_buffer()" );
1772
1773 b->yy_is_our_buffer = 1;
1774
1775 php__init_buffer(b,file );
1776
1777 return b;
1778 }
1779
1780 /** Destroy the buffer.
1781 * @param b a buffer created with php__create_buffer()
1782 *
1783 */
1784 void php__delete_buffer (YY_BUFFER_STATE b )
1785 {
1786
1787 if ( ! b )
1788 return;
1789
1790 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1791 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1792
1793 if ( b->yy_is_our_buffer )
1794 php_free((void *) b->yy_ch_buf );
1795
1796 php_free((void *) b );
1797 }
1798
1799 /* Initializes or reinitializes a buffer.
1800 * This function is sometimes called more than once on the same buffer,
1801 * such as during a php_restart() or at EOF.
1802 */
1803 static void php__init_buffer (YY_BUFFER_STATE b, FILE * file )
1804
1805 {
1806 int oerrno = errno;
1807
1808 php__flush_buffer(b );
1809
1810 b->yy_input_file = file;
1811 b->yy_fill_buffer = 1;
1812
1813 /* If b is the current buffer, then php__init_buffer was _probably_
1814 * called from php_restart() or through yy_get_next_buffer.
1815 * In that case, we don't want to reset the lineno or column.
1816 */
1817 if (b != YY_CURRENT_BUFFER){
1818 b->yy_bs_lineno = 1;
1819 b->yy_bs_column = 0;
1820 }
1821
1822 b->yy_is_interactive = 0;
1823
1824 errno = oerrno;
1825 }
1826
1827 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1828 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1829 *
1830 */
1831 void php__flush_buffer (YY_BUFFER_STATE b )
1832 {
1833 if ( ! b )
1834 return;
1835
1836 b->yy_n_chars = 0;
1837
1838 /* We always need two end-of-buffer characters. The first causes
1839 * a transition to the end-of-buffer state. The second causes
1840 * a jam in that state.
1841 */
1842 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1843 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1844
1845 b->yy_buf_pos = &b->yy_ch_buf[0];
1846
1847 b->yy_at_bol = 1;
1848 b->yy_buffer_status = YY_BUFFER_NEW;
1849
1850 if ( b == YY_CURRENT_BUFFER )
1851 php__load_buffer_state( );
1852 }
1853
1854 /** Pushes the new state onto the stack. The new state becomes
1855 * the current state. This function will allocate the stack
1856 * if necessary.
1857 * @param new_buffer The new state.
1858 *
1859 */
1860 void php_push_buffer_state (YY_BUFFER_STATE new_buffer )
1861 {
1862 if (new_buffer == NULL)
1863 return;
1864
1865 php_ensure_buffer_stack();
1866
1867 /* This block is copied from php__switch_to_buffer. */
1868 if ( YY_CURRENT_BUFFER )
1869 {
1870 /* Flush out information for old buffer. */
1871 *(yy_c_buf_p) = (yy_hold_char);
1872 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1873 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1874 }
1875
1876 /* Only push if top exists. Otherwise, replace top. */
1877 if (YY_CURRENT_BUFFER)
1878 (yy_buffer_stack_top)++;
1879 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1880
1881 /* copied from php__switch_to_buffer. */
1882 php__load_buffer_state( );
1883 (yy_did_buffer_switch_on_eof) = 1;
1884 }
1885
1886 /** Removes and deletes the top of the stack, if present.
1887 * The next element becomes the new top.
1888 *
1889 */
1890 void php_pop_buffer_state (void)
1891 {
1892 if (!YY_CURRENT_BUFFER)
1893 return;
1894
1895 php__delete_buffer(YY_CURRENT_BUFFER );
1896 YY_CURRENT_BUFFER_LVALUE = NULL;
1897 if ((yy_buffer_stack_top) > 0)
1898 --(yy_buffer_stack_top);
1899
1900 if (YY_CURRENT_BUFFER) {
1901 php__load_buffer_state( );
1902 (yy_did_buffer_switch_on_eof) = 1;
1903 }
1904 }
1905
1906 /* Allocates the stack if it does not exist.
1907 * Guarantees space for at least one push.
1908 */
1909 static void php_ensure_buffer_stack (void)
1910 {
1911 int num_to_alloc;
1912
1913 if (!(yy_buffer_stack)) {
1914
1915 /* First allocation is just for 2 elements, since we don't know if this
1916 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1917 * immediate realloc on the next call.
1918 */
1919 num_to_alloc = 1;
1920 (yy_buffer_stack) = (struct yy_buffer_state**)php_alloc
1921 (num_to_alloc * sizeof(struct yy_buffer_state*)
1922 );
1923 if ( ! (yy_buffer_stack) )
1924 YY_FATAL_ERROR( "out of dynamic memory in php_ensure_buffer_stack()" );
1925
1926 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1927
1928 (yy_buffer_stack_max) = num_to_alloc;
1929 (yy_buffer_stack_top) = 0;
1930 return;
1931 }
1932
1933 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1934
1935 /* Increase the buffer to prepare for a possible push. */
1936 int grow_size = 8 /* arbitrary grow size */;
1937
1938 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1939 (yy_buffer_stack) = (struct yy_buffer_state**)php_realloc
1940 ((yy_buffer_stack),
1941 num_to_alloc * sizeof(struct yy_buffer_state*)
1942 );
1943 if ( ! (yy_buffer_stack) )
1944 YY_FATAL_ERROR( "out of dynamic memory in php_ensure_buffer_stack()" );
1945
1946 /* zero only the new slots.*/
1947 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1948 (yy_buffer_stack_max) = num_to_alloc;
1949 }
1950 }
1951
1952 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1953 * @param base the character buffer
1954 * @param size the size in bytes of the character buffer
1955 *
1956 * @return the newly allocated buffer state object.
1957 */
1958 YY_BUFFER_STATE php__scan_buffer (char * base, yy_size_t size )
1959 {
1960 YY_BUFFER_STATE b;
1961
1962 if ( size < 2 ||
1963 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1964 base[size-1] != YY_END_OF_BUFFER_CHAR )
1965 /* They forgot to leave room for the EOB's. */
1966 return 0;
1967
1968 b = (YY_BUFFER_STATE) php_alloc(sizeof( struct yy_buffer_state ) );
1969 if ( ! b )
1970 YY_FATAL_ERROR( "out of dynamic memory in php__scan_buffer()" );
1971
1972 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1973 b->yy_buf_pos = b->yy_ch_buf = base;
1974 b->yy_is_our_buffer = 0;
1975 b->yy_input_file = 0;
1976 b->yy_n_chars = b->yy_buf_size;
1977 b->yy_is_interactive = 0;
1978 b->yy_at_bol = 1;
1979 b->yy_fill_buffer = 0;
1980 b->yy_buffer_status = YY_BUFFER_NEW;
1981
1982 php__switch_to_buffer(b );
1983
1984 return b;
1985 }
1986
1987 /** Setup the input buffer state to scan a string. The next call to php_lex() will
1988 * scan from a @e copy of @a str.
1989 * @param yystr a NUL-terminated string to scan
1990 *
1991 * @return the newly allocated buffer state object.
1992 * @note If you want to scan bytes that may contain NUL values, then use
1993 * php__scan_bytes() instead.
1994 */
1995 YY_BUFFER_STATE php__scan_string (yyconst char * yystr )
1996 {
1997
1998 return php__scan_bytes(yystr,strlen(yystr) );
1999 }
2000
2001 /** Setup the input buffer state to scan the given bytes. The next call to php_lex() will
2002 * scan from a @e copy of @a bytes.
2003 * @param bytes the byte buffer to scan
2004 * @param len the number of bytes in the buffer pointed to by @a bytes.
2005 *
2006 * @return the newly allocated buffer state object.
2007 */
2008 YY_BUFFER_STATE php__scan_bytes (yyconst char * yybytes, int _yybytes_len )
2009 {
2010 YY_BUFFER_STATE b;
2011 char *buf;
2012 yy_size_t n;
2013 int i;
2014
2015 /* Get memory for full buffer, including space for trailing EOB's. */
2016 n = _yybytes_len + 2;
2017 buf = (char *) php_alloc(n );
2018 if ( ! buf )
2019 YY_FATAL_ERROR( "out of dynamic memory in php__scan_bytes()" );
2020
2021 for ( i = 0; i < _yybytes_len; ++i )
2022 buf[i] = yybytes[i];
2023
2024 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2025
2026 b = php__scan_buffer(buf,n );
2027 if ( ! b )
2028 YY_FATAL_ERROR( "bad buffer in php__scan_bytes()" );
2029
2030 /* It's okay to grow etc. this buffer, and we should throw it
2031 * away when we're done.
2032 */
2033 b->yy_is_our_buffer = 1;
2034
2035 return b;
2036 }
2037
2038 static void yy_push_state (int new_state )
2039 {
2040 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
2041 {
2042 yy_size_t new_size;
2043
2044 (yy_start_stack_depth) += YY_START_STACK_INCR;
2045 new_size = (yy_start_stack_depth) * sizeof( int );
2046
2047 if ( ! (yy_start_stack) )
2048 (yy_start_stack) = (int *) php_alloc(new_size );
2049
2050 else
2051 (yy_start_stack) = (int *) php_realloc((void *) (yy_start_stack),new_size );
2052
2053 if ( ! (yy_start_stack) )
2054 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2055 }
2056
2057 (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
2058
2059 BEGIN(new_state);
2060 }
2061
2062 static void yy_pop_state (void)
2063 {
2064 if ( --(yy_start_stack_ptr) < 0 )
2065 YY_FATAL_ERROR( "start-condition stack underflow" );
2066
2067 BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
2068 }
2069
2070 #ifndef YY_EXIT_FAILURE
2071 #define YY_EXIT_FAILURE 2
2072 #endif
2073
2074 static void yy_fatal_error (yyconst char* msg )
2075 {
2076 (void) fprintf( stderr, "%s\n", msg );
2077 exit( YY_EXIT_FAILURE );
2078 }
2079
2080 /* Redefine yyless() so it works in section 3 code. */
2081
2082 #undef yyless
2083 #define yyless(n) \
2084 do \
2085 { \
2086 /* Undo effects of setting up php_text. */ \
2087 int yyless_macro_arg = (n); \
2088 YY_LESS_LINENO(yyless_macro_arg);\
2089 php_text[php_leng] = (yy_hold_char); \
2090 (yy_c_buf_p) = php_text + yyless_macro_arg; \
2091 (yy_hold_char) = *(yy_c_buf_p); \
2092 *(yy_c_buf_p) = '\0'; \
2093 php_leng = yyless_macro_arg; \
2094 } \
2095 while ( 0 )
2096
2097 /* Accessor methods (get/set functions) to struct members. */
2098
2099 /** Get the current line number.
2100 *
2101 */
2102 int php_get_lineno (void)
2103 {
2104
2105 return php_lineno;
2106 }
2107
2108 /** Get the input stream.
2109 *
2110 */
2111 FILE *php_get_in (void)
2112 {
2113 return php_in;
2114 }
2115
2116 /** Get the output stream.
2117 *
2118 */
2119 FILE *php_get_out (void)
2120 {
2121 return php_out;
2122 }
2123
2124 /** Get the length of the current token.
2125 *
2126 */
2127 int php_get_leng (void)
2128 {
2129 return php_leng;
2130 }
2131
2132 /** Get the current token.
2133 *
2134 */
2135
2136 char *php_get_text (void)
2137 {
2138 return php_text;
2139 }
2140
2141 /** Set the current line number.
2142 * @param line_number
2143 *
2144 */
2145 void php_set_lineno (int line_number )
2146 {
2147
2148 php_lineno = line_number;
2149 }
2150
2151 /** Set the input stream. This does not discard the current
2152 * input buffer.
2153 * @param in_str A readable stream.
2154 *
2155 * @see php__switch_to_buffer
2156 */
2157 void php_set_in (FILE * in_str )
2158 {
2159 php_in = in_str ;
2160 }
2161
2162 void php_set_out (FILE * out_str )
2163 {
2164 php_out = out_str ;
2165 }
2166
2167 int php_get_debug (void)
2168 {
2169 return php__flex_debug;
2170 }
2171
2172 void php_set_debug (int bdebug )
2173 {
2174 php__flex_debug = bdebug ;
2175 }
2176
2177 static int yy_init_globals (void)
2178 {
2179 /* Initialization is the same as for the non-reentrant scanner.
2180 * This function is called from php_lex_destroy(), so don't allocate here.
2181 */
2182
2183 (yy_buffer_stack) = 0;
2184 (yy_buffer_stack_top) = 0;
2185 (yy_buffer_stack_max) = 0;
2186 (yy_c_buf_p) = (char *) 0;
2187 (yy_init) = 0;
2188 (yy_start) = 0;
2189
2190 (yy_start_stack_ptr) = 0;
2191 (yy_start_stack_depth) = 0;
2192 (yy_start_stack) = NULL;
2193
2194 /* Defined in main.c */
2195 #ifdef YY_STDINIT
2196 php_in = stdin;
2197 php_out = stdout;
2198 #else
2199 php_in = (FILE *) 0;
2200 php_out = (FILE *) 0;
2201 #endif
2202
2203 /* For future reference: Set errno on error, since we are called by
2204 * php_lex_init()
2205 */
2206 return 0;
2207 }
2208
2209 /* php_lex_destroy is for both reentrant and non-reentrant scanners. */
2210 int php_lex_destroy (void)
2211 {
2212
2213 /* Pop the buffer stack, destroying each element. */
2214 while(YY_CURRENT_BUFFER){
2215 php__delete_buffer(YY_CURRENT_BUFFER );
2216 YY_CURRENT_BUFFER_LVALUE = NULL;
2217 php_pop_buffer_state();
2218 }
2219
2220 /* Destroy the stack itself. */
2221 php_free((yy_buffer_stack) );
2222 (yy_buffer_stack) = NULL;
2223
2224 /* Destroy the start condition stack. */
2225 php_free((yy_start_stack) );
2226 (yy_start_stack) = NULL;
2227
2228 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2229 * php_lex() is called, initialization will occur. */
2230 yy_init_globals( );
2231
2232 return 0;
2233 }
2234
2235 /*
2236 * Internal utility routines.
2237 */
2238
2239 #ifndef yytext_ptr
2240 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2241 {
2242 register int i;
2243 for ( i = 0; i < n; ++i )
2244 s1[i] = s2[i];
2245 }
2246 #endif
2247
2248 #ifdef YY_NEED_STRLEN
2249 static int yy_flex_strlen (yyconst char * s )
2250 {
2251 register int n;
2252 for ( n = 0; s[n]; ++n )
2253 ;
2254
2255 return n;
2256 }
2257 #endif
2258
2259 void *php_alloc (yy_size_t size )
2260 {
2261 return (void *) malloc( size );
2262 }
2263
2264 void *php_realloc (void * ptr, yy_size_t size )
2265 {
2266 /* The cast to (char *) in the following accommodates both
2267 * implementations that use char* generic pointers, and those
2268 * that use void* generic pointers. It works with the latter
2269 * because both ANSI C and C++ allow castless assignment from
2270 * any pointer type to void*, and deal with argument conversions
2271 * as though doing an assignment.
2272 */
2273 return (void *) realloc( (char *) ptr, size );
2274 }
2275
2276 void php_free (void * ptr )
2277 {
2278 free( (char *) ptr ); /* see php_realloc() for (char *) cast */
2279 }
2280
2281 #define YYTABLES_NAME "yytables"
2282
2283 #line 246 "php.l"
2284
2285
2286 void
2287 php_parser_init(FILE *ip)
2288 {
2289 DEFAULT_BEGIN_OF_FILE_ACTION
2290 }
2291
/* */