5
#define YY_INT_ALIGNED short int
7
/* A lexical scanner generated by flex */
9
#define yy_create_buffer cube_yy_create_buffer
10
#define yy_delete_buffer cube_yy_delete_buffer
11
#define yy_flex_debug cube_yy_flex_debug
12
#define yy_init_buffer cube_yy_init_buffer
13
#define yy_flush_buffer cube_yy_flush_buffer
14
#define yy_load_buffer_state cube_yy_load_buffer_state
15
#define yy_switch_to_buffer cube_yy_switch_to_buffer
16
#define yyin cube_yyin
17
#define yyleng cube_yyleng
18
#define yylex cube_yylex
19
#define yylineno cube_yylineno
20
#define yyout cube_yyout
21
#define yyrestart cube_yyrestart
22
#define yytext cube_yytext
23
#define yywrap cube_yywrap
24
#define yyalloc cube_yyalloc
25
#define yyrealloc cube_yyrealloc
26
#define yyfree cube_yyfree
29
#define YY_FLEX_MAJOR_VERSION 2
30
#define YY_FLEX_MINOR_VERSION 5
31
#define YY_FLEX_SUBMINOR_VERSION 35
32
#if YY_FLEX_SUBMINOR_VERSION > 0
36
/* First, we deal with platform-specific or compiler-specific issues. */
38
/* begin standard C headers. */
44
/* end standard C headers. */
46
/* flex integer type definitions */
51
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
53
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
55
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56
* if you want the limit (max/min) macros for int types.
58
#ifndef __STDC_LIMIT_MACROS
59
#define __STDC_LIMIT_MACROS 1
63
typedef int8_t flex_int8_t;
64
typedef uint8_t flex_uint8_t;
65
typedef int16_t flex_int16_t;
66
typedef uint16_t flex_uint16_t;
67
typedef int32_t flex_int32_t;
68
typedef uint32_t flex_uint32_t;
70
typedef signed char flex_int8_t;
71
typedef short int flex_int16_t;
72
typedef int flex_int32_t;
73
typedef unsigned char flex_uint8_t;
74
typedef unsigned short int flex_uint16_t;
75
typedef unsigned int flex_uint32_t;
78
/* Limits of integral types. */
80
#define INT8_MIN (-128)
83
#define INT16_MIN (-32767-1)
86
#define INT32_MIN (-2147483647-1)
89
#define INT8_MAX (127)
92
#define INT16_MAX (32767)
95
#define INT32_MAX (2147483647)
98
#define UINT8_MAX (255U)
101
#define UINT16_MAX (65535U)
104
#define UINT32_MAX (4294967295U)
107
#endif /* ! FLEXINT_H */
111
/* The "const" storage-class-modifier is valid. */
114
#else /* ! __cplusplus */
116
/* C99 requires __STDC__ to be defined as 1. */
117
#if defined (__STDC__)
121
#endif /* defined (__STDC__) */
122
#endif /* ! __cplusplus */
125
#define yyconst const
130
/* Returned upon end-of-file. */
133
/* Promotes a possibly negative, possibly signed char to an unsigned
134
* integer for use as an array index. If the signed char is negative,
135
* we want to instead treat it as an 8-bit unsigned char, hence the
138
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
140
/* Enter a start condition. This macro really ought to take a parameter,
141
* but we do it the disgusting crufty way forced on us by the ()-less
142
* definition of BEGIN.
144
#define BEGIN (yy_start) = 1 + 2 *
146
/* Translate the current start state into a value that can be later handed
147
* to BEGIN to return to the state. The YYSTATE alias is for lex
150
#define YY_START (((yy_start) - 1) / 2)
151
#define YYSTATE YY_START
153
/* Action number for EOF rule of a given start state. */
154
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156
/* Special action meaning "start processing a new file". */
157
#define YY_NEW_FILE cube_yyrestart(cube_yyin )
159
#define YY_END_OF_BUFFER_CHAR 0
161
/* Size of default input buffer. */
163
#define YY_BUF_SIZE 16384
166
/* The state buf must be large enough to hold one state per character in the main buffer.
168
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
170
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
171
#define YY_TYPEDEF_YY_BUFFER_STATE
172
typedef struct yy_buffer_state *YY_BUFFER_STATE;
175
extern int cube_yyleng;
177
extern FILE *cube_yyin, *cube_yyout;
179
#define EOB_ACT_CONTINUE_SCAN 0
180
#define EOB_ACT_END_OF_FILE 1
181
#define EOB_ACT_LAST_MATCH 2
183
#define YY_LESS_LINENO(n)
185
/* Return all but the first "n" matched characters back to the input stream. */
189
/* Undo effects of setting up cube_yytext. */ \
190
int yyless_macro_arg = (n); \
191
YY_LESS_LINENO(yyless_macro_arg);\
192
*yy_cp = (yy_hold_char); \
193
YY_RESTORE_YY_MORE_OFFSET \
194
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
195
YY_DO_BEFORE_ACTION; /* set up cube_yytext again */ \
199
#define unput(c) yyunput( c, (yytext_ptr) )
201
#ifndef YY_TYPEDEF_YY_SIZE_T
202
#define YY_TYPEDEF_YY_SIZE_T
203
typedef size_t yy_size_t;
206
#ifndef YY_STRUCT_YY_BUFFER_STATE
207
#define YY_STRUCT_YY_BUFFER_STATE
208
struct yy_buffer_state
212
char *yy_ch_buf; /* input buffer */
213
char *yy_buf_pos; /* current position in input buffer */
215
/* Size of input buffer in bytes, not including room for EOB
218
yy_size_t yy_buf_size;
220
/* Number of characters read into yy_ch_buf, not including EOB
225
/* Whether we "own" the buffer - i.e., we know we created it,
226
* and can realloc() it to grow it, and should free() it to
229
int yy_is_our_buffer;
231
/* Whether this is an "interactive" input source; if so, and
232
* if we're using stdio for input, then we want to use getc()
233
* instead of fread(), to make sure we stop fetching input after
236
int yy_is_interactive;
238
/* Whether we're considered to be at the beginning of a line.
239
* If so, '^' rules will be active on the next match, otherwise
244
int yy_bs_lineno; /**< The line count. */
245
int yy_bs_column; /**< The column count. */
247
/* Whether to try to fill the input buffer when we reach the
252
int yy_buffer_status;
254
#define YY_BUFFER_NEW 0
255
#define YY_BUFFER_NORMAL 1
256
/* When an EOF's been seen but there's still some text to process
257
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
258
* shouldn't try reading from the input source any more. We might
259
* still have a bunch of tokens to match, though, because of
260
* possible backing-up.
262
* When we actually see the EOF, we change the status to "new"
263
* (via cube_yyrestart()), so that the user can continue scanning by
264
* just pointing cube_yyin at a new input file.
266
#define YY_BUFFER_EOF_PENDING 2
269
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
271
/* Stack of input buffers. */
272
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
273
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
274
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
276
/* We provide macros for accessing buffer states in case in the
277
* future we want to put the buffer states in a more general
280
* Returns the top of the stack, or NULL.
282
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
283
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
286
/* Same as previous macro, but useful when we know that the buffer stack is not
287
* NULL or when we need an lvalue. For internal use only.
289
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
291
/* yy_hold_char holds the character lost when cube_yytext is formed. */
292
static char yy_hold_char;
293
static int yy_n_chars; /* number of characters read into yy_ch_buf */
296
/* Points to current character in buffer. */
297
static char *yy_c_buf_p = (char *) 0;
298
static int yy_init = 0; /* whether we need to initialize */
299
static int yy_start = 0; /* start state number */
301
/* Flag which is used to allow cube_yywrap()'s to do buffer switches
302
* instead of setting up a fresh cube_yyin. A bit of a hack ...
304
static int yy_did_buffer_switch_on_eof;
306
void cube_yyrestart (FILE *input_file );
307
void cube_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
308
YY_BUFFER_STATE cube_yy_create_buffer (FILE *file,int size );
309
void cube_yy_delete_buffer (YY_BUFFER_STATE b );
310
void cube_yy_flush_buffer (YY_BUFFER_STATE b );
311
void cube_yypush_buffer_state (YY_BUFFER_STATE new_buffer );
312
void cube_yypop_buffer_state (void );
314
static void cube_yyensure_buffer_stack (void );
315
static void cube_yy_load_buffer_state (void );
316
static void cube_yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
318
#define YY_FLUSH_BUFFER cube_yy_flush_buffer(YY_CURRENT_BUFFER )
320
YY_BUFFER_STATE cube_yy_scan_buffer (char *base,yy_size_t size );
321
YY_BUFFER_STATE cube_yy_scan_string (yyconst char *yy_str );
322
YY_BUFFER_STATE cube_yy_scan_bytes (yyconst char *bytes,int len );
324
void *cube_yyalloc (yy_size_t );
325
void *cube_yyrealloc (void *,yy_size_t );
326
void cube_yyfree (void * );
328
#define yy_new_buffer cube_yy_create_buffer
330
#define yy_set_interactive(is_interactive) \
332
if ( ! YY_CURRENT_BUFFER ){ \
333
cube_yyensure_buffer_stack (); \
334
YY_CURRENT_BUFFER_LVALUE = \
335
cube_yy_create_buffer(cube_yyin,YY_BUF_SIZE ); \
337
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
340
#define yy_set_bol(at_bol) \
342
if ( ! YY_CURRENT_BUFFER ){\
343
cube_yyensure_buffer_stack (); \
344
YY_CURRENT_BUFFER_LVALUE = \
345
cube_yy_create_buffer(cube_yyin,YY_BUF_SIZE ); \
347
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
350
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
352
/* Begin user sect3 */
354
#define cube_yywrap(n) 1
355
#define YY_SKIP_YYWRAP
357
typedef unsigned char YY_CHAR;
359
FILE *cube_yyin = (FILE *) 0, *cube_yyout = (FILE *) 0;
361
typedef int yy_state_type;
363
extern int cube_yylineno;
365
int cube_yylineno = 1;
367
extern char *cube_yytext;
368
#define yytext_ptr cube_yytext
370
static yy_state_type yy_get_previous_state (void );
371
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
372
static int yy_get_next_buffer (void );
373
static void yy_fatal_error (yyconst char msg[] );
375
/* Done after the current pattern has been matched and before the
376
* corresponding action - sets up cube_yytext.
378
#define YY_DO_BEFORE_ACTION \
379
(yytext_ptr) = yy_bp; \
380
cube_yyleng = (size_t) (yy_cp - yy_bp); \
381
(yy_hold_char) = *yy_cp; \
383
(yy_c_buf_p) = yy_cp;
385
#define YY_NUM_RULES 9
386
#define YY_END_OF_BUFFER 10
387
/* This struct is not used in this scanner,
388
but its presence is necessary. */
391
flex_int32_t yy_verify;
394
static yyconst flex_int16_t yy_accept[25] =
396
0, 0, 10, 8, 7, 7, 4, 5, 8, 6,
397
8, 1, 2, 3, 7, 0, 1, 1, 1, 0,
401
static yyconst flex_int32_t yy_ec[256] =
403
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
404
1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
405
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406
1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
407
5, 1, 6, 7, 6, 8, 1, 9, 9, 9,
408
9, 9, 9, 9, 9, 9, 9, 1, 1, 1,
409
1, 1, 1, 1, 1, 1, 1, 1, 10, 1,
410
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412
11, 1, 12, 1, 1, 1, 1, 1, 1, 1,
414
10, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433
static yyconst flex_int32_t yy_meta[13] =
435
1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
439
static yyconst flex_int16_t yy_base[26] =
441
0, 0, 28, 29, 0, 0, 29, 29, 5, 29,
442
18, 7, 29, 29, 0, 17, 0, 9, 16, 14,
446
static yyconst flex_int16_t yy_def[26] =
448
24, 1, 24, 24, 25, 25, 24, 24, 24, 24,
449
24, 24, 24, 24, 25, 24, 12, 24, 18, 24,
453
static yyconst flex_int16_t yy_nxt[42] =
455
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
456
13, 14, 16, 17, 19, 17, 20, 18, 20, 22,
457
15, 23, 23, 23, 21, 18, 18, 24, 3, 24,
458
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
462
static yyconst flex_int16_t yy_chk[42] =
464
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
465
1, 1, 9, 9, 12, 12, 12, 18, 18, 20,
466
25, 23, 20, 22, 19, 16, 11, 3, 24, 24,
467
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
471
static yy_state_type yy_last_accepting_state;
472
static char *yy_last_accepting_cpos;
474
extern int cube_yy_flex_debug;
475
int cube_yy_flex_debug = 0;
477
/* The intent behind this definition is that it'll catch
478
* any uses of REJECT which flex missed.
480
#define REJECT reject_used_but_not_detected
481
#define yymore() yymore_used_but_not_detected
482
#define YY_MORE_ADJ 0
483
#define YY_RESTORE_YY_MORE_OFFSET
488
* A scanner for EMP-style numeric ranges
489
* contrib/cube/cubescan.l
492
#include "postgres.h"
494
/* No reason to constrain amount of data slurped */
495
#define YY_READ_BUF_SIZE 16777216
497
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
499
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
501
/* Handles to the buffer that the lexer uses internally */
502
static YY_BUFFER_STATE scanbufhandle;
503
/* this is now declared in cubeparse.y: */
504
/* static char *scanbuf; */
505
/* static int scanbuflen; */
507
/* flex 2.5.4 doesn't bother with a decl for this */
508
int cube_yylex(void);
510
void cube_scanner_init(const char *str);
511
void cube_scanner_finish(void);
512
#define YY_NO_INPUT 1
513
#line 514 "cubescan.c"
517
#ifndef YY_NO_UNISTD_H
518
/* Special case for "unistd.h", since it is non-ANSI. We include it way
519
* down here because we want the user's section 1 to have been scanned first.
520
* The user has a chance to override it with an option.
525
#ifndef YY_EXTRA_TYPE
526
#define YY_EXTRA_TYPE void *
529
static int yy_init_globals (void );
531
/* Accessor methods to globals.
532
These are made visible to non-reentrant scanners for convenience. */
534
int cube_yylex_destroy (void );
536
int cube_yyget_debug (void );
538
void cube_yyset_debug (int debug_flag );
540
YY_EXTRA_TYPE cube_yyget_extra (void );
542
void cube_yyset_extra (YY_EXTRA_TYPE user_defined );
544
FILE *cube_yyget_in (void );
546
void cube_yyset_in (FILE * in_str );
548
FILE *cube_yyget_out (void );
550
void cube_yyset_out (FILE * out_str );
552
int cube_yyget_leng (void );
554
char *cube_yyget_text (void );
556
int cube_yyget_lineno (void );
558
void cube_yyset_lineno (int line_number );
560
/* Macros after this point can all be overridden by user definitions in
564
#ifndef YY_SKIP_YYWRAP
566
extern "C" int cube_yywrap (void );
568
extern int cube_yywrap (void );
573
static void yy_flex_strncpy (char *,yyconst char *,int );
576
#ifdef YY_NEED_STRLEN
577
static int yy_flex_strlen (yyconst char * );
583
static int yyinput (void );
585
static int input (void );
590
/* Amount of stuff to slurp up with each read. */
591
#ifndef YY_READ_BUF_SIZE
592
#define YY_READ_BUF_SIZE 8192
595
/* Copy whatever the last rule matched to the standard output. */
597
/* This used to be an fputs(), but since the string might contain NUL's,
598
* we now use fwrite().
600
#define ECHO fwrite( cube_yytext, cube_yyleng, 1, cube_yyout )
603
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
604
* is returned in "result".
607
#define YY_INPUT(buf,result,max_size) \
608
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
612
for ( n = 0; n < max_size && \
613
(c = getc( cube_yyin )) != EOF && c != '\n'; ++n ) \
616
buf[n++] = (char) c; \
617
if ( c == EOF && ferror( cube_yyin ) ) \
618
YY_FATAL_ERROR( "input in flex scanner failed" ); \
624
while ( (result = fread(buf, 1, max_size, cube_yyin))==0 && ferror(cube_yyin)) \
626
if( errno != EINTR) \
628
YY_FATAL_ERROR( "input in flex scanner failed" ); \
632
clearerr(cube_yyin); \
639
/* No semi-colon after return; correct usage is to write "yyterminate();" -
640
* we don't want an extra ';' after the "return" because that will cause
641
* some compilers to complain about unreachable statements.
644
#define yyterminate() return YY_NULL
647
/* Number of entries by which start-condition stack grows. */
648
#ifndef YY_START_STACK_INCR
649
#define YY_START_STACK_INCR 25
652
/* Report a fatal error. */
653
#ifndef YY_FATAL_ERROR
654
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
657
/* end tables serialization structures and prototypes */
659
/* Default declaration of generated scanner - a define so the user can
660
* easily add parameters.
663
#define YY_DECL_IS_OURS 1
665
extern int cube_yylex (void);
667
#define YY_DECL int cube_yylex (void)
668
#endif /* !YY_DECL */
670
/* Code executed at the beginning of each rule, after cube_yytext and cube_yyleng
673
#ifndef YY_USER_ACTION
674
#define YY_USER_ACTION
677
/* Code executed at the end of each rule. */
679
#define YY_BREAK break;
682
#define YY_RULE_SETUP \
685
/** The main scanner function which does all the work.
689
register yy_state_type yy_current_state;
690
register char *yy_cp, *yy_bp;
693
#line 43 "cubescan.l"
696
#line 697 "cubescan.c"
707
(yy_start) = 1; /* first start state */
715
if ( ! YY_CURRENT_BUFFER ) {
716
cube_yyensure_buffer_stack ();
717
YY_CURRENT_BUFFER_LVALUE =
718
cube_yy_create_buffer(cube_yyin,YY_BUF_SIZE );
721
cube_yy_load_buffer_state( );
724
while ( 1 ) /* loops until end-of-file is reached */
726
yy_cp = (yy_c_buf_p);
728
/* Support of cube_yytext. */
729
*yy_cp = (yy_hold_char);
731
/* yy_bp points to the position in yy_ch_buf of the start of
736
yy_current_state = (yy_start);
740
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
741
if ( yy_accept[yy_current_state] )
743
(yy_last_accepting_state) = yy_current_state;
744
(yy_last_accepting_cpos) = yy_cp;
746
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
748
yy_current_state = (int) yy_def[yy_current_state];
749
if ( yy_current_state >= 25 )
750
yy_c = yy_meta[(unsigned int) yy_c];
752
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
755
while ( yy_current_state != 24 );
756
yy_cp = (yy_last_accepting_cpos);
757
yy_current_state = (yy_last_accepting_state);
760
yy_act = yy_accept[yy_current_state];
764
do_action: /* This label is used only to access EOF actions. */
767
{ /* beginning of action switch */
768
case 0: /* must back up */
769
/* undo the effects of YY_DO_BEFORE_ACTION */
770
*yy_cp = (yy_hold_char);
771
yy_cp = (yy_last_accepting_cpos);
772
yy_current_state = (yy_last_accepting_state);
777
#line 45 "cubescan.l"
778
yylval = cube_yytext; return CUBEFLOAT;
782
#line 46 "cubescan.l"
783
yylval = "("; return O_BRACKET;
787
#line 47 "cubescan.l"
788
yylval = ")"; return C_BRACKET;
792
#line 48 "cubescan.l"
793
yylval = "("; return O_PAREN;
797
#line 49 "cubescan.l"
798
yylval = ")"; return C_PAREN;
802
#line 50 "cubescan.l"
803
yylval = ")"; return COMMA;
806
/* rule 7 can match eol */
808
#line 51 "cubescan.l"
813
#line 52 "cubescan.l"
814
return cube_yytext[0]; /* alert parser of the garbage */
818
#line 54 "cubescan.l"
819
YY_FATAL_ERROR( "flex scanner jammed" );
821
#line 822 "cubescan.c"
822
case YY_STATE_EOF(INITIAL):
825
case YY_END_OF_BUFFER:
827
/* Amount of text matched not including the EOB char. */
828
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
830
/* Undo the effects of YY_DO_BEFORE_ACTION. */
831
*yy_cp = (yy_hold_char);
832
YY_RESTORE_YY_MORE_OFFSET
834
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
836
/* We're scanning a new file or input source. It's
837
* possible that this happened because the user
838
* just pointed cube_yyin at a new source and called
839
* cube_yylex(). If so, then we have to assure
840
* consistency between YY_CURRENT_BUFFER and our
841
* globals. Here is the right place to do so, because
842
* this is the first action (other than possibly a
843
* back-up) that will match for the new input source.
845
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
846
YY_CURRENT_BUFFER_LVALUE->yy_input_file = cube_yyin;
847
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
850
/* Note that here we test for yy_c_buf_p "<=" to the position
851
* of the first EOB in the buffer, since yy_c_buf_p will
852
* already have been incremented past the NUL character
853
* (since all states make transitions on EOB to the
854
* end-of-buffer state). Contrast this with the test
857
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
858
{ /* This was really a NUL. */
859
yy_state_type yy_next_state;
861
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
863
yy_current_state = yy_get_previous_state( );
865
/* Okay, we're now positioned to make the NUL
866
* transition. We couldn't have
867
* yy_get_previous_state() go ahead and do it
868
* for us because it doesn't know how to deal
869
* with the possibility of jamming (and we don't
870
* want to build jamming into it because then it
871
* will run more slowly).
874
yy_next_state = yy_try_NUL_trans( yy_current_state );
876
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
880
/* Consume the NUL. */
881
yy_cp = ++(yy_c_buf_p);
882
yy_current_state = yy_next_state;
888
yy_cp = (yy_last_accepting_cpos);
889
yy_current_state = (yy_last_accepting_state);
894
else switch ( yy_get_next_buffer( ) )
896
case EOB_ACT_END_OF_FILE:
898
(yy_did_buffer_switch_on_eof) = 0;
900
if ( cube_yywrap( ) )
902
/* Note: because we've taken care in
903
* yy_get_next_buffer() to have set up
904
* cube_yytext, we can now set up
905
* yy_c_buf_p so that if some total
906
* hoser (like flex itself) wants to
907
* call the scanner after we return the
908
* YY_NULL, it'll still work - another
909
* YY_NULL will get returned.
911
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
913
yy_act = YY_STATE_EOF(YY_START);
919
if ( ! (yy_did_buffer_switch_on_eof) )
925
case EOB_ACT_CONTINUE_SCAN:
927
(yytext_ptr) + yy_amount_of_matched_text;
929
yy_current_state = yy_get_previous_state( );
931
yy_cp = (yy_c_buf_p);
932
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
935
case EOB_ACT_LAST_MATCH:
937
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
939
yy_current_state = yy_get_previous_state( );
941
yy_cp = (yy_c_buf_p);
942
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
950
"fatal flex scanner internal error--no action found" );
951
} /* end of action switch */
952
} /* end of scanning one token */
953
} /* end of cube_yylex */
955
/* yy_get_next_buffer - try to read in a new buffer
957
* Returns a code representing an action:
958
* EOB_ACT_LAST_MATCH -
959
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
960
* EOB_ACT_END_OF_FILE - end of file
962
static int yy_get_next_buffer (void)
964
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
965
register char *source = (yytext_ptr);
966
register int number_to_move, i;
969
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
971
"fatal flex scanner internal error--end of buffer missed" );
973
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
974
{ /* Don't try to fill the buffer, so this is an EOF. */
975
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
977
/* We matched a single character, the EOB, so
978
* treat this as a final EOF.
980
return EOB_ACT_END_OF_FILE;
985
/* We matched some text prior to the EOB, first
988
return EOB_ACT_LAST_MATCH;
992
/* Try to read more data. */
994
/* First move last chars to start of buffer. */
995
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
997
for ( i = 0; i < number_to_move; ++i )
998
*(dest++) = *(source++);
1000
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1001
/* don't do the read, it's not guaranteed to return an EOF,
1004
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1009
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1011
while ( num_to_read <= 0 )
1012
{ /* Not enough room in the buffer - grow it. */
1014
/* just a shorter name for the current buffer */
1015
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1017
int yy_c_buf_p_offset =
1018
(int) ((yy_c_buf_p) - b->yy_ch_buf);
1020
if ( b->yy_is_our_buffer )
1022
int new_size = b->yy_buf_size * 2;
1024
if ( new_size <= 0 )
1025
b->yy_buf_size += b->yy_buf_size / 8;
1027
b->yy_buf_size *= 2;
1029
b->yy_ch_buf = (char *)
1030
/* Include room in for 2 EOB chars. */
1031
cube_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1034
/* Can't grow it, we don't own it. */
1037
if ( ! b->yy_ch_buf )
1039
"fatal error - scanner input buffer overflow" );
1041
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1043
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1048
if ( num_to_read > YY_READ_BUF_SIZE )
1049
num_to_read = YY_READ_BUF_SIZE;
1051
/* Read in more data. */
1052
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1053
(yy_n_chars), (size_t) num_to_read );
1055
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1058
if ( (yy_n_chars) == 0 )
1060
if ( number_to_move == YY_MORE_ADJ )
1062
ret_val = EOB_ACT_END_OF_FILE;
1063
cube_yyrestart(cube_yyin );
1068
ret_val = EOB_ACT_LAST_MATCH;
1069
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1070
YY_BUFFER_EOF_PENDING;
1075
ret_val = EOB_ACT_CONTINUE_SCAN;
1077
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1078
/* Extend the array by 50%, plus the number we really need. */
1079
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1080
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cube_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1081
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1082
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1085
(yy_n_chars) += number_to_move;
1086
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1087
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1089
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1094
/* yy_get_previous_state - get the state just before the EOB char was reached */
1096
static yy_state_type yy_get_previous_state (void)
1098
register yy_state_type yy_current_state;
1099
register char *yy_cp;
1101
yy_current_state = (yy_start);
1103
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1105
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1106
if ( yy_accept[yy_current_state] )
1108
(yy_last_accepting_state) = yy_current_state;
1109
(yy_last_accepting_cpos) = yy_cp;
1111
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1113
yy_current_state = (int) yy_def[yy_current_state];
1114
if ( yy_current_state >= 25 )
1115
yy_c = yy_meta[(unsigned int) yy_c];
1117
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1120
return yy_current_state;
1123
/* yy_try_NUL_trans - try to make a transition on the NUL character
1126
* next_state = yy_try_NUL_trans( current_state );
1128
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1130
register int yy_is_jam;
1131
register char *yy_cp = (yy_c_buf_p);
1133
register YY_CHAR yy_c = 1;
1134
if ( yy_accept[yy_current_state] )
1136
(yy_last_accepting_state) = yy_current_state;
1137
(yy_last_accepting_cpos) = yy_cp;
1139
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1141
yy_current_state = (int) yy_def[yy_current_state];
1142
if ( yy_current_state >= 25 )
1143
yy_c = yy_meta[(unsigned int) yy_c];
1145
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1146
yy_is_jam = (yy_current_state == 24);
1148
return yy_is_jam ? 0 : yy_current_state;
1153
static int yyinput (void)
1155
static int input (void)
1161
*(yy_c_buf_p) = (yy_hold_char);
1163
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1165
/* yy_c_buf_p now points to the character we want to return.
1166
* If this occurs *before* the EOB characters, then it's a
1167
* valid NUL; if not, then we've hit the end of the buffer.
1169
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1170
/* This was really a NUL. */
1171
*(yy_c_buf_p) = '\0';
1174
{ /* need more input */
1175
int offset = (yy_c_buf_p) - (yytext_ptr);
1178
switch ( yy_get_next_buffer( ) )
1180
case EOB_ACT_LAST_MATCH:
1181
/* This happens because yy_g_n_b()
1182
* sees that we've accumulated a
1183
* token and flags that we need to
1184
* try matching the token before
1185
* proceeding. But for input(),
1186
* there's no matching to consider.
1187
* So convert the EOB_ACT_LAST_MATCH
1188
* to EOB_ACT_END_OF_FILE.
1191
/* Reset buffer status. */
1192
cube_yyrestart(cube_yyin );
1196
case EOB_ACT_END_OF_FILE:
1198
if ( cube_yywrap( ) )
1201
if ( ! (yy_did_buffer_switch_on_eof) )
1210
case EOB_ACT_CONTINUE_SCAN:
1211
(yy_c_buf_p) = (yytext_ptr) + offset;
1217
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1218
*(yy_c_buf_p) = '\0'; /* preserve cube_yytext */
1219
(yy_hold_char) = *++(yy_c_buf_p);
1223
#endif /* ifndef YY_NO_INPUT */
1225
/** Immediately switch to a different input stream.
1226
* @param input_file A readable stream.
1228
* @note This function does not reset the start condition to @c INITIAL .
1230
void cube_yyrestart (FILE * input_file )
1233
if ( ! YY_CURRENT_BUFFER ){
1234
cube_yyensure_buffer_stack ();
1235
YY_CURRENT_BUFFER_LVALUE =
1236
cube_yy_create_buffer(cube_yyin,YY_BUF_SIZE );
1239
cube_yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1240
cube_yy_load_buffer_state( );
1243
/** Switch to a different input buffer.
1244
* @param new_buffer The new input buffer.
1247
void cube_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1250
/* TODO. We should be able to replace this entire function body
1252
* cube_yypop_buffer_state();
1253
* cube_yypush_buffer_state(new_buffer);
1255
cube_yyensure_buffer_stack ();
1256
if ( YY_CURRENT_BUFFER == new_buffer )
1259
if ( YY_CURRENT_BUFFER )
1261
/* Flush out information for old buffer. */
1262
*(yy_c_buf_p) = (yy_hold_char);
1263
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1264
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1267
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1268
cube_yy_load_buffer_state( );
1270
/* We don't actually know whether we did this switch during
1271
* EOF (cube_yywrap()) processing, but the only time this flag
1272
* is looked at is after cube_yywrap() is called, so it's safe
1273
* to go ahead and always set it.
1275
(yy_did_buffer_switch_on_eof) = 1;
1278
static void cube_yy_load_buffer_state (void)
1280
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1281
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1282
cube_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1283
(yy_hold_char) = *(yy_c_buf_p);
1286
/** Allocate and initialize an input buffer state.
1287
* @param file A readable stream.
1288
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1290
* @return the allocated buffer state.
1292
YY_BUFFER_STATE cube_yy_create_buffer (FILE * file, int size )
1296
b = (YY_BUFFER_STATE) cube_yyalloc(sizeof( struct yy_buffer_state ) );
1298
YY_FATAL_ERROR( "out of dynamic memory in cube_yy_create_buffer()" );
1300
b->yy_buf_size = size;
1302
/* yy_ch_buf has to be 2 characters longer than the size given because
1303
* we need to put in 2 end-of-buffer characters.
1305
b->yy_ch_buf = (char *) cube_yyalloc(b->yy_buf_size + 2 );
1306
if ( ! b->yy_ch_buf )
1307
YY_FATAL_ERROR( "out of dynamic memory in cube_yy_create_buffer()" );
1309
b->yy_is_our_buffer = 1;
1311
cube_yy_init_buffer(b,file );
1316
/** Destroy the buffer.
1317
* @param b a buffer created with cube_yy_create_buffer()
1320
void cube_yy_delete_buffer (YY_BUFFER_STATE b )
1326
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1327
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1329
if ( b->yy_is_our_buffer )
1330
cube_yyfree((void *) b->yy_ch_buf );
1332
cube_yyfree((void *) b );
1335
/* Initializes or reinitializes a buffer.
1336
* This function is sometimes called more than once on the same buffer,
1337
* such as during a cube_yyrestart() or at EOF.
1339
static void cube_yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1344
cube_yy_flush_buffer(b );
1346
b->yy_input_file = file;
1347
b->yy_fill_buffer = 1;
1349
/* If b is the current buffer, then cube_yy_init_buffer was _probably_
1350
* called from cube_yyrestart() or through yy_get_next_buffer.
1351
* In that case, we don't want to reset the lineno or column.
1353
if (b != YY_CURRENT_BUFFER){
1354
b->yy_bs_lineno = 1;
1355
b->yy_bs_column = 0;
1358
b->yy_is_interactive = 0;
1363
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1364
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1367
void cube_yy_flush_buffer (YY_BUFFER_STATE b )
1374
/* We always need two end-of-buffer characters. The first causes
1375
* a transition to the end-of-buffer state. The second causes
1376
* a jam in that state.
1378
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1379
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1381
b->yy_buf_pos = &b->yy_ch_buf[0];
1384
b->yy_buffer_status = YY_BUFFER_NEW;
1386
if ( b == YY_CURRENT_BUFFER )
1387
cube_yy_load_buffer_state( );
1390
/** Pushes the new state onto the stack. The new state becomes
1391
* the current state. This function will allocate the stack
1393
* @param new_buffer The new state.
1396
void cube_yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1398
if (new_buffer == NULL)
1401
cube_yyensure_buffer_stack();
1403
/* This block is copied from cube_yy_switch_to_buffer. */
1404
if ( YY_CURRENT_BUFFER )
1406
/* Flush out information for old buffer. */
1407
*(yy_c_buf_p) = (yy_hold_char);
1408
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1409
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1412
/* Only push if top exists. Otherwise, replace top. */
1413
if (YY_CURRENT_BUFFER)
1414
(yy_buffer_stack_top)++;
1415
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1417
/* copied from cube_yy_switch_to_buffer. */
1418
cube_yy_load_buffer_state( );
1419
(yy_did_buffer_switch_on_eof) = 1;
1422
/** Removes and deletes the top of the stack, if present.
1423
* The next element becomes the new top.
1426
void cube_yypop_buffer_state (void)
1428
if (!YY_CURRENT_BUFFER)
1431
cube_yy_delete_buffer(YY_CURRENT_BUFFER );
1432
YY_CURRENT_BUFFER_LVALUE = NULL;
1433
if ((yy_buffer_stack_top) > 0)
1434
--(yy_buffer_stack_top);
1436
if (YY_CURRENT_BUFFER) {
1437
cube_yy_load_buffer_state( );
1438
(yy_did_buffer_switch_on_eof) = 1;
1442
/* Allocates the stack if it does not exist.
1443
* Guarantees space for at least one push.
1445
static void cube_yyensure_buffer_stack (void)
1449
if (!(yy_buffer_stack)) {
1451
/* First allocation is just for 2 elements, since we don't know if this
1452
* scanner will even need a stack. We use 2 instead of 1 to avoid an
1453
* immediate realloc on the next call.
1456
(yy_buffer_stack) = (struct yy_buffer_state**)cube_yyalloc
1457
(num_to_alloc * sizeof(struct yy_buffer_state*)
1459
if ( ! (yy_buffer_stack) )
1460
YY_FATAL_ERROR( "out of dynamic memory in cube_yyensure_buffer_stack()" );
1462
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1464
(yy_buffer_stack_max) = num_to_alloc;
1465
(yy_buffer_stack_top) = 0;
1469
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1471
/* Increase the buffer to prepare for a possible push. */
1472
int grow_size = 8 /* arbitrary grow size */;
1474
num_to_alloc = (yy_buffer_stack_max) + grow_size;
1475
(yy_buffer_stack) = (struct yy_buffer_state**)cube_yyrealloc
1477
num_to_alloc * sizeof(struct yy_buffer_state*)
1479
if ( ! (yy_buffer_stack) )
1480
YY_FATAL_ERROR( "out of dynamic memory in cube_yyensure_buffer_stack()" );
1482
/* zero only the new slots.*/
1483
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1484
(yy_buffer_stack_max) = num_to_alloc;
1488
/** Setup the input buffer state to scan directly from a user-specified character buffer.
1489
* @param base the character buffer
1490
* @param size the size in bytes of the character buffer
1492
* @return the newly allocated buffer state object.
1494
YY_BUFFER_STATE cube_yy_scan_buffer (char * base, yy_size_t size )
1499
base[size-2] != YY_END_OF_BUFFER_CHAR ||
1500
base[size-1] != YY_END_OF_BUFFER_CHAR )
1501
/* They forgot to leave room for the EOB's. */
1504
b = (YY_BUFFER_STATE) cube_yyalloc(sizeof( struct yy_buffer_state ) );
1506
YY_FATAL_ERROR( "out of dynamic memory in cube_yy_scan_buffer()" );
1508
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1509
b->yy_buf_pos = b->yy_ch_buf = base;
1510
b->yy_is_our_buffer = 0;
1511
b->yy_input_file = 0;
1512
b->yy_n_chars = b->yy_buf_size;
1513
b->yy_is_interactive = 0;
1515
b->yy_fill_buffer = 0;
1516
b->yy_buffer_status = YY_BUFFER_NEW;
1518
cube_yy_switch_to_buffer(b );
1523
/** Setup the input buffer state to scan a string. The next call to cube_yylex() will
1524
* scan from a @e copy of @a str.
1525
* @param yystr a NUL-terminated string to scan
1527
* @return the newly allocated buffer state object.
1528
* @note If you want to scan bytes that may contain NUL values, then use
1529
* cube_yy_scan_bytes() instead.
1531
YY_BUFFER_STATE cube_yy_scan_string (yyconst char * yystr )
1534
return cube_yy_scan_bytes(yystr,strlen(yystr) );
1537
/** Setup the input buffer state to scan the given bytes. The next call to cube_yylex() will
1538
* scan from a @e copy of @a bytes.
1539
* @param bytes the byte buffer to scan
1540
* @param len the number of bytes in the buffer pointed to by @a bytes.
1542
* @return the newly allocated buffer state object.
1544
YY_BUFFER_STATE cube_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1551
/* Get memory for full buffer, including space for trailing EOB's. */
1552
n = _yybytes_len + 2;
1553
buf = (char *) cube_yyalloc(n );
1555
YY_FATAL_ERROR( "out of dynamic memory in cube_yy_scan_bytes()" );
1557
for ( i = 0; i < _yybytes_len; ++i )
1558
buf[i] = yybytes[i];
1560
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1562
b = cube_yy_scan_buffer(buf,n );
1564
YY_FATAL_ERROR( "bad buffer in cube_yy_scan_bytes()" );
1566
/* It's okay to grow etc. this buffer, and we should throw it
1567
* away when we're done.
1569
b->yy_is_our_buffer = 1;
1574
#ifndef YY_EXIT_FAILURE
1575
#define YY_EXIT_FAILURE 2
1578
static void yy_fatal_error (yyconst char* msg )
1580
(void) fprintf( stderr, "%s\n", msg );
1581
exit( YY_EXIT_FAILURE );
1584
/* Redefine yyless() so it works in section 3 code. */
1590
/* Undo effects of setting up cube_yytext. */ \
1591
int yyless_macro_arg = (n); \
1592
YY_LESS_LINENO(yyless_macro_arg);\
1593
cube_yytext[cube_yyleng] = (yy_hold_char); \
1594
(yy_c_buf_p) = cube_yytext + yyless_macro_arg; \
1595
(yy_hold_char) = *(yy_c_buf_p); \
1596
*(yy_c_buf_p) = '\0'; \
1597
cube_yyleng = yyless_macro_arg; \
1601
/* Accessor methods (get/set functions) to struct members. */
1603
/** Get the current line number.
1606
int cube_yyget_lineno (void)
1609
return cube_yylineno;
1612
/** Get the input stream.
1615
FILE *cube_yyget_in (void)
1620
/** Get the output stream.
1623
FILE *cube_yyget_out (void)
1628
/** Get the length of the current token.
1631
int cube_yyget_leng (void)
1636
/** Get the current token.
1640
char *cube_yyget_text (void)
1645
/** Set the current line number.
1646
* @param line_number
1649
void cube_yyset_lineno (int line_number )
1652
cube_yylineno = line_number;
1655
/** Set the input stream. This does not discard the current
1657
* @param in_str A readable stream.
1659
* @see cube_yy_switch_to_buffer
1661
void cube_yyset_in (FILE * in_str )
1663
cube_yyin = in_str ;
1666
void cube_yyset_out (FILE * out_str )
1668
cube_yyout = out_str ;
1671
int cube_yyget_debug (void)
1673
return cube_yy_flex_debug;
1676
void cube_yyset_debug (int bdebug )
1678
cube_yy_flex_debug = bdebug ;
1681
static int yy_init_globals (void)
1683
/* Initialization is the same as for the non-reentrant scanner.
1684
* This function is called from cube_yylex_destroy(), so don't allocate here.
1687
(yy_buffer_stack) = 0;
1688
(yy_buffer_stack_top) = 0;
1689
(yy_buffer_stack_max) = 0;
1690
(yy_c_buf_p) = (char *) 0;
1694
/* Defined in main.c */
1697
cube_yyout = stdout;
1699
cube_yyin = (FILE *) 0;
1700
cube_yyout = (FILE *) 0;
1703
/* For future reference: Set errno on error, since we are called by
1709
/* cube_yylex_destroy is for both reentrant and non-reentrant scanners. */
1710
int cube_yylex_destroy (void)
1713
/* Pop the buffer stack, destroying each element. */
1714
while(YY_CURRENT_BUFFER){
1715
cube_yy_delete_buffer(YY_CURRENT_BUFFER );
1716
YY_CURRENT_BUFFER_LVALUE = NULL;
1717
cube_yypop_buffer_state();
1720
/* Destroy the stack itself. */
1721
cube_yyfree((yy_buffer_stack) );
1722
(yy_buffer_stack) = NULL;
1724
/* Reset the globals. This is important in a non-reentrant scanner so the next time
1725
* cube_yylex() is called, initialization will occur. */
1732
* Internal utility routines.
1736
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1739
for ( i = 0; i < n; ++i )
1744
#ifdef YY_NEED_STRLEN
1745
static int yy_flex_strlen (yyconst char * s )
1748
for ( n = 0; s[n]; ++n )
1755
void *cube_yyalloc (yy_size_t size )
1757
return (void *) malloc( size );
1760
void *cube_yyrealloc (void * ptr, yy_size_t size )
1762
/* The cast to (char *) in the following accommodates both
1763
* implementations that use char* generic pointers, and those
1764
* that use void* generic pointers. It works with the latter
1765
* because both ANSI C and C++ allow castless assignment from
1766
* any pointer type to void*, and deal with argument conversions
1767
* as though doing an assignment.
1769
return (void *) realloc( (char *) ptr, size );
1772
void cube_yyfree (void * ptr )
1774
free( (char *) ptr ); /* see cube_yyrealloc() for (char *) cast */
1777
#define YYTABLES_NAME "yytables"
1779
#line 54 "cubescan.l"
1784
yyerror(const char *message)
1786
if (*cube_yytext == YY_END_OF_BUFFER_CHAR)
1789
(errcode(ERRCODE_SYNTAX_ERROR),
1790
errmsg("bad cube representation"),
1791
/* translator: %s is typically "syntax error" */
1792
errdetail("%s at end of input", message)));
1797
(errcode(ERRCODE_SYNTAX_ERROR),
1798
errmsg("bad cube representation"),
1799
/* translator: first %s is typically "syntax error" */
1800
errdetail("%s at or near \"%s\"", message, cube_yytext)));
1806
* Called before any actual parsing is done
1809
cube_scanner_init(const char *str)
1811
Size slen = strlen(str);
1814
* Might be left over after ereport()
1816
if (YY_CURRENT_BUFFER)
1817
cube_yy_delete_buffer(YY_CURRENT_BUFFER);
1820
* Make a scan buffer with special termination needed by flex.
1823
scanbuf = palloc(slen + 2);
1824
memcpy(scanbuf, str, slen);
1825
scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
1826
scanbufhandle = cube_yy_scan_buffer(scanbuf,slen + 2);
1833
* Called after parsing is done to clean up after cube_scanner_init()
1836
cube_scanner_finish(void)
1838
cube_yy_delete_buffer(scanbufhandle);