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