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