stash 1.0.0 → 2.0.0

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