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