* fixed GCC 4.4.0 mingw compilation:
[fw/sdcc] / sim / ucsim / cmd.src / cmdlex.cc
1 #line 2 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.cc"
2
3 #line 4 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.cc"
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     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
18      * following macro. This is required in order to pass the c++-multiple-scanners
19      * test in the regression suite. We get reports that it breaks inheritance.
20      * We will address this in a future release of flex, or omit the C++ scanner
21      * altogether.
22      */
23     #define yyFlexLexer yyFlexLexer
24
25 /* First, we deal with  platform-specific or compiler-specific issues. */
26
27 /* begin standard C headers. */
28
29 /* end standard C headers. */
30
31 /* flex integer type definitions */
32
33 #ifndef FLEXINT_H
34 #define FLEXINT_H
35
36 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
37
38 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
39
40 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
41  * if you want the limit (max/min) macros for int types.
42  */
43 #ifndef __STDC_LIMIT_MACROS
44 #define __STDC_LIMIT_MACROS 1
45 #endif
46
47 #include <inttypes.h>
48 typedef int8_t flex_int8_t;
49 typedef uint8_t flex_uint8_t;
50 typedef int16_t flex_int16_t;
51 typedef uint16_t flex_uint16_t;
52 typedef int32_t flex_int32_t;
53 typedef uint32_t flex_uint32_t;
54 #else
55 typedef signed char flex_int8_t;
56 typedef short int flex_int16_t;
57 typedef int flex_int32_t;
58 typedef unsigned char flex_uint8_t;
59 typedef unsigned short int flex_uint16_t;
60 typedef unsigned int flex_uint32_t;
61 #endif /* ! C99 */
62
63 /* Limits of integral types. */
64 #ifndef INT8_MIN
65 #define INT8_MIN               (-128)
66 #endif
67 #ifndef INT16_MIN
68 #define INT16_MIN              (-32767-1)
69 #endif
70 #ifndef INT32_MIN
71 #define INT32_MIN              (-2147483647-1)
72 #endif
73 #ifndef INT8_MAX
74 #define INT8_MAX               (127)
75 #endif
76 #ifndef INT16_MAX
77 #define INT16_MAX              (32767)
78 #endif
79 #ifndef INT32_MAX
80 #define INT32_MAX              (2147483647)
81 #endif
82 #ifndef UINT8_MAX
83 #define UINT8_MAX              (255U)
84 #endif
85 #ifndef UINT16_MAX
86 #define UINT16_MAX             (65535U)
87 #endif
88 #ifndef UINT32_MAX
89 #define UINT32_MAX             (4294967295U)
90 #endif
91
92 #endif /* ! FLEXINT_H */
93
94 /* begin standard C++ headers. */
95 #include <iostream>
96 #include <errno.h>
97 #include <cstdlib>
98 #include <cstring>
99 /* end standard C++ headers. */
100
101 #ifdef __cplusplus
102
103 /* The "const" storage-class-modifier is valid. */
104 #define YY_USE_CONST
105
106 #else   /* ! __cplusplus */
107
108 /* C99 requires __STDC__ to be defined as 1. */
109 #if defined (__STDC__)
110
111 #define YY_USE_CONST
112
113 #endif  /* defined (__STDC__) */
114 #endif  /* ! __cplusplus */
115
116 #ifdef YY_USE_CONST
117 #define yyconst const
118 #else
119 #define yyconst
120 #endif
121
122 /* Returned upon end-of-file. */
123 #define YY_NULL 0
124
125 /* Promotes a possibly negative, possibly signed char to an unsigned
126  * integer for use as an array index.  If the signed char is negative,
127  * we want to instead treat it as an 8-bit unsigned char, hence the
128  * double cast.
129  */
130 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
131
132 /* Enter a start condition.  This macro really ought to take a parameter,
133  * but we do it the disgusting crufty way forced on us by the ()-less
134  * definition of BEGIN.
135  */
136 #define BEGIN (yy_start) = 1 + 2 *
137
138 /* Translate the current start state into a value that can be later handed
139  * to BEGIN to return to the state.  The YYSTATE alias is for lex
140  * compatibility.
141  */
142 #define YY_START (((yy_start) - 1) / 2)
143 #define YYSTATE YY_START
144
145 /* Action number for EOF rule of a given start state. */
146 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
147
148 /* Special action meaning "start processing a new file". */
149 #define YY_NEW_FILE yyrestart( yyin  )
150
151 #define YY_END_OF_BUFFER_CHAR 0
152
153 /* Size of default input buffer. */
154 #ifndef YY_BUF_SIZE
155 #define YY_BUF_SIZE 16384
156 #endif
157
158 /* The state buf must be large enough to hold one state per character in the main buffer.
159  */
160 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
161
162 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
163 #define YY_TYPEDEF_YY_BUFFER_STATE
164 typedef struct yy_buffer_state *YY_BUFFER_STATE;
165 #endif
166
167 extern int yyleng;
168
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
172
173     #define YY_LESS_LINENO(n)
174
175 /* Return all but the first "n" matched characters back to the input stream. */
176 #define yyless(n) \
177         do \
178                 { \
179                 /* Undo effects of setting up yytext. */ \
180         int yyless_macro_arg = (n); \
181         YY_LESS_LINENO(yyless_macro_arg);\
182                 *yy_cp = (yy_hold_char); \
183                 YY_RESTORE_YY_MORE_OFFSET \
184                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
185                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
186                 } \
187         while ( 0 )
188
189 #define unput(c) yyunput( c, (yytext_ptr)  )
190
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t;
194 #endif
195
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
199         {
200
201         std::istream* yy_input_file;
202
203         char *yy_ch_buf;                /* input buffer */
204         char *yy_buf_pos;               /* current position in input buffer */
205
206         /* Size of input buffer in bytes, not including room for EOB
207          * characters.
208          */
209         yy_size_t yy_buf_size;
210
211         /* Number of characters read into yy_ch_buf, not including EOB
212          * characters.
213          */
214         int yy_n_chars;
215
216         /* Whether we "own" the buffer - i.e., we know we created it,
217          * and can realloc() it to grow it, and should free() it to
218          * delete it.
219          */
220         int yy_is_our_buffer;
221
222         /* Whether this is an "interactive" input source; if so, and
223          * if we're using stdio for input, then we want to use getc()
224          * instead of fread(), to make sure we stop fetching input after
225          * each newline.
226          */
227         int yy_is_interactive;
228
229         /* Whether we're considered to be at the beginning of a line.
230          * If so, '^' rules will be active on the next match, otherwise
231          * not.
232          */
233         int yy_at_bol;
234
235     int yy_bs_lineno; /**< The line count. */
236     int yy_bs_column; /**< The column count. */
237
238         /* Whether to try to fill the input buffer when we reach the
239          * end of it.
240          */
241         int yy_fill_buffer;
242
243         int yy_buffer_status;
244
245 #define YY_BUFFER_NEW 0
246 #define YY_BUFFER_NORMAL 1
247         /* When an EOF's been seen but there's still some text to process
248          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
249          * shouldn't try reading from the input source any more.  We might
250          * still have a bunch of tokens to match, though, because of
251          * possible backing-up.
252          *
253          * When we actually see the EOF, we change the status to "new"
254          * (via yyrestart()), so that the user can continue scanning by
255          * just pointing yyin at a new input file.
256          */
257 #define YY_BUFFER_EOF_PENDING 2
258
259         };
260 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
261
262 /* We provide macros for accessing buffer states in case in the
263  * future we want to put the buffer states in a more general
264  * "scanner state".
265  *
266  * Returns the top of the stack, or NULL.
267  */
268 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
269                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
270                           : NULL)
271
272 /* Same as previous macro, but useful when we know that the buffer stack is not
273  * NULL or when we need an lvalue. For internal use only.
274  */
275 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
276
277 void *yyalloc (yy_size_t  );
278 void *yyrealloc (void *,yy_size_t  );
279 void yyfree (void *  );
280
281 #define yy_new_buffer yy_create_buffer
282
283 #define yy_set_interactive(is_interactive) \
284         { \
285         if ( ! YY_CURRENT_BUFFER ){ \
286         yyensure_buffer_stack (); \
287                 YY_CURRENT_BUFFER_LVALUE =    \
288             yy_create_buffer( yyin, YY_BUF_SIZE ); \
289         } \
290         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
291         }
292
293 #define yy_set_bol(at_bol) \
294         { \
295         if ( ! YY_CURRENT_BUFFER ){\
296         yyensure_buffer_stack (); \
297                 YY_CURRENT_BUFFER_LVALUE =    \
298             yy_create_buffer( yyin, YY_BUF_SIZE ); \
299         } \
300         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
301         }
302
303 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
304
305 /* Begin user sect3 */
306
307 typedef unsigned char YY_CHAR;
308
309 #define yytext_ptr yytext
310 #define YY_INTERACTIVE
311
312 #include <FlexLexer.h>
313
314 /* Done after the current pattern has been matched and before the
315  * corresponding action - sets up yytext.
316  */
317 #define YY_DO_BEFORE_ACTION \
318         (yytext_ptr) = yy_bp; \
319         yyleng = (size_t) (yy_cp - yy_bp); \
320         (yy_hold_char) = *yy_cp; \
321         *yy_cp = '\0'; \
322         (yy_c_buf_p) = yy_cp;
323
324 #define YY_NUM_RULES 16
325 #define YY_END_OF_BUFFER 17
326 /* This struct is not used in this scanner,
327    but its presence is necessary. */
328 struct yy_trans_info
329         {
330         flex_int32_t yy_verify;
331         flex_int32_t yy_nxt;
332         };
333 static yyconst flex_int16_t yy_accept[27] =
334     {   0,
335         1,    1,   17,   15,    1,   16,   12,    6,    7,    4,
336         2,    3,   11,    5,   13,   13,   10,   14,    8,    9,
337         1,   13,    0,   14,   13,    0
338     } ;
339
340 static yyconst flex_int32_t yy_ec[256] =
341     {   0,
342         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
343         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
344         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
345         1,    2,    1,    1,    1,    1,    1,    4,    1,    5,
346         6,    7,    8,    1,    9,   10,   11,   12,   13,   13,
347        13,   13,   13,   13,   13,   13,   13,    1,    1,    1,
348        14,    1,    1,    1,   15,   15,   15,   15,   15,   15,
349        16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
350        16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
351        17,    1,   18,    1,   16,    1,   15,   15,   15,   15,
352
353        15,   15,   16,   16,   16,   16,   16,   16,   16,   16,
354        16,   16,   16,   16,   16,   16,   16,   16,   16,   19,
355        16,   16,    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,
358         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
359         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
360         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
361         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
362         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
363
364         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
365         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
366         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
367         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
368         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
369         1,    1,    1,    1,    1
370     } ;
371
372 static yyconst flex_int32_t yy_meta[20] =
373     {   0,
374         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
375         1,    2,    2,    1,    3,    4,    1,    1,    5
376     } ;
377
378 static yyconst flex_int16_t yy_base[30] =
379     {   0,
380         0,    0,   35,   36,   32,   36,   36,   36,   36,   36,
381        36,   36,   36,   36,    7,    8,   36,    0,   36,   36,
382        23,   10,    0,    0,    0,   36,   22,   26,   30
383     } ;
384
385 static yyconst flex_int16_t yy_def[30] =
386     {   0,
387        26,    1,   26,   26,   26,   26,   26,   26,   26,   26,
388        26,   26,   26,   26,   27,   26,   26,   28,   26,   26,
389        26,   26,   29,   28,   29,    0,   26,   26,   26
390     } ;
391
392 static yyconst flex_int16_t yy_nxt[56] =
393     {   0,
394         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
395        14,   15,   16,   17,   18,   18,   19,   20,   18,   22,
396        22,   22,   22,   22,   21,   23,   22,   24,   24,   24,
397        24,   25,   25,   21,   26,    3,   26,   26,   26,   26,
398        26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
399        26,   26,   26,   26,   26
400     } ;
401
402 static yyconst flex_int16_t yy_chk[56] =
403     {   0,
404         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
405         1,    1,    1,    1,    1,    1,    1,    1,    1,   16,
406        16,   22,   22,   27,   21,   15,   27,   28,   28,   28,
407        28,   29,   29,    5,    3,   26,   26,   26,   26,   26,
408        26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
409        26,   26,   26,   26,   26
410     } ;
411
412 /* The intent behind this definition is that it'll catch
413  * any uses of REJECT which flex missed.
414  */
415 #define REJECT reject_used_but_not_detected
416 #define yymore() yymore_used_but_not_detected
417 #define YY_MORE_ADJ 0
418 #define YY_RESTORE_YY_MORE_OFFSET
419 #line 1 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
420 #line 2 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
421 #include <stdio.h>
422 #include "cmdlexcl.h"
423 #include "cmdpars.h"
424
425 static YY_cl_ucsim_parser_STYPE *yylval;
426
427 int yywrap(void);
428
429 #define tok(x) (YY_cl_ucsim_parser_CLASS::x)
430 #define lexer_obj (dynamic_cast<class cl_ucsim_lexer *>(this))
431
432 #line 433 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.cc"
433
434 #define INITIAL 0
435
436 #ifndef YY_NO_UNISTD_H
437 /* Special case for "unistd.h", since it is non-ANSI. We include it way
438  * down here because we want the user's section 1 to have been scanned first.
439  * The user has a chance to override it with an option.
440  */
441 #include <unistd.h>
442 #endif
443
444 #ifndef YY_EXTRA_TYPE
445 #define YY_EXTRA_TYPE void *
446 #endif
447
448 #ifndef yytext_ptr
449 static void yy_flex_strncpy (char *,yyconst char *,int );
450 #endif
451
452 #ifdef YY_NEED_STRLEN
453 static int yy_flex_strlen (yyconst char * );
454 #endif
455
456 #ifndef YY_NO_INPUT
457
458 #endif
459
460 /* Amount of stuff to slurp up with each read. */
461 #ifndef YY_READ_BUF_SIZE
462 #define YY_READ_BUF_SIZE 8192
463 #endif
464
465 /* Copy whatever the last rule matched to the standard output. */
466 #ifndef ECHO
467 #define ECHO LexerOutput( yytext, yyleng )
468 #endif
469
470 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
471  * is returned in "result".
472  */
473 #ifndef YY_INPUT
474 #define YY_INPUT(buf,result,max_size) \
475 \
476         if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
477                 YY_FATAL_ERROR( "input in flex scanner failed" );
478
479 #endif
480
481 /* No semi-colon after return; correct usage is to write "yyterminate();" -
482  * we don't want an extra ';' after the "return" because that will cause
483  * some compilers to complain about unreachable statements.
484  */
485 #ifndef yyterminate
486 #define yyterminate() return YY_NULL
487 #endif
488
489 /* Number of entries by which start-condition stack grows. */
490 #ifndef YY_START_STACK_INCR
491 #define YY_START_STACK_INCR 25
492 #endif
493
494 /* Report a fatal error. */
495 #ifndef YY_FATAL_ERROR
496 #define YY_FATAL_ERROR(msg) LexerError( msg )
497 #endif
498
499 /* end tables serialization structures and prototypes */
500
501 /* Default declaration of generated scanner - a define so the user can
502  * easily add parameters.
503  */
504 #ifndef YY_DECL
505 #define YY_DECL_IS_OURS 1
506 #define YY_DECL int yyFlexLexer::yylex()
507 #endif /* !YY_DECL */
508
509 /* Code executed at the beginning of each rule, after yytext and yyleng
510  * have been set up.
511  */
512 #ifndef YY_USER_ACTION
513 #define YY_USER_ACTION
514 #endif
515
516 /* Code executed at the end of each rule. */
517 #ifndef YY_BREAK
518 #define YY_BREAK break;
519 #endif
520
521 #define YY_RULE_SETUP \
522         YY_USER_ACTION
523
524 /** The main scanner function which does all the work.
525  */
526 YY_DECL
527 {
528         register yy_state_type yy_current_state;
529         register char *yy_cp, *yy_bp;
530         register int yy_act;
531
532 #line 15 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
533
534
535 #line 536 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.cc"
536
537         if ( !(yy_init) )
538                 {
539                 (yy_init) = 1;
540
541 #ifdef YY_USER_INIT
542                 YY_USER_INIT;
543 #endif
544
545                 if ( ! (yy_start) )
546                         (yy_start) = 1; /* first start state */
547
548                 if ( ! yyin )
549                         yyin = & std::cin;
550
551                 if ( ! yyout )
552                         yyout = & std::cout;
553
554                 if ( ! YY_CURRENT_BUFFER ) {
555                         yyensure_buffer_stack ();
556                         YY_CURRENT_BUFFER_LVALUE =
557                                 yy_create_buffer( yyin, YY_BUF_SIZE );
558                 }
559
560                 yy_load_buffer_state(  );
561                 }
562
563         while ( 1 )             /* loops until end-of-file is reached */
564                 {
565                 yy_cp = (yy_c_buf_p);
566
567                 /* Support of yytext. */
568                 *yy_cp = (yy_hold_char);
569
570                 /* yy_bp points to the position in yy_ch_buf of the start of
571                  * the current run.
572                  */
573                 yy_bp = yy_cp;
574
575                 yy_current_state = (yy_start);
576 yy_match:
577                 do
578                         {
579                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
580                         if ( yy_accept[yy_current_state] )
581                                 {
582                                 (yy_last_accepting_state) = yy_current_state;
583                                 (yy_last_accepting_cpos) = yy_cp;
584                                 }
585                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
586                                 {
587                                 yy_current_state = (int) yy_def[yy_current_state];
588                                 if ( yy_current_state >= 27 )
589                                         yy_c = yy_meta[(unsigned int) yy_c];
590                                 }
591                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
592                         ++yy_cp;
593                         }
594                 while ( yy_base[yy_current_state] != 36 );
595
596 yy_find_action:
597                 yy_act = yy_accept[yy_current_state];
598                 if ( yy_act == 0 )
599                         { /* have to back up */
600                         yy_cp = (yy_last_accepting_cpos);
601                         yy_current_state = (yy_last_accepting_state);
602                         yy_act = yy_accept[yy_current_state];
603                         }
604
605                 YY_DO_BEFORE_ACTION;
606
607 do_action:      /* This label is used only to access EOF actions. */
608
609                 switch ( yy_act )
610         { /* beginning of action switch */
611                         case 0: /* must back up */
612                         /* undo the effects of YY_DO_BEFORE_ACTION */
613                         *yy_cp = (yy_hold_char);
614                         yy_cp = (yy_last_accepting_cpos);
615                         yy_current_state = (yy_last_accepting_state);
616                         goto yy_find_action;
617
618 case 1:
619 YY_RULE_SETUP
620 #line 17 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
621 ;
622         YY_BREAK
623 case 2:
624 YY_RULE_SETUP
625 #line 19 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
626 return(tok(PTOK_PLUS));
627         YY_BREAK
628 case 3:
629 YY_RULE_SETUP
630 #line 20 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
631 return(tok(PTOK_MINUS));
632         YY_BREAK
633 case 4:
634 YY_RULE_SETUP
635 #line 21 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
636 return(tok(PTOK_ASTERIX));
637         YY_BREAK
638 case 5:
639 YY_RULE_SETUP
640 #line 22 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
641 return(tok(PTOK_SLASH));
642         YY_BREAK
643 case 6:
644 YY_RULE_SETUP
645 #line 23 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
646 return(tok(PTOK_LEFT_PAREN));
647         YY_BREAK
648 case 7:
649 YY_RULE_SETUP
650 #line 24 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
651 return(tok(PTOK_RIGHT_PAREN));
652         YY_BREAK
653 case 8:
654 YY_RULE_SETUP
655 #line 25 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
656 return(tok(PTOK_LEFT_BRACKET));
657         YY_BREAK
658 case 9:
659 YY_RULE_SETUP
660 #line 26 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
661 return(tok(PTOK_RIGHT_BRACKET));
662         YY_BREAK
663 case 10:
664 YY_RULE_SETUP
665 #line 27 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
666 return(tok(PTOK_EQUAL));
667         YY_BREAK
668 case 11:
669 YY_RULE_SETUP
670 #line 28 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
671 return(tok(PTOK_DOT));
672         YY_BREAK
673 case 12:
674 YY_RULE_SETUP
675 #line 29 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
676 return(tok(PTOK_AMPERSAND));
677         YY_BREAK
678 case 13:
679 YY_RULE_SETUP
680 #line 31 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
681 {
682   yylval->number= strtol(yytext, 0, 0);
683   return(YY_cl_ucsim_parser_CLASS::PTOK_NUMBER);
684 }
685         YY_BREAK
686 case 14:
687 YY_RULE_SETUP
688 #line 36 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
689 return(lexer_obj->check_id(yytext));
690         YY_BREAK
691 case 15:
692 YY_RULE_SETUP
693 #line 38 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
694 ;
695         YY_BREAK
696 case 16:
697 YY_RULE_SETUP
698 #line 40 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
699 ECHO;
700         YY_BREAK
701 #line 702 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.cc"
702 case YY_STATE_EOF(INITIAL):
703         yyterminate();
704
705         case YY_END_OF_BUFFER:
706                 {
707                 /* Amount of text matched not including the EOB char. */
708                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
709
710                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
711                 *yy_cp = (yy_hold_char);
712                 YY_RESTORE_YY_MORE_OFFSET
713
714                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
715                         {
716                         /* We're scanning a new file or input source.  It's
717                          * possible that this happened because the user
718                          * just pointed yyin at a new source and called
719                          * yylex().  If so, then we have to assure
720                          * consistency between YY_CURRENT_BUFFER and our
721                          * globals.  Here is the right place to do so, because
722                          * this is the first action (other than possibly a
723                          * back-up) that will match for the new input source.
724                          */
725                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
726                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
727                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
728                         }
729
730                 /* Note that here we test for yy_c_buf_p "<=" to the position
731                  * of the first EOB in the buffer, since yy_c_buf_p will
732                  * already have been incremented past the NUL character
733                  * (since all states make transitions on EOB to the
734                  * end-of-buffer state).  Contrast this with the test
735                  * in input().
736                  */
737                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
738                         { /* This was really a NUL. */
739                         yy_state_type yy_next_state;
740
741                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
742
743                         yy_current_state = yy_get_previous_state(  );
744
745                         /* Okay, we're now positioned to make the NUL
746                          * transition.  We couldn't have
747                          * yy_get_previous_state() go ahead and do it
748                          * for us because it doesn't know how to deal
749                          * with the possibility of jamming (and we don't
750                          * want to build jamming into it because then it
751                          * will run more slowly).
752                          */
753
754                         yy_next_state = yy_try_NUL_trans( yy_current_state );
755
756                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
757
758                         if ( yy_next_state )
759                                 {
760                                 /* Consume the NUL. */
761                                 yy_cp = ++(yy_c_buf_p);
762                                 yy_current_state = yy_next_state;
763                                 goto yy_match;
764                                 }
765
766                         else
767                                 {
768                                 yy_cp = (yy_c_buf_p);
769                                 goto yy_find_action;
770                                 }
771                         }
772
773                 else switch ( yy_get_next_buffer(  ) )
774                         {
775                         case EOB_ACT_END_OF_FILE:
776                                 {
777                                 (yy_did_buffer_switch_on_eof) = 0;
778
779                                 if ( yywrap(  ) )
780                                         {
781                                         /* Note: because we've taken care in
782                                          * yy_get_next_buffer() to have set up
783                                          * yytext, we can now set up
784                                          * yy_c_buf_p so that if some total
785                                          * hoser (like flex itself) wants to
786                                          * call the scanner after we return the
787                                          * YY_NULL, it'll still work - another
788                                          * YY_NULL will get returned.
789                                          */
790                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
791
792                                         yy_act = YY_STATE_EOF(YY_START);
793                                         goto do_action;
794                                         }
795
796                                 else
797                                         {
798                                         if ( ! (yy_did_buffer_switch_on_eof) )
799                                                 YY_NEW_FILE;
800                                         }
801                                 break;
802                                 }
803
804                         case EOB_ACT_CONTINUE_SCAN:
805                                 (yy_c_buf_p) =
806                                         (yytext_ptr) + yy_amount_of_matched_text;
807
808                                 yy_current_state = yy_get_previous_state(  );
809
810                                 yy_cp = (yy_c_buf_p);
811                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
812                                 goto yy_match;
813
814                         case EOB_ACT_LAST_MATCH:
815                                 (yy_c_buf_p) =
816                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
817
818                                 yy_current_state = yy_get_previous_state(  );
819
820                                 yy_cp = (yy_c_buf_p);
821                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
822                                 goto yy_find_action;
823                         }
824                 break;
825                 }
826
827         default:
828                 YY_FATAL_ERROR(
829                         "fatal flex scanner internal error--no action found" );
830         } /* end of action switch */
831                 } /* end of scanning one token */
832 } /* end of yylex */
833
834 /* The contents of this function are C++ specific, so the () macro is not used.
835  */
836 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
837 {
838         yyin = arg_yyin;
839         yyout = arg_yyout;
840         yy_c_buf_p = 0;
841         yy_init = 0;
842         yy_start = 0;
843         yy_flex_debug = 0;
844         yylineno = 1;   // this will only get updated if %option yylineno
845
846         yy_did_buffer_switch_on_eof = 0;
847
848         yy_looking_for_trail_begin = 0;
849         yy_more_flag = 0;
850         yy_more_len = 0;
851         yy_more_offset = yy_prev_more_offset = 0;
852
853         yy_start_stack_ptr = yy_start_stack_depth = 0;
854         yy_start_stack = NULL;
855
856         yy_buffer_stack = 0;
857         yy_buffer_stack_top = 0;
858         yy_buffer_stack_max = 0;
859
860         yy_state_buf = 0;
861
862 }
863
864 /* The contents of this function are C++ specific, so the () macro is not used.
865  */
866 yyFlexLexer::~yyFlexLexer()
867 {
868         delete [] yy_state_buf;
869         yyfree(yy_start_stack  );
870         yy_delete_buffer( YY_CURRENT_BUFFER );
871         yyfree(yy_buffer_stack  );
872 }
873
874 /* The contents of this function are C++ specific, so the () macro is not used.
875  */
876 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
877 {
878         if ( new_in )
879                 {
880                 yy_delete_buffer( YY_CURRENT_BUFFER );
881                 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
882                 }
883
884         if ( new_out )
885                 yyout = new_out;
886 }
887
888 #ifdef YY_INTERACTIVE
889 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
890 #else
891 int yyFlexLexer::LexerInput( char* buf, int max_size )
892 #endif
893 {
894         if ( yyin->eof() || yyin->fail() )
895                 return 0;
896
897 #ifdef YY_INTERACTIVE
898         yyin->get( buf[0] );
899
900         if ( yyin->eof() )
901                 return 0;
902
903         if ( yyin->bad() )
904                 return -1;
905
906         return 1;
907
908 #else
909         (void) yyin->read( buf, max_size );
910
911         if ( yyin->bad() )
912                 return -1;
913         else
914                 return yyin->gcount();
915 #endif
916 }
917
918 void yyFlexLexer::LexerOutput( const char* buf, int size )
919 {
920         (void) yyout->write( buf, size );
921 }
922
923 /* yy_get_next_buffer - try to read in a new buffer
924  *
925  * Returns a code representing an action:
926  *      EOB_ACT_LAST_MATCH -
927  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
928  *      EOB_ACT_END_OF_FILE - end of file
929  */
930 int yyFlexLexer::yy_get_next_buffer()
931 {
932         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
933         register char *source = (yytext_ptr);
934         register int number_to_move, i;
935         int ret_val;
936
937         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
938                 YY_FATAL_ERROR(
939                 "fatal flex scanner internal error--end of buffer missed" );
940
941         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
942                 { /* Don't try to fill the buffer, so this is an EOF. */
943                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
944                         {
945                         /* We matched a single character, the EOB, so
946                          * treat this as a final EOF.
947                          */
948                         return EOB_ACT_END_OF_FILE;
949                         }
950
951                 else
952                         {
953                         /* We matched some text prior to the EOB, first
954                          * process it.
955                          */
956                         return EOB_ACT_LAST_MATCH;
957                         }
958                 }
959
960         /* Try to read more data. */
961
962         /* First move last chars to start of buffer. */
963         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
964
965         for ( i = 0; i < number_to_move; ++i )
966                 *(dest++) = *(source++);
967
968         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
969                 /* don't do the read, it's not guaranteed to return an EOF,
970                  * just force an EOF
971                  */
972                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
973
974         else
975                 {
976                         int num_to_read =
977                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
978
979                 while ( num_to_read <= 0 )
980                         { /* Not enough room in the buffer - grow it. */
981
982                         /* just a shorter name for the current buffer */
983                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
984
985                         int yy_c_buf_p_offset =
986                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
987
988                         if ( b->yy_is_our_buffer )
989                                 {
990                                 int new_size = b->yy_buf_size * 2;
991
992                                 if ( new_size <= 0 )
993                                         b->yy_buf_size += b->yy_buf_size / 8;
994                                 else
995                                         b->yy_buf_size *= 2;
996
997                                 b->yy_ch_buf = (char *)
998                                         /* Include room in for 2 EOB chars. */
999                                         yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1000                                 }
1001                         else
1002                                 /* Can't grow it, we don't own it. */
1003                                 b->yy_ch_buf = 0;
1004
1005                         if ( ! b->yy_ch_buf )
1006                                 YY_FATAL_ERROR(
1007                                 "fatal error - scanner input buffer overflow" );
1008
1009                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1010
1011                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1012                                                 number_to_move - 1;
1013
1014                         }
1015
1016                 if ( num_to_read > YY_READ_BUF_SIZE )
1017                         num_to_read = YY_READ_BUF_SIZE;
1018
1019                 /* Read in more data. */
1020                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1021                         (yy_n_chars), (size_t) num_to_read );
1022
1023                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1024                 }
1025
1026         if ( (yy_n_chars) == 0 )
1027                 {
1028                 if ( number_to_move == YY_MORE_ADJ )
1029                         {
1030                         ret_val = EOB_ACT_END_OF_FILE;
1031                         yyrestart( yyin  );
1032                         }
1033
1034                 else
1035                         {
1036                         ret_val = EOB_ACT_LAST_MATCH;
1037                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1038                                 YY_BUFFER_EOF_PENDING;
1039                         }
1040                 }
1041
1042         else
1043                 ret_val = EOB_ACT_CONTINUE_SCAN;
1044
1045         if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1046                 /* Extend the array by 50%, plus the number we really need. */
1047                 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1048                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1049                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1050                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1051         }
1052
1053         (yy_n_chars) += number_to_move;
1054         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1055         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1056
1057         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1058
1059         return ret_val;
1060 }
1061
1062 /* yy_get_previous_state - get the state just before the EOB char was reached */
1063
1064     yy_state_type yyFlexLexer::yy_get_previous_state()
1065 {
1066         register yy_state_type yy_current_state;
1067         register char *yy_cp;
1068
1069         yy_current_state = (yy_start);
1070
1071         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1072                 {
1073                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1074                 if ( yy_accept[yy_current_state] )
1075                         {
1076                         (yy_last_accepting_state) = yy_current_state;
1077                         (yy_last_accepting_cpos) = yy_cp;
1078                         }
1079                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1080                         {
1081                         yy_current_state = (int) yy_def[yy_current_state];
1082                         if ( yy_current_state >= 27 )
1083                                 yy_c = yy_meta[(unsigned int) yy_c];
1084                         }
1085                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1086                 }
1087
1088         return yy_current_state;
1089 }
1090
1091 /* yy_try_NUL_trans - try to make a transition on the NUL character
1092  *
1093  * synopsis
1094  *      next_state = yy_try_NUL_trans( current_state );
1095  */
1096     yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1097 {
1098         register int yy_is_jam;
1099         register char *yy_cp = (yy_c_buf_p);
1100
1101         register YY_CHAR yy_c = 1;
1102         if ( yy_accept[yy_current_state] )
1103                 {
1104                 (yy_last_accepting_state) = yy_current_state;
1105                 (yy_last_accepting_cpos) = yy_cp;
1106                 }
1107         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1108                 {
1109                 yy_current_state = (int) yy_def[yy_current_state];
1110                 if ( yy_current_state >= 27 )
1111                         yy_c = yy_meta[(unsigned int) yy_c];
1112                 }
1113         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1114         yy_is_jam = (yy_current_state == 26);
1115
1116         return yy_is_jam ? 0 : yy_current_state;
1117 }
1118
1119     void yyFlexLexer::yyunput( int c, register char* yy_bp)
1120 {
1121         register char *yy_cp;
1122
1123     yy_cp = (yy_c_buf_p);
1124
1125         /* undo effects of setting up yytext */
1126         *yy_cp = (yy_hold_char);
1127
1128         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1129                 { /* need to shift things up to make room */
1130                 /* +2 for EOB chars. */
1131                 register int number_to_move = (yy_n_chars) + 2;
1132                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1133                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1134                 register char *source =
1135                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1136
1137                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1138                         *--dest = *--source;
1139
1140                 yy_cp += (int) (dest - source);
1141                 yy_bp += (int) (dest - source);
1142                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1143                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1144
1145                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1146                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1147                 }
1148
1149         *--yy_cp = (char) c;
1150
1151         (yytext_ptr) = yy_bp;
1152         (yy_hold_char) = *yy_cp;
1153         (yy_c_buf_p) = yy_cp;
1154 }
1155
1156     int yyFlexLexer::yyinput()
1157 {
1158         int c;
1159
1160         *(yy_c_buf_p) = (yy_hold_char);
1161
1162         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1163                 {
1164                 /* yy_c_buf_p now points to the character we want to return.
1165                  * If this occurs *before* the EOB characters, then it's a
1166                  * valid NUL; if not, then we've hit the end of the buffer.
1167                  */
1168                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1169                         /* This was really a NUL. */
1170                         *(yy_c_buf_p) = '\0';
1171
1172                 else
1173                         { /* need more input */
1174                         int offset = (yy_c_buf_p) - (yytext_ptr);
1175                         ++(yy_c_buf_p);
1176
1177                         switch ( yy_get_next_buffer(  ) )
1178                                 {
1179                                 case EOB_ACT_LAST_MATCH:
1180                                         /* This happens because yy_g_n_b()
1181                                          * sees that we've accumulated a
1182                                          * token and flags that we need to
1183                                          * try matching the token before
1184                                          * proceeding.  But for input(),
1185                                          * there's no matching to consider.
1186                                          * So convert the EOB_ACT_LAST_MATCH
1187                                          * to EOB_ACT_END_OF_FILE.
1188                                          */
1189
1190                                         /* Reset buffer status. */
1191                                         yyrestart( yyin );
1192
1193                                         /*FALLTHROUGH*/
1194
1195                                 case EOB_ACT_END_OF_FILE:
1196                                         {
1197                                         if ( yywrap(  ) )
1198                                                 return EOF;
1199
1200                                         if ( ! (yy_did_buffer_switch_on_eof) )
1201                                                 YY_NEW_FILE;
1202 #ifdef __cplusplus
1203                                         return yyinput();
1204 #else
1205                                         return input();
1206 #endif
1207                                         }
1208
1209                                 case EOB_ACT_CONTINUE_SCAN:
1210                                         (yy_c_buf_p) = (yytext_ptr) + offset;
1211                                         break;
1212                                 }
1213                         }
1214                 }
1215
1216         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
1217         *(yy_c_buf_p) = '\0';   /* preserve yytext */
1218         (yy_hold_char) = *++(yy_c_buf_p);
1219
1220         return c;
1221 }
1222
1223 /** Immediately switch to a different input stream.
1224  * @param input_file A readable stream.
1225  *
1226  * @note This function does not reset the start condition to @c INITIAL .
1227  */
1228     void yyFlexLexer::yyrestart( std::istream* input_file )
1229 {
1230
1231         if ( ! YY_CURRENT_BUFFER ){
1232         yyensure_buffer_stack ();
1233                 YY_CURRENT_BUFFER_LVALUE =
1234             yy_create_buffer( yyin, YY_BUF_SIZE );
1235         }
1236
1237         yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1238         yy_load_buffer_state(  );
1239 }
1240
1241 /** Switch to a different input buffer.
1242  * @param new_buffer The new input buffer.
1243  *
1244  */
1245     void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1246 {
1247
1248         /* TODO. We should be able to replace this entire function body
1249          * with
1250          *              yypop_buffer_state();
1251          *              yypush_buffer_state(new_buffer);
1252      */
1253         yyensure_buffer_stack ();
1254         if ( YY_CURRENT_BUFFER == new_buffer )
1255                 return;
1256
1257         if ( YY_CURRENT_BUFFER )
1258                 {
1259                 /* Flush out information for old buffer. */
1260                 *(yy_c_buf_p) = (yy_hold_char);
1261                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1262                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1263                 }
1264
1265         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1266         yy_load_buffer_state(  );
1267
1268         /* We don't actually know whether we did this switch during
1269          * EOF (yywrap()) processing, but the only time this flag
1270          * is looked at is after yywrap() is called, so it's safe
1271          * to go ahead and always set it.
1272          */
1273         (yy_did_buffer_switch_on_eof) = 1;
1274 }
1275
1276     void yyFlexLexer::yy_load_buffer_state()
1277 {
1278         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1279         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1280         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1281         (yy_hold_char) = *(yy_c_buf_p);
1282 }
1283
1284 /** Allocate and initialize an input buffer state.
1285  * @param file A readable stream.
1286  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1287  *
1288  * @return the allocated buffer state.
1289  */
1290     YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1291 {
1292         YY_BUFFER_STATE b;
1293
1294         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1295         if ( ! b )
1296                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1297
1298         b->yy_buf_size = size;
1299
1300         /* yy_ch_buf has to be 2 characters longer than the size given because
1301          * we need to put in 2 end-of-buffer characters.
1302          */
1303         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
1304         if ( ! b->yy_ch_buf )
1305                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1306
1307         b->yy_is_our_buffer = 1;
1308
1309         yy_init_buffer( b, file );
1310
1311         return b;
1312 }
1313
1314 /** Destroy the buffer.
1315  * @param b a buffer created with yy_create_buffer()
1316  *
1317  */
1318     void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1319 {
1320
1321         if ( ! b )
1322                 return;
1323
1324         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1325                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1326
1327         if ( b->yy_is_our_buffer )
1328                 yyfree((void *) b->yy_ch_buf  );
1329
1330         yyfree((void *) b  );
1331 }
1332
1333 extern "C" int isatty (int );
1334
1335 /* Initializes or reinitializes a buffer.
1336  * This function is sometimes called more than once on the same buffer,
1337  * such as during a yyrestart() or at EOF.
1338  */
1339     void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1340
1341 {
1342         int oerrno = errno;
1343
1344         yy_flush_buffer( b );
1345
1346         b->yy_input_file = file;
1347         b->yy_fill_buffer = 1;
1348
1349     /* If b is the current buffer, then yy_init_buffer was _probably_
1350      * called from yyrestart() or through yy_get_next_buffer.
1351      * In that case, we don't want to reset the lineno or column.
1352      */
1353     if (b != YY_CURRENT_BUFFER){
1354         b->yy_bs_lineno = 1;
1355         b->yy_bs_column = 0;
1356     }
1357
1358         b->yy_is_interactive = 0;
1359         errno = oerrno;
1360 }
1361
1362 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1363  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1364  *
1365  */
1366     void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1367 {
1368         if ( ! b )
1369                 return;
1370
1371         b->yy_n_chars = 0;
1372
1373         /* We always need two end-of-buffer characters.  The first causes
1374          * a transition to the end-of-buffer state.  The second causes
1375          * a jam in that state.
1376          */
1377         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1378         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1379
1380         b->yy_buf_pos = &b->yy_ch_buf[0];
1381
1382         b->yy_at_bol = 1;
1383         b->yy_buffer_status = YY_BUFFER_NEW;
1384
1385         if ( b == YY_CURRENT_BUFFER )
1386                 yy_load_buffer_state(  );
1387 }
1388
1389 /** Pushes the new state onto the stack. The new state becomes
1390  *  the current state. This function will allocate the stack
1391  *  if necessary.
1392  *  @param new_buffer The new state.
1393  *
1394  */
1395 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1396 {
1397         if (new_buffer == NULL)
1398                 return;
1399
1400         yyensure_buffer_stack();
1401
1402         /* This block is copied from yy_switch_to_buffer. */
1403         if ( YY_CURRENT_BUFFER )
1404                 {
1405                 /* Flush out information for old buffer. */
1406                 *(yy_c_buf_p) = (yy_hold_char);
1407                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1408                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1409                 }
1410
1411         /* Only push if top exists. Otherwise, replace top. */
1412         if (YY_CURRENT_BUFFER)
1413                 (yy_buffer_stack_top)++;
1414         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1415
1416         /* copied from yy_switch_to_buffer. */
1417         yy_load_buffer_state(  );
1418         (yy_did_buffer_switch_on_eof) = 1;
1419 }
1420
1421 /** Removes and deletes the top of the stack, if present.
1422  *  The next element becomes the new top.
1423  *
1424  */
1425 void yyFlexLexer::yypop_buffer_state (void)
1426 {
1427         if (!YY_CURRENT_BUFFER)
1428                 return;
1429
1430         yy_delete_buffer(YY_CURRENT_BUFFER );
1431         YY_CURRENT_BUFFER_LVALUE = NULL;
1432         if ((yy_buffer_stack_top) > 0)
1433                 --(yy_buffer_stack_top);
1434
1435         if (YY_CURRENT_BUFFER) {
1436                 yy_load_buffer_state(  );
1437                 (yy_did_buffer_switch_on_eof) = 1;
1438         }
1439 }
1440
1441 /* Allocates the stack if it does not exist.
1442  *  Guarantees space for at least one push.
1443  */
1444 void yyFlexLexer::yyensure_buffer_stack(void)
1445 {
1446         int num_to_alloc;
1447
1448         if (!(yy_buffer_stack)) {
1449
1450                 /* First allocation is just for 2 elements, since we don't know if this
1451                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1452                  * immediate realloc on the next call.
1453          */
1454                 num_to_alloc = 1;
1455                 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1456                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
1457                                                                 );
1458                 if ( ! (yy_buffer_stack) )
1459                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1460
1461                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1462
1463                 (yy_buffer_stack_max) = num_to_alloc;
1464                 (yy_buffer_stack_top) = 0;
1465                 return;
1466         }
1467
1468         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1469
1470                 /* Increase the buffer to prepare for a possible push. */
1471                 int grow_size = 8 /* arbitrary grow size */;
1472
1473                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1474                 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1475                                                                 ((yy_buffer_stack),
1476                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
1477                                                                 );
1478                 if ( ! (yy_buffer_stack) )
1479                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1480
1481                 /* zero only the new slots.*/
1482                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1483                 (yy_buffer_stack_max) = num_to_alloc;
1484         }
1485 }
1486
1487     void yyFlexLexer::yy_push_state( int new_state )
1488 {
1489         if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1490                 {
1491                 yy_size_t new_size;
1492
1493                 (yy_start_stack_depth) += YY_START_STACK_INCR;
1494                 new_size = (yy_start_stack_depth) * sizeof( int );
1495
1496                 if ( ! (yy_start_stack) )
1497                         (yy_start_stack) = (int *) yyalloc(new_size  );
1498
1499                 else
1500                         (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size  );
1501
1502                 if ( ! (yy_start_stack) )
1503                         YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
1504                 }
1505
1506         (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1507
1508         BEGIN(new_state);
1509 }
1510
1511     void yyFlexLexer::yy_pop_state()
1512 {
1513         if ( --(yy_start_stack_ptr) < 0 )
1514                 YY_FATAL_ERROR( "start-condition stack underflow" );
1515
1516         BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1517 }
1518
1519     int yyFlexLexer::yy_top_state()
1520 {
1521         return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1522 }
1523
1524 #ifndef YY_EXIT_FAILURE
1525 #define YY_EXIT_FAILURE 2
1526 #endif
1527
1528 void yyFlexLexer::LexerError( yyconst char msg[] )
1529 {
1530         std::cerr << msg << std::endl;
1531         exit( YY_EXIT_FAILURE );
1532 }
1533
1534 /* Redefine yyless() so it works in section 3 code. */
1535
1536 #undef yyless
1537 #define yyless(n) \
1538         do \
1539                 { \
1540                 /* Undo effects of setting up yytext. */ \
1541         int yyless_macro_arg = (n); \
1542         YY_LESS_LINENO(yyless_macro_arg);\
1543                 yytext[yyleng] = (yy_hold_char); \
1544                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1545                 (yy_hold_char) = *(yy_c_buf_p); \
1546                 *(yy_c_buf_p) = '\0'; \
1547                 yyleng = yyless_macro_arg; \
1548                 } \
1549         while ( 0 )
1550
1551 /* Accessor  methods (get/set functions) to struct members. */
1552
1553 /*
1554  * Internal utility routines.
1555  */
1556
1557 #ifndef yytext_ptr
1558 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1559 {
1560         register int i;
1561         for ( i = 0; i < n; ++i )
1562                 s1[i] = s2[i];
1563 }
1564 #endif
1565
1566 #ifdef YY_NEED_STRLEN
1567 static int yy_flex_strlen (yyconst char * s )
1568 {
1569         register int n;
1570         for ( n = 0; s[n]; ++n )
1571                 ;
1572
1573         return n;
1574 }
1575 #endif
1576
1577 void *yyalloc (yy_size_t  size )
1578 {
1579         return (void *) malloc( size );
1580 }
1581
1582 void *yyrealloc  (void * ptr, yy_size_t  size )
1583 {
1584         /* The cast to (char *) in the following accommodates both
1585          * implementations that use char* generic pointers, and those
1586          * that use void* generic pointers.  It works with the latter
1587          * because both ANSI C and C++ allow castless assignment from
1588          * any pointer type to void*, and deal with argument conversions
1589          * as though doing an assignment.
1590          */
1591         return (void *) realloc( (char *) ptr, size );
1592 }
1593
1594 void yyfree (void * ptr )
1595 {
1596         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
1597 }
1598
1599 #define YYTABLES_NAME "yytables"
1600
1601 #line 40 "../../../../sdcc/sim/ucsim/cmd.src/cmdlex.l"
1602
1603
1604
1605 #undef lexer_obj
1606
1607 int
1608 yywrap(void)
1609 {
1610   return(1);
1611 }
1612
1613 #include "cmdlexcl.h"
1614 #include "globals.h"
1615
1616 int
1617 cl_ucsim_lexer::LexerInput(char *buf, int max_size)
1618 {
1619   if (!string_to_parse)
1620     return(yyFlexLexer::LexerInput(buf, max_size));
1621   int lrem= strlen(string_ptr);
1622   int n= max_size;
1623   if (lrem < max_size)
1624     n= lrem;
1625   strncpy(buf, string_ptr, n);
1626   string_ptr+= n;
1627   return(n);
1628 }
1629
1630 void
1631 cl_ucsim_lexer::activate_lexer_to_parse_into(void *yylv)
1632 {
1633   yylval= (YY_cl_ucsim_parser_STYPE *)yylv;
1634 }
1635
1636 int
1637 cl_ucsim_lexer::check_id(char *token)
1638 {
1639   class cl_uc *uc= application->get_uc();
1640   //printf("checking id=\"%s\"\n",token);
1641
1642   if (uc)
1643     {
1644       class cl_memory *mem= uc->memory(token);
1645       if (mem)
1646         {
1647           yylval->memory_object= mem;
1648           return(tok(PTOK_MEMORY_OBJECT));
1649         }
1650
1651       t_addr addr;
1652       bool found= uc->symbol2address(yytext, uc->sfr_tbl(), &addr);
1653       if (found)
1654         {
1655           /*yylval->number= addr;
1656             return(tok(PTOK_NUMBER));*/
1657           yylval->memory.memory= uc->address_space(MEM_SFR_ID);
1658           yylval->memory.address= addr;
1659           return(tok(PTOK_MEMORY));
1660         }
1661
1662       found= uc->symbol2address(yytext, uc->bit_tbl(), &addr);
1663       if (found)
1664         {
1665           t_addr memaddr;
1666           t_mem mask;
1667           yylval->bit.memory= uc->bit2mem(addr, &memaddr, &mask);
1668           yylval->bit.mem_address= memaddr;
1669           yylval->bit.bit_address= addr;
1670           yylval->bit.mask= mask;
1671           return(tok(PTOK_BIT));
1672         }
1673     }
1674
1675   return(0);
1676 }
1677