bool 1.0.10 → 1.0.11

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