5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 31
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
20 #define yyFlexLexer yyFlexLexer
22 /* First, we deal with platform-specific or compiler-specific issues. */
24 /* begin standard C headers. */
26 /* end standard C headers. */
28 /* flex integer type definitions */
33 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
35 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
37 typedef int8_t flex_int8_t;
38 typedef uint8_t flex_uint8_t;
39 typedef int16_t flex_int16_t;
40 typedef uint16_t flex_uint16_t;
41 typedef int32_t flex_int32_t;
42 typedef uint32_t flex_uint32_t;
44 typedef signed char flex_int8_t;
45 typedef short int flex_int16_t;
46 typedef int flex_int32_t;
47 typedef unsigned char flex_uint8_t;
48 typedef unsigned short int flex_uint16_t;
49 typedef unsigned int flex_uint32_t;
52 /* Limits of integral types. */
54 #define INT8_MIN (-128)
57 #define INT16_MIN (-32767-1)
60 #define INT32_MIN (-2147483647-1)
63 #define INT8_MAX (127)
66 #define INT16_MAX (32767)
69 #define INT32_MAX (2147483647)
72 #define UINT8_MAX (255U)
75 #define UINT16_MAX (65535U)
78 #define UINT32_MAX (4294967295U)
81 #endif /* ! FLEXINT_H */
83 /* begin standard C++ headers. */
88 /* end standard C++ headers. */
92 /* The "const" storage-class-modifier is valid. */
95 #else /* ! __cplusplus */
101 #endif /* __STDC__ */
102 #endif /* ! __cplusplus */
105 #define yyconst const
110 /* Returned upon end-of-file. */
113 /* Promotes a possibly negative, possibly signed char to an unsigned
114 * integer for use as an array index. If the signed char is negative,
115 * we want to instead treat it as an 8-bit unsigned char, hence the
118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120 /* Enter a start condition. This macro really ought to take a parameter,
121 * but we do it the disgusting crufty way forced on us by the ()-less
122 * definition of BEGIN.
124 #define BEGIN (yy_start) = 1 + 2 *
126 /* Translate the current start state into a value that can be later handed
127 * to BEGIN to return to the state. The YYSTATE alias is for lex
130 #define YY_START (((yy_start) - 1) / 2)
131 #define YYSTATE YY_START
133 /* Action number for EOF rule of a given start state. */
134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
136 /* Special action meaning "start processing a new file". */
137 #define YY_NEW_FILE yyrestart( yyin )
139 #define YY_END_OF_BUFFER_CHAR 0
141 /* Size of default input buffer. */
143 #define YY_BUF_SIZE 16384
146 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
147 #define YY_TYPEDEF_YY_BUFFER_STATE
148 typedef struct yy_buffer_state *YY_BUFFER_STATE;
153 #define EOB_ACT_CONTINUE_SCAN 0
154 #define EOB_ACT_END_OF_FILE 1
155 #define EOB_ACT_LAST_MATCH 2
157 #define YY_LESS_LINENO(n)
159 /* Return all but the first "n" matched characters back to the input stream. */
163 /* Undo effects of setting up yytext. */ \
164 int yyless_macro_arg = (n); \
165 YY_LESS_LINENO(yyless_macro_arg);\
166 *yy_cp = (yy_hold_char); \
167 YY_RESTORE_YY_MORE_OFFSET \
168 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
169 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
173 #define unput(c) yyunput( c, (yytext_ptr) )
175 /* The following is because we cannot portably get our hands on size_t
176 * (without autoconf's help, which isn't available because we want
177 * flex-generated scanners to compile on their own).
180 #ifndef YY_TYPEDEF_YY_SIZE_T
181 #define YY_TYPEDEF_YY_SIZE_T
182 typedef unsigned int yy_size_t;
185 #ifndef YY_STRUCT_YY_BUFFER_STATE
186 #define YY_STRUCT_YY_BUFFER_STATE
187 struct yy_buffer_state
190 std::istream* yy_input_file;
192 char *yy_ch_buf; /* input buffer */
193 char *yy_buf_pos; /* current position in input buffer */
195 /* Size of input buffer in bytes, not including room for EOB
198 yy_size_t yy_buf_size;
200 /* Number of characters read into yy_ch_buf, not including EOB
205 /* Whether we "own" the buffer - i.e., we know we created it,
206 * and can realloc() it to grow it, and should free() it to
209 int yy_is_our_buffer;
211 /* Whether this is an "interactive" input source; if so, and
212 * if we're using stdio for input, then we want to use getc()
213 * instead of fread(), to make sure we stop fetching input after
216 int yy_is_interactive;
218 /* Whether we're considered to be at the beginning of a line.
219 * If so, '^' rules will be active on the next match, otherwise
224 int yy_bs_lineno; /**< The line count. */
225 int yy_bs_column; /**< The column count. */
227 /* Whether to try to fill the input buffer when we reach the
232 int yy_buffer_status;
234 #define YY_BUFFER_NEW 0
235 #define YY_BUFFER_NORMAL 1
236 /* When an EOF's been seen but there's still some text to process
237 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
238 * shouldn't try reading from the input source any more. We might
239 * still have a bunch of tokens to match, though, because of
240 * possible backing-up.
242 * When we actually see the EOF, we change the status to "new"
243 * (via yyrestart()), so that the user can continue scanning by
244 * just pointing yyin at a new input file.
246 #define YY_BUFFER_EOF_PENDING 2
249 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
251 /* We provide macros for accessing buffer states in case in the
252 * future we want to put the buffer states in a more general
255 * Returns the top of the stack, or NULL.
257 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
258 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
261 /* Same as previous macro, but useful when we know that the buffer stack is not
262 * NULL or when we need an lvalue. For internal use only.
264 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
266 void *yyalloc (yy_size_t );
267 void *yyrealloc (void *,yy_size_t );
268 void yyfree (void * );
270 #define yy_new_buffer yy_create_buffer
272 #define yy_set_interactive(is_interactive) \
274 if ( ! YY_CURRENT_BUFFER ){ \
275 yyensure_buffer_stack (); \
276 YY_CURRENT_BUFFER_LVALUE = \
277 yy_create_buffer( yyin, YY_BUF_SIZE ); \
279 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
282 #define yy_set_bol(at_bol) \
284 if ( ! YY_CURRENT_BUFFER ){\
285 yyensure_buffer_stack (); \
286 YY_CURRENT_BUFFER_LVALUE = \
287 yy_create_buffer( yyin, YY_BUF_SIZE ); \
289 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
292 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
294 /* Begin user sect3 */
296 typedef unsigned char YY_CHAR;
298 #define yytext_ptr yytext
299 #define YY_INTERACTIVE
301 #include <FlexLexer.h>
303 /* Done after the current pattern has been matched and before the
304 * corresponding action - sets up yytext.
306 #define YY_DO_BEFORE_ACTION \
307 (yytext_ptr) = yy_bp; \
308 yyleng = (size_t) (yy_cp - yy_bp); \
309 (yy_hold_char) = *yy_cp; \
311 (yy_c_buf_p) = yy_cp;
313 #define YY_NUM_RULES 16
314 #define YY_END_OF_BUFFER 17
315 /* This struct is not used in this scanner,
316 but its presence is necessary. */
319 flex_int32_t yy_verify;
322 static yyconst flex_int16_t yy_accept[27] =
324 1, 1, 17, 15, 1, 16, 12, 6, 7, 4,
325 2, 3, 11, 5, 13, 13, 10, 14, 8, 9,
329 static yyconst flex_int32_t yy_ec[256] =
331 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334 1, 2, 1, 1, 1, 1, 1, 4, 1, 5,
335 6, 7, 8, 1, 9, 10, 11, 12, 13, 13,
336 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
337 14, 1, 1, 1, 15, 15, 15, 15, 15, 15,
338 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
339 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
340 17, 1, 18, 1, 16, 1, 15, 15, 15, 15,
342 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
343 16, 16, 16, 16, 16, 16, 16, 16, 16, 19,
344 16, 16, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
356 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
361 static yyconst flex_int32_t yy_meta[20] =
363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
364 1, 2, 2, 1, 3, 4, 1, 1, 5
367 static yyconst flex_int16_t yy_base[30] =
369 0, 0, 35, 36, 32, 36, 36, 36, 36, 36,
370 36, 36, 36, 36, 7, 8, 36, 0, 36, 36,
371 23, 10, 0, 0, 0, 36, 22, 26, 30
374 static yyconst flex_int16_t yy_def[30] =
376 26, 1, 26, 26, 26, 26, 26, 26, 26, 26,
377 26, 26, 26, 26, 27, 26, 26, 28, 26, 26,
378 26, 26, 29, 28, 29, 0, 26, 26, 26
381 static yyconst flex_int16_t yy_nxt[56] =
383 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
384 14, 15, 16, 17, 18, 18, 19, 20, 18, 22,
385 22, 22, 22, 22, 21, 23, 22, 24, 24, 24,
386 24, 25, 25, 21, 26, 3, 26, 26, 26, 26,
387 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
391 static yyconst flex_int16_t yy_chk[56] =
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 16,
395 16, 22, 22, 27, 21, 15, 27, 28, 28, 28,
396 28, 29, 29, 5, 3, 26, 26, 26, 26, 26,
397 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
401 /* The intent behind this definition is that it'll catch
402 * any uses of REJECT which flex missed.
404 #define REJECT reject_used_but_not_detected
405 #define yymore() yymore_used_but_not_detected
406 #define YY_MORE_ADJ 0
407 #define YY_RESTORE_YY_MORE_OFFSET
410 #include "cmdlexcl.h"
413 static YY_cl_ucsim_parser_STYPE *yylval;
417 #define tok(x) (YY_cl_ucsim_parser_CLASS::x)
418 #define lexer_obj (dynamic_cast<class cl_ucsim_lexer *>(this))
420 #line 421 "cmdlex.cc"
424 #ifndef YY_NO_UNISTD_H
425 /* Special case for "unistd.h", since it is non-ANSI. We include it way
426 * down here because we want the user's section 1 to have been scanned first.
427 * The user has a chance to override it with an option.
432 #ifndef YY_EXTRA_TYPE
433 #define YY_EXTRA_TYPE void *
437 static void yy_flex_strncpy (char *,yyconst char *,int );
440 #ifdef YY_NEED_STRLEN
441 static int yy_flex_strlen (yyconst char * );
448 /* Amount of stuff to slurp up with each read. */
449 #ifndef YY_READ_BUF_SIZE
450 #define YY_READ_BUF_SIZE 8192
453 /* Copy whatever the last rule matched to the standard output. */
455 #define ECHO LexerOutput( yytext, yyleng )
458 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
459 * is returned in "result".
462 #define YY_INPUT(buf,result,max_size) \
464 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
465 YY_FATAL_ERROR( "input in flex scanner failed" );
469 /* No semi-colon after return; correct usage is to write "yyterminate();" -
470 * we don't want an extra ';' after the "return" because that will cause
471 * some compilers to complain about unreachable statements.
474 #define yyterminate() return YY_NULL
477 /* Number of entries by which start-condition stack grows. */
478 #ifndef YY_START_STACK_INCR
479 #define YY_START_STACK_INCR 25
482 /* Report a fatal error. */
483 #ifndef YY_FATAL_ERROR
484 #define YY_FATAL_ERROR(msg) LexerError( msg )
487 /* end tables serialization structures and prototypes */
489 /* Default declaration of generated scanner - a define so the user can
490 * easily add parameters.
493 #define YY_DECL_IS_OURS 1
494 #define YY_DECL int yyFlexLexer::yylex()
495 #endif /* !YY_DECL */
497 /* Code executed at the beginning of each rule, after yytext and yyleng
500 #ifndef YY_USER_ACTION
501 #define YY_USER_ACTION
504 /* Code executed at the end of each rule. */
506 #define YY_BREAK break;
509 #define YY_RULE_SETUP \
512 /** The main scanner function which does all the work.
516 register yy_state_type yy_current_state;
517 register char *yy_cp, *yy_bp;
523 #line 524 "cmdlex.cc"
534 (yy_start) = 1; /* first start state */
542 if ( ! YY_CURRENT_BUFFER ) {
543 yyensure_buffer_stack ();
544 YY_CURRENT_BUFFER_LVALUE =
545 yy_create_buffer( yyin, YY_BUF_SIZE );
548 yy_load_buffer_state( );
551 while ( 1 ) /* loops until end-of-file is reached */
553 yy_cp = (yy_c_buf_p);
555 /* Support of yytext. */
556 *yy_cp = (yy_hold_char);
558 /* yy_bp points to the position in yy_ch_buf of the start of
563 yy_current_state = (yy_start);
567 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
568 if ( yy_accept[yy_current_state] )
570 (yy_last_accepting_state) = yy_current_state;
571 (yy_last_accepting_cpos) = yy_cp;
573 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
575 yy_current_state = (int) yy_def[yy_current_state];
576 if ( yy_current_state >= 27 )
577 yy_c = yy_meta[(unsigned int) yy_c];
579 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
582 while ( yy_base[yy_current_state] != 36 );
585 yy_act = yy_accept[yy_current_state];
587 { /* have to back up */
588 yy_cp = (yy_last_accepting_cpos);
589 yy_current_state = (yy_last_accepting_state);
590 yy_act = yy_accept[yy_current_state];
595 do_action: /* This label is used only to access EOF actions. */
598 { /* beginning of action switch */
599 case 0: /* must back up */
600 /* undo the effects of YY_DO_BEFORE_ACTION */
601 *yy_cp = (yy_hold_char);
602 yy_cp = (yy_last_accepting_cpos);
603 yy_current_state = (yy_last_accepting_state);
614 return(tok(PTOK_PLUS));
619 return(tok(PTOK_MINUS));
624 return(tok(PTOK_ASTERIX));
629 return(tok(PTOK_SLASH));
634 return(tok(PTOK_LEFT_PAREN));
639 return(tok(PTOK_RIGHT_PAREN));
644 return(tok(PTOK_LEFT_BRACKET));
649 return(tok(PTOK_RIGHT_BRACKET));
654 return(tok(PTOK_EQUAL));
659 return(tok(PTOK_DOT));
664 return(tok(PTOK_AMPERSAND));
670 yylval->number= strtol(yytext, 0, 0);
671 return(YY_cl_ucsim_parser_CLASS::PTOK_NUMBER);
677 return(lexer_obj->check_id(yytext));
689 #line 690 "cmdlex.cc"
690 case YY_STATE_EOF(INITIAL):
693 case YY_END_OF_BUFFER:
695 /* Amount of text matched not including the EOB char. */
696 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
698 /* Undo the effects of YY_DO_BEFORE_ACTION. */
699 *yy_cp = (yy_hold_char);
700 YY_RESTORE_YY_MORE_OFFSET
702 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
704 /* We're scanning a new file or input source. It's
705 * possible that this happened because the user
706 * just pointed yyin at a new source and called
707 * yylex(). If so, then we have to assure
708 * consistency between YY_CURRENT_BUFFER and our
709 * globals. Here is the right place to do so, because
710 * this is the first action (other than possibly a
711 * back-up) that will match for the new input source.
713 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
714 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
715 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
718 /* Note that here we test for yy_c_buf_p "<=" to the position
719 * of the first EOB in the buffer, since yy_c_buf_p will
720 * already have been incremented past the NUL character
721 * (since all states make transitions on EOB to the
722 * end-of-buffer state). Contrast this with the test
725 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
726 { /* This was really a NUL. */
727 yy_state_type yy_next_state;
729 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
731 yy_current_state = yy_get_previous_state( );
733 /* Okay, we're now positioned to make the NUL
734 * transition. We couldn't have
735 * yy_get_previous_state() go ahead and do it
736 * for us because it doesn't know how to deal
737 * with the possibility of jamming (and we don't
738 * want to build jamming into it because then it
739 * will run more slowly).
742 yy_next_state = yy_try_NUL_trans( yy_current_state );
744 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
748 /* Consume the NUL. */
749 yy_cp = ++(yy_c_buf_p);
750 yy_current_state = yy_next_state;
756 yy_cp = (yy_c_buf_p);
761 else switch ( yy_get_next_buffer( ) )
763 case EOB_ACT_END_OF_FILE:
765 (yy_did_buffer_switch_on_eof) = 0;
769 /* Note: because we've taken care in
770 * yy_get_next_buffer() to have set up
771 * yytext, we can now set up
772 * yy_c_buf_p so that if some total
773 * hoser (like flex itself) wants to
774 * call the scanner after we return the
775 * YY_NULL, it'll still work - another
776 * YY_NULL will get returned.
778 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
780 yy_act = YY_STATE_EOF(YY_START);
786 if ( ! (yy_did_buffer_switch_on_eof) )
792 case EOB_ACT_CONTINUE_SCAN:
794 (yytext_ptr) + yy_amount_of_matched_text;
796 yy_current_state = yy_get_previous_state( );
798 yy_cp = (yy_c_buf_p);
799 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
802 case EOB_ACT_LAST_MATCH:
804 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
806 yy_current_state = yy_get_previous_state( );
808 yy_cp = (yy_c_buf_p);
809 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
817 "fatal flex scanner internal error--no action found" );
818 } /* end of action switch */
819 } /* end of scanning one token */
822 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
830 yylineno = 1; // this will only get updated if %option yylineno
832 yy_did_buffer_switch_on_eof = 0;
834 yy_looking_for_trail_begin = 0;
837 yy_more_offset = yy_prev_more_offset = 0;
839 yy_start_stack_ptr = yy_start_stack_depth = 0;
842 (yy_buffer_stack) = 0;
843 (yy_buffer_stack_top) = 0;
844 (yy_buffer_stack_max) = 0;
850 yyFlexLexer::~yyFlexLexer()
852 delete [] yy_state_buf;
853 yyfree(yy_start_stack );
854 yy_delete_buffer( YY_CURRENT_BUFFER );
857 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
861 yy_delete_buffer( YY_CURRENT_BUFFER );
862 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
869 #ifdef YY_INTERACTIVE
870 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
872 int yyFlexLexer::LexerInput( char* buf, int max_size )
875 if ( yyin->eof() || yyin->fail() )
878 #ifdef YY_INTERACTIVE
890 (void) yyin->read( buf, max_size );
895 return yyin->gcount();
899 void yyFlexLexer::LexerOutput( const char* buf, int size )
901 (void) yyout->write( buf, size );
904 /* yy_get_next_buffer - try to read in a new buffer
906 * Returns a code representing an action:
907 * EOB_ACT_LAST_MATCH -
908 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
909 * EOB_ACT_END_OF_FILE - end of file
911 int yyFlexLexer::yy_get_next_buffer()
913 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
914 register char *source = (yytext_ptr);
915 register int number_to_move, i;
918 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
920 "fatal flex scanner internal error--end of buffer missed" );
922 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
923 { /* Don't try to fill the buffer, so this is an EOF. */
924 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
926 /* We matched a single character, the EOB, so
927 * treat this as a final EOF.
929 return EOB_ACT_END_OF_FILE;
934 /* We matched some text prior to the EOB, first
937 return EOB_ACT_LAST_MATCH;
941 /* Try to read more data. */
943 /* First move last chars to start of buffer. */
944 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
946 for ( i = 0; i < number_to_move; ++i )
947 *(dest++) = *(source++);
949 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
950 /* don't do the read, it's not guaranteed to return an EOF,
953 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
958 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
960 while ( num_to_read <= 0 )
961 { /* Not enough room in the buffer - grow it. */
963 /* just a shorter name for the current buffer */
964 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
966 int yy_c_buf_p_offset =
967 (int) ((yy_c_buf_p) - b->yy_ch_buf);
969 if ( b->yy_is_our_buffer )
971 int new_size = b->yy_buf_size * 2;
974 b->yy_buf_size += b->yy_buf_size / 8;
978 b->yy_ch_buf = (char *)
979 /* Include room in for 2 EOB chars. */
980 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
983 /* Can't grow it, we don't own it. */
986 if ( ! b->yy_ch_buf )
988 "fatal error - scanner input buffer overflow" );
990 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
992 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
997 if ( num_to_read > YY_READ_BUF_SIZE )
998 num_to_read = YY_READ_BUF_SIZE;
1000 /* Read in more data. */
1001 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1002 (yy_n_chars), num_to_read );
1004 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1007 if ( (yy_n_chars) == 0 )
1009 if ( number_to_move == YY_MORE_ADJ )
1011 ret_val = EOB_ACT_END_OF_FILE;
1017 ret_val = EOB_ACT_LAST_MATCH;
1018 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1019 YY_BUFFER_EOF_PENDING;
1024 ret_val = EOB_ACT_CONTINUE_SCAN;
1026 (yy_n_chars) += number_to_move;
1027 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1028 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1030 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1035 /* yy_get_previous_state - get the state just before the EOB char was reached */
1037 yy_state_type yyFlexLexer::yy_get_previous_state()
1039 register yy_state_type yy_current_state;
1040 register char *yy_cp;
1042 yy_current_state = (yy_start);
1044 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1046 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1047 if ( yy_accept[yy_current_state] )
1049 (yy_last_accepting_state) = yy_current_state;
1050 (yy_last_accepting_cpos) = yy_cp;
1052 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1054 yy_current_state = (int) yy_def[yy_current_state];
1055 if ( yy_current_state >= 27 )
1056 yy_c = yy_meta[(unsigned int) yy_c];
1058 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1061 return yy_current_state;
1064 /* yy_try_NUL_trans - try to make a transition on the NUL character
1067 * next_state = yy_try_NUL_trans( current_state );
1069 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1071 register int yy_is_jam;
1072 register char *yy_cp = (yy_c_buf_p);
1074 register YY_CHAR yy_c = 1;
1075 if ( yy_accept[yy_current_state] )
1077 (yy_last_accepting_state) = yy_current_state;
1078 (yy_last_accepting_cpos) = yy_cp;
1080 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1082 yy_current_state = (int) yy_def[yy_current_state];
1083 if ( yy_current_state >= 27 )
1084 yy_c = yy_meta[(unsigned int) yy_c];
1086 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1087 yy_is_jam = (yy_current_state == 26);
1089 return yy_is_jam ? 0 : yy_current_state;
1092 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1094 register char *yy_cp;
1096 yy_cp = (yy_c_buf_p);
1098 /* undo effects of setting up yytext */
1099 *yy_cp = (yy_hold_char);
1101 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1102 { /* need to shift things up to make room */
1103 /* +2 for EOB chars. */
1104 register int number_to_move = (yy_n_chars) + 2;
1105 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1106 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1107 register char *source =
1108 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1110 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1111 *--dest = *--source;
1113 yy_cp += (int) (dest - source);
1114 yy_bp += (int) (dest - source);
1115 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1116 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1118 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1119 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1122 *--yy_cp = (char) c;
1124 (yytext_ptr) = yy_bp;
1125 (yy_hold_char) = *yy_cp;
1126 (yy_c_buf_p) = yy_cp;
1129 int yyFlexLexer::yyinput()
1133 *(yy_c_buf_p) = (yy_hold_char);
1135 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1137 /* yy_c_buf_p now points to the character we want to return.
1138 * If this occurs *before* the EOB characters, then it's a
1139 * valid NUL; if not, then we've hit the end of the buffer.
1141 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1142 /* This was really a NUL. */
1143 *(yy_c_buf_p) = '\0';
1146 { /* need more input */
1147 int offset = (yy_c_buf_p) - (yytext_ptr);
1150 switch ( yy_get_next_buffer( ) )
1152 case EOB_ACT_LAST_MATCH:
1153 /* This happens because yy_g_n_b()
1154 * sees that we've accumulated a
1155 * token and flags that we need to
1156 * try matching the token before
1157 * proceeding. But for input(),
1158 * there's no matching to consider.
1159 * So convert the EOB_ACT_LAST_MATCH
1160 * to EOB_ACT_END_OF_FILE.
1163 /* Reset buffer status. */
1168 case EOB_ACT_END_OF_FILE:
1173 if ( ! (yy_did_buffer_switch_on_eof) )
1182 case EOB_ACT_CONTINUE_SCAN:
1183 (yy_c_buf_p) = (yytext_ptr) + offset;
1189 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1190 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1191 (yy_hold_char) = *++(yy_c_buf_p);
1196 /** Immediately switch to a different input stream.
1197 * @param input_file A readable stream.
1199 * @note This function does not reset the start condition to @c INITIAL .
1201 void yyFlexLexer::yyrestart( std::istream* input_file )
1204 if ( ! YY_CURRENT_BUFFER ){
1205 yyensure_buffer_stack ();
1206 YY_CURRENT_BUFFER_LVALUE =
1207 yy_create_buffer( yyin, YY_BUF_SIZE );
1210 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1211 yy_load_buffer_state( );
1214 /** Switch to a different input buffer.
1215 * @param new_buffer The new input buffer.
1218 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1221 /* TODO. We should be able to replace this entire function body
1223 * yypop_buffer_state();
1224 * yypush_buffer_state(new_buffer);
1226 yyensure_buffer_stack ();
1227 if ( YY_CURRENT_BUFFER == new_buffer )
1230 if ( YY_CURRENT_BUFFER )
1232 /* Flush out information for old buffer. */
1233 *(yy_c_buf_p) = (yy_hold_char);
1234 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1235 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1238 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1239 yy_load_buffer_state( );
1241 /* We don't actually know whether we did this switch during
1242 * EOF (yywrap()) processing, but the only time this flag
1243 * is looked at is after yywrap() is called, so it's safe
1244 * to go ahead and always set it.
1246 (yy_did_buffer_switch_on_eof) = 1;
1249 void yyFlexLexer::yy_load_buffer_state()
1251 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1252 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1253 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1254 (yy_hold_char) = *(yy_c_buf_p);
1257 /** Allocate and initialize an input buffer state.
1258 * @param file A readable stream.
1259 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1261 * @return the allocated buffer state.
1263 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1267 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1269 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1271 b->yy_buf_size = size;
1273 /* yy_ch_buf has to be 2 characters longer than the size given because
1274 * we need to put in 2 end-of-buffer characters.
1276 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1277 if ( ! b->yy_ch_buf )
1278 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1280 b->yy_is_our_buffer = 1;
1282 yy_init_buffer( b, file );
1287 /** Destroy the buffer.
1288 * @param b a buffer created with yy_create_buffer()
1291 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1297 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1298 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1300 if ( b->yy_is_our_buffer )
1301 yyfree((void *) b->yy_ch_buf );
1303 yyfree((void *) b );
1306 extern "C" int isatty (int );
1308 /* Initializes or reinitializes a buffer.
1309 * This function is sometimes called more than once on the same buffer,
1310 * such as during a yyrestart() or at EOF.
1312 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1317 yy_flush_buffer( b );
1319 b->yy_input_file = file;
1320 b->yy_fill_buffer = 1;
1322 /* If b is the current buffer, then yy_init_buffer was _probably_
1323 * called from yyrestart() or through yy_get_next_buffer.
1324 * In that case, we don't want to reset the lineno or column.
1326 if (b != YY_CURRENT_BUFFER){
1327 b->yy_bs_lineno = 1;
1328 b->yy_bs_column = 0;
1331 b->yy_is_interactive = 0;
1335 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1336 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1339 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1346 /* We always need two end-of-buffer characters. The first causes
1347 * a transition to the end-of-buffer state. The second causes
1348 * a jam in that state.
1350 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1351 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1353 b->yy_buf_pos = &b->yy_ch_buf[0];
1356 b->yy_buffer_status = YY_BUFFER_NEW;
1358 if ( b == YY_CURRENT_BUFFER )
1359 yy_load_buffer_state( );
1362 /** Pushes the new state onto the stack. The new state becomes
1363 * the current state. This function will allocate the stack
1365 * @param new_buffer The new state.
1368 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1370 if (new_buffer == NULL)
1373 yyensure_buffer_stack();
1375 /* This block is copied from yy_switch_to_buffer. */
1376 if ( YY_CURRENT_BUFFER )
1378 /* Flush out information for old buffer. */
1379 *(yy_c_buf_p) = (yy_hold_char);
1380 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1381 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1384 /* Only push if top exists. Otherwise, replace top. */
1385 if (YY_CURRENT_BUFFER)
1386 (yy_buffer_stack_top)++;
1387 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1389 /* copied from yy_switch_to_buffer. */
1390 yy_load_buffer_state( );
1391 (yy_did_buffer_switch_on_eof) = 1;
1394 /** Removes and deletes the top of the stack, if present.
1395 * The next element becomes the new top.
1398 void yyFlexLexer::yypop_buffer_state (void)
1400 if (!YY_CURRENT_BUFFER)
1403 yy_delete_buffer(YY_CURRENT_BUFFER );
1404 YY_CURRENT_BUFFER_LVALUE = NULL;
1405 if ((yy_buffer_stack_top) > 0)
1406 --(yy_buffer_stack_top);
1408 if (YY_CURRENT_BUFFER) {
1409 yy_load_buffer_state( );
1410 (yy_did_buffer_switch_on_eof) = 1;
1414 /* Allocates the stack if it does not exist.
1415 * Guarantees space for at least one push.
1417 void yyFlexLexer::yyensure_buffer_stack(void)
1421 if (!(yy_buffer_stack)) {
1423 /* First allocation is just for 2 elements, since we don't know if this
1424 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1425 * immediate realloc on the next call.
1428 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1429 (num_to_alloc * sizeof(struct yy_buffer_state*)
1432 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1434 (yy_buffer_stack_max) = num_to_alloc;
1435 (yy_buffer_stack_top) = 0;
1439 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1441 /* Increase the buffer to prepare for a possible push. */
1442 int grow_size = 8 /* arbitrary grow size */;
1444 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1445 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1447 num_to_alloc * sizeof(struct yy_buffer_state*)
1450 /* zero only the new slots.*/
1451 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1452 (yy_buffer_stack_max) = num_to_alloc;
1456 void yyFlexLexer::yy_push_state( int new_state )
1458 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1462 (yy_start_stack_depth) += YY_START_STACK_INCR;
1463 new_size = (yy_start_stack_depth) * sizeof( int );
1465 if ( ! (yy_start_stack) )
1466 (yy_start_stack) = (int *) yyalloc(new_size );
1469 (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
1471 if ( ! (yy_start_stack) )
1473 "out of memory expanding start-condition stack" );
1476 (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1481 void yyFlexLexer::yy_pop_state()
1483 if ( --(yy_start_stack_ptr) < 0 )
1484 YY_FATAL_ERROR( "start-condition stack underflow" );
1486 BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1489 int yyFlexLexer::yy_top_state()
1491 return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1494 #ifndef YY_EXIT_FAILURE
1495 #define YY_EXIT_FAILURE 2
1498 void yyFlexLexer::LexerError( yyconst char msg[] )
1500 std::cerr << msg << std::endl;
1501 exit( YY_EXIT_FAILURE );
1504 /* Redefine yyless() so it works in section 3 code. */
1510 /* Undo effects of setting up yytext. */ \
1511 int yyless_macro_arg = (n); \
1512 YY_LESS_LINENO(yyless_macro_arg);\
1513 yytext[yyleng] = (yy_hold_char); \
1514 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1515 (yy_hold_char) = *(yy_c_buf_p); \
1516 *(yy_c_buf_p) = '\0'; \
1517 yyleng = yyless_macro_arg; \
1521 /* Accessor methods (get/set functions) to struct members. */
1524 * Internal utility routines.
1528 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1531 for ( i = 0; i < n; ++i )
1536 #ifdef YY_NEED_STRLEN
1537 static int yy_flex_strlen (yyconst char * s )
1540 for ( n = 0; s[n]; ++n )
1547 void *yyalloc (yy_size_t size )
1549 return (void *) malloc( size );
1552 void *yyrealloc (void * ptr, yy_size_t size )
1554 /* The cast to (char *) in the following accommodates both
1555 * implementations that use char* generic pointers, and those
1556 * that use void* generic pointers. It works with the latter
1557 * because both ANSI C and C++ allow castless assignment from
1558 * any pointer type to void*, and deal with argument conversions
1559 * as though doing an assignment.
1561 return (void *) realloc( (char *) ptr, size );
1564 void yyfree (void * ptr )
1566 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1569 #define YYTABLES_NAME "yytables"
1572 #undef YY_FLUSH_BUFFER
1574 #undef yy_new_buffer
1575 #undef yy_set_interactive
1577 #undef YY_DO_BEFORE_ACTION
1579 #ifdef YY_DECL_IS_OURS
1580 #undef YY_DECL_IS_OURS
1595 #include "cmdlexcl.h"
1596 #include "globals.h"
1599 cl_ucsim_lexer::LexerInput(char *buf, int max_size)
1601 if (!string_to_parse)
1602 return(yyFlexLexer::LexerInput(buf, max_size));
1603 int lrem= strlen(string_ptr);
1605 if (lrem < max_size)
1607 strncpy(buf, string_ptr, n);
1613 cl_ucsim_lexer::activate_lexer_to_parse_into(void *yylv)
1615 yylval= (YY_cl_ucsim_parser_STYPE *)yylv;
1619 cl_ucsim_lexer::check_id(char *token)
1621 class cl_uc *uc= application->get_uc();
1622 //printf("checking id=\"%s\"\n",token);
1626 class cl_memory *mem= uc->memory(token);
1629 yylval->memory_object= mem;
1630 return(tok(PTOK_MEMORY_OBJECT));
1634 bool found= uc->symbol2address(yytext, uc->sfr_tbl(), &addr);
1637 /*yylval->number= addr;
1638 return(tok(PTOK_NUMBER));*/
1639 yylval->memory.memory= uc->address_space(MEM_SFR_ID);
1640 yylval->memory.address= addr;
1641 return(tok(PTOK_MEMORY));
1644 found= uc->symbol2address(yytext, uc->bit_tbl(), &addr);
1649 yylval->bit.memory= uc->bit2mem(addr, &memaddr, &mask);
1650 yylval->bit.mem_address= memaddr;
1651 yylval->bit.bit_address= addr;
1652 yylval->bit.mask= mask;
1653 return(tok(PTOK_BIT));