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