torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LutScanner.cpp
Go to the documentation of this file.
1 #line 2 "LutScanner.cpp"
2 
3 #line 4 "LutScanner.cpp"
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 LutFlexLexer
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
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
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  */
210 
211  /* Number of characters read into yy_ch_buf, not including EOB
212  * characters.
213  */
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  */
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  */
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  */
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  */
242 
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 *Lutalloc (yy_size_t );
278 void *Lutrealloc (void *,yy_size_t );
279 void Lutfree (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 
311 #include <FlexLexer.h>
312 
313 /* Done after the current pattern has been matched and before the
314  * corresponding action - sets up yytext.
315  */
316 #define YY_DO_BEFORE_ACTION \
317  (yytext_ptr) = yy_bp; \
318  yyleng = (size_t) (yy_cp - yy_bp); \
319  (yy_hold_char) = *yy_cp; \
320  *yy_cp = '\0'; \
321  (yy_c_buf_p) = yy_cp;
322 
323 #define YY_NUM_RULES 12
324 #define YY_END_OF_BUFFER 13
325 /* This struct is not used in this scanner,
326  but its presence is necessary. */
328  {
331  };
333  { 0,
334  0, 0, 13, 11, 9, 9, 3, 4, 7, 6,
335  10, 2, 8, 11, 5, 10, 1, 0
336  } ;
337 
339  { 0,
340  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
341  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343  1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
344  5, 6, 7, 1, 1, 1, 1, 8, 8, 9,
345  9, 9, 9, 9, 9, 9, 9, 1, 1, 1,
346  10, 1, 1, 11, 12, 12, 12, 12, 12, 12,
347  12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
348  12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
349  1, 1, 1, 1, 1, 1, 12, 12, 12, 12,
350 
351  12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
352  12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
353  12, 12, 1, 1, 1, 13, 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,
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 
362  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
363  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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
368  } ;
369 
371  { 0,
372  1, 1, 1, 1, 1, 1, 1, 2, 2, 1,
373  1, 1, 1
374  } ;
375 
377  { 0,
378  0, 0, 17, 18, 18, 18, 18, 18, 18, 18,
379  8, 18, 18, 0, 18, 7, 18, 18, 12
380  } ;
381 
383  { 0,
384  18, 1, 18, 18, 18, 18, 18, 18, 18, 18,
385  18, 18, 18, 19, 18, 18, 18, 0, 18
386  } ;
387 
389  { 0,
390  4, 5, 6, 7, 8, 9, 10, 11, 4, 12,
391  13, 14, 15, 17, 16, 16, 18, 3, 18, 18,
392  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
393  18
394  } ;
395 
397  { 0,
398  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399  1, 1, 1, 19, 16, 11, 3, 18, 18, 18,
400  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
401  18
402  } ;
403 
404 /* The intent behind this definition is that it'll catch
405  * any uses of REJECT which flex missed.
406  */
407 #define REJECT reject_used_but_not_detected
408 #define yymore() yymore_used_but_not_detected
409 #define YY_MORE_ADJ 0
410 #define YY_RESTORE_YY_MORE_OFFSET
411 #line 1 "scanner.ll"
412 /*
413 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
414 // $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/bitstream/assembler/lut/scanner.ll $
415 // $Id: scanner.ll 1304 2013-02-26 01:16:38Z nsteiner $
416 
417 // This program is free software: you can redistribute it and/or modify it under the terms of the
418 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
419 // License, or (at your option) any later version.
420 //
421 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
422 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
423 // the GNU General Public License for more details.
424 //
425 // You should have received a copy of the GNU General Public License along with this program. If
426 // not, see <http://www.gnu.org/licenses/>.
427 */
428 #line 20 "scanner.ll"
429 
430 
431 // ------------------------------------------------------------------------------------------------
432 // -------------------------------------- C/C++ declarations --------------------------------------
433 // ------------------------------------------------------------------------------------------------
434 
435 
436 // disable GCC warnings that Bison gives us little control over
437 //#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
438 //#pragma GCC diagnostic ignored "-Werror"
439 //#pragma GCC diagnostic ignored "-Wall"
440 
441 #include <string>
443 
444 namespace torc { namespace bitstream {} }
445 using namespace torc::bitstream;
446 
447 /// \brief Import the parser's token types into a local typedef
450 
451 /// \details By default, yylex() returns int, but we want token_type instead. Unfortunately,
452 /// yyterminate returns 0 by default, which is not of token_type.
453 #define yyterminate() return token::END
454 
455 /// \brief Disable the inclusion of unistd.h, which is not available under Visual C++ on Win32.
456 /// \details The C++ scanner uses STL streams instead.
457 #define YY_NO_UNISTD_H
458 
459 //#define DEBUG(a) printf a
460 #define DEBUG(a)
461 #define DEBUG1(a) printf a
462 
463 
464 /* ---------------------------------------------------------------------------------------------- */
465 /* -------------------------------- Flex declarations and options ------------------------------- */
466 /* ---------------------------------------------------------------------------------------------- */
467 /** \brief Enable C++ generation for the scanner class. **/
468 /** \brief Change the name of the scanner class to "LutFlexLexer". **/
469 /** \brief The manual says batch is "somewhat more optimized". **/
470 /** \brief Enable debug output from the scanner. **/
471 /*%option debug*/
472 /** \brief We anticipate no included LUT files. **/
473 /** \brief Track location information. Each time yylex is invoked, begin is moved to end. **/
474 #line 81 "scanner.ll"
475 #define YY_USER_ACTION yylloc->columns(yyleng);
476 #line 477 "LutScanner.cpp"
477 
478 #define INITIAL 0
479 
480 #ifndef YY_NO_UNISTD_H
481 /* Special case for "unistd.h", since it is non-ANSI. We include it way
482  * down here because we want the user's section 1 to have been scanned first.
483  * The user has a chance to override it with an option.
484  */
485 #include <unistd.h>
486 #endif
487 
488 #ifndef YY_EXTRA_TYPE
489 #define YY_EXTRA_TYPE void *
490 #endif
491 
492 #ifndef yytext_ptr
493 static void yy_flex_strncpy (char *,yyconst char *,int );
494 #endif
495 
496 #ifdef YY_NEED_STRLEN
497 static int yy_flex_strlen (yyconst char * );
498 #endif
499 
500 #ifndef YY_NO_INPUT
501 
502 #endif
503 
504 /* Amount of stuff to slurp up with each read. */
505 #ifndef YY_READ_BUF_SIZE
506 #define YY_READ_BUF_SIZE 8192
507 #endif
508 
509 /* Copy whatever the last rule matched to the standard output. */
510 #ifndef ECHO
511 #define ECHO LexerOutput( yytext, yyleng )
512 #endif
513 
514 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
515  * is returned in "result".
516  */
517 #ifndef YY_INPUT
518 #define YY_INPUT(buf,result,max_size) \
519 \
520  if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
521  YY_FATAL_ERROR( "input in flex scanner failed" );
522 
523 #endif
524 
525 /* No semi-colon after return; correct usage is to write "yyterminate();" -
526  * we don't want an extra ';' after the "return" because that will cause
527  * some compilers to complain about unreachable statements.
528  */
529 #ifndef yyterminate
530 #define yyterminate() return YY_NULL
531 #endif
532 
533 /* Number of entries by which start-condition stack grows. */
534 #ifndef YY_START_STACK_INCR
535 #define YY_START_STACK_INCR 25
536 #endif
537 
538 /* Report a fatal error. */
539 #ifndef YY_FATAL_ERROR
540 #define YY_FATAL_ERROR(msg) LexerError( msg )
541 #endif
542 
543 /* end tables serialization structures and prototypes */
544 
545 /* Default declaration of generated scanner - a define so the user can
546  * easily add parameters.
547  */
548 #ifndef YY_DECL
549 #define YY_DECL_IS_OURS 1
550 #define YY_DECL int yyFlexLexer::yylex()
551 #endif /* !YY_DECL */
552 
553 /* Code executed at the beginning of each rule, after yytext and yyleng
554  * have been set up.
555  */
556 #ifndef YY_USER_ACTION
557 #define YY_USER_ACTION
558 #endif
559 
560 /* Code executed at the end of each rule. */
561 #ifndef YY_BREAK
562 #define YY_BREAK break;
563 #endif
564 
565 #define YY_RULE_SETUP \
566  YY_USER_ACTION
567 
568 /** The main scanner function which does all the work.
569  */
570 YY_DECL
571 {
573  register char *yy_cp, *yy_bp;
574  register int yy_act;
575 
576 #line 84 "scanner.ll"
577 
578 
579 
580  /* ---------------------------------------------------------------------------------------------- */
581  /* --------------------------------- scanner regular expressions -------------------------------- */
582  /* ---------------------------------------------------------------------------------------------- */
583 
584 
585  /** \brief Code belonging at the beginning of yylex(). **/
586 
587  yylloc->step();
588 
589 
590 
591  /* ---------------------------------------------------------------------------------------------- */
592  /* ------------------------------------ Begin XDL lexer rules ----------------------------------- */
593  /* ---------------------------------------------------------------------------------------------- */
594 
595 
596 #line 597 "LutScanner.cpp"
597 
598  if ( !(yy_init) )
599  {
600  (yy_init) = 1;
601 
602 #ifdef YY_USER_INIT
603  YY_USER_INIT;
604 #endif
605 
606  if ( ! (yy_start) )
607  (yy_start) = 1; /* first start state */
608 
609  if ( ! yyin )
610  yyin = & std::cin;
611 
612  if ( ! yyout )
613  yyout = & std::cout;
614 
615  if ( ! YY_CURRENT_BUFFER ) {
616  yyensure_buffer_stack ();
618  yy_create_buffer( yyin, YY_BUF_SIZE );
619  }
620 
621  yy_load_buffer_state( );
622  }
623 
624  while ( 1 ) /* loops until end-of-file is reached */
625  {
626  yy_cp = (yy_c_buf_p);
627 
628  /* Support of yytext. */
629  *yy_cp = (yy_hold_char);
630 
631  /* yy_bp points to the position in yy_ch_buf of the start of
632  * the current run.
633  */
634  yy_bp = yy_cp;
635 
636  yy_current_state = (yy_start);
637 yy_match:
638  do
639  {
640  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
641  if ( yy_accept[yy_current_state] )
642  {
643  (yy_last_accepting_state) = yy_current_state;
644  (yy_last_accepting_cpos) = yy_cp;
645  }
646  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
647  {
648  yy_current_state = (int) yy_def[yy_current_state];
649  if ( yy_current_state >= 19 )
650  yy_c = yy_meta[(unsigned int) yy_c];
651  }
652  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
653  ++yy_cp;
654  }
655  while ( yy_current_state != 18 );
656  yy_cp = (yy_last_accepting_cpos);
657  yy_current_state = (yy_last_accepting_state);
658 
659 yy_find_action:
660  yy_act = yy_accept[yy_current_state];
661 
663 
664 do_action: /* This label is used only to access EOF actions. */
665 
666  switch ( yy_act )
667  { /* beginning of action switch */
668  case 0: /* must back up */
669  /* undo the effects of YY_DO_BEFORE_ACTION */
670  *yy_cp = (yy_hold_char);
671  yy_cp = (yy_last_accepting_cpos);
672  yy_current_state = (yy_last_accepting_state);
673  goto yy_find_action;
674 
675 case 1:
677 #line 103 "scanner.ll"
678 { *yylval = yytext; return token::VAR; }
679  YY_BREAK
680 case 2:
682 #line 104 "scanner.ll"
683 { }
684  YY_BREAK
685 case 3:
687 #line 105 "scanner.ll"
688 { return token::LP; }
689  YY_BREAK
690 case 4:
692 #line 106 "scanner.ll"
693 { return token::RP; }
694  YY_BREAK
695 case 5:
697 #line 107 "scanner.ll"
698 { *yylval = "NOT"; return token::NOT; }
699  YY_BREAK
700 case 6:
702 #line 108 "scanner.ll"
703 { *yylval = "OR"; return token::OR;}
704  YY_BREAK
705 case 7:
707 #line 109 "scanner.ll"
708 { *yylval = "AND"; return token::AND;}
709  YY_BREAK
710 case 8:
712 #line 110 "scanner.ll"
713 { *yylval = "XOR"; return token::XOR;}
714  YY_BREAK
715 case 9:
716 /* rule 9 can match eol */
718 #line 111 "scanner.ll"
719 { }
720  YY_BREAK
721 case 10:
723 #line 112 "scanner.ll"
724 { *yylval = yytext; return token::VAR; }
725  YY_BREAK
726 case 11:
728 #line 113 "scanner.ll"
729 { std::cout << "Flex Unrecognised token!" << std::endl; exit (-1); }
730  YY_BREAK
731 /* ---------------------------------------------------------------------------------------------- */
732 /* ------------------------------------- End XDL lexer rules ------------------------------------ */
733 /* ---------------------------------------------------------------------------------------------- */
734 case 12:
736 #line 121 "scanner.ll"
737 ECHO;
738  YY_BREAK
739 #line 740 "LutScanner.cpp"
740 case YY_STATE_EOF(INITIAL):
741  yyterminate();
742 
743  case YY_END_OF_BUFFER:
744  {
745  /* Amount of text matched not including the EOB char. */
746  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
747 
748  /* Undo the effects of YY_DO_BEFORE_ACTION. */
749  *yy_cp = (yy_hold_char);
751 
752  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
753  {
754  /* We're scanning a new file or input source. It's
755  * possible that this happened because the user
756  * just pointed yyin at a new source and called
757  * yylex(). If so, then we have to assure
758  * consistency between YY_CURRENT_BUFFER and our
759  * globals. Here is the right place to do so, because
760  * this is the first action (other than possibly a
761  * back-up) that will match for the new input source.
762  */
763  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
764  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
765  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
766  }
767 
768  /* Note that here we test for yy_c_buf_p "<=" to the position
769  * of the first EOB in the buffer, since yy_c_buf_p will
770  * already have been incremented past the NUL character
771  * (since all states make transitions on EOB to the
772  * end-of-buffer state). Contrast this with the test
773  * in input().
774  */
775  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
776  { /* This was really a NUL. */
777  yy_state_type yy_next_state;
778 
779  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
780 
781  yy_current_state = yy_get_previous_state( );
782 
783  /* Okay, we're now positioned to make the NUL
784  * transition. We couldn't have
785  * yy_get_previous_state() go ahead and do it
786  * for us because it doesn't know how to deal
787  * with the possibility of jamming (and we don't
788  * want to build jamming into it because then it
789  * will run more slowly).
790  */
791 
792  yy_next_state = yy_try_NUL_trans( yy_current_state );
793 
794  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
795 
796  if ( yy_next_state )
797  {
798  /* Consume the NUL. */
799  yy_cp = ++(yy_c_buf_p);
800  yy_current_state = yy_next_state;
801  goto yy_match;
802  }
803 
804  else
805  {
806  yy_cp = (yy_last_accepting_cpos);
807  yy_current_state = (yy_last_accepting_state);
808  goto yy_find_action;
809  }
810  }
811 
812  else switch ( yy_get_next_buffer( ) )
813  {
814  case EOB_ACT_END_OF_FILE:
815  {
816  (yy_did_buffer_switch_on_eof) = 0;
817 
818  if ( yywrap( ) )
819  {
820  /* Note: because we've taken care in
821  * yy_get_next_buffer() to have set up
822  * yytext, we can now set up
823  * yy_c_buf_p so that if some total
824  * hoser (like flex itself) wants to
825  * call the scanner after we return the
826  * YY_NULL, it'll still work - another
827  * YY_NULL will get returned.
828  */
829  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
830 
831  yy_act = YY_STATE_EOF(YY_START);
832  goto do_action;
833  }
834 
835  else
836  {
837  if ( ! (yy_did_buffer_switch_on_eof) )
838  YY_NEW_FILE;
839  }
840  break;
841  }
842 
844  (yy_c_buf_p) =
845  (yytext_ptr) + yy_amount_of_matched_text;
846 
847  yy_current_state = yy_get_previous_state( );
848 
849  yy_cp = (yy_c_buf_p);
850  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
851  goto yy_match;
852 
853  case EOB_ACT_LAST_MATCH:
854  (yy_c_buf_p) =
855  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
856 
857  yy_current_state = yy_get_previous_state( );
858 
859  yy_cp = (yy_c_buf_p);
860  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
861  goto yy_find_action;
862  }
863  break;
864  }
865 
866  default:
868  "fatal flex scanner internal error--no action found" );
869  } /* end of action switch */
870  } /* end of scanning one token */
871 } /* end of yylex */
872 
873 /* The contents of this function are C++ specific, so the () macro is not used.
874  */
875 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
876 {
877  yyin = arg_yyin;
878  yyout = arg_yyout;
879  yy_c_buf_p = 0;
880  yy_init = 0;
881  yy_start = 0;
882  yy_flex_debug = 0;
883  yylineno = 1; // this will only get updated if %option yylineno
884 
885  yy_did_buffer_switch_on_eof = 0;
886 
887  yy_looking_for_trail_begin = 0;
888  yy_more_flag = 0;
889  yy_more_len = 0;
890  yy_more_offset = yy_prev_more_offset = 0;
891 
892  yy_start_stack_ptr = yy_start_stack_depth = 0;
893  yy_start_stack = NULL;
894 
895  yy_buffer_stack = 0;
896  yy_buffer_stack_top = 0;
897  yy_buffer_stack_max = 0;
898 
899  yy_state_buf = 0;
900 
901 }
902 
903 /* The contents of this function are C++ specific, so the () macro is not used.
904  */
906 {
907  delete [] yy_state_buf;
908  Lutfree(yy_start_stack );
909  yy_delete_buffer( YY_CURRENT_BUFFER );
910  Lutfree(yy_buffer_stack );
911 }
912 
913 /* The contents of this function are C++ specific, so the () macro is not used.
914  */
915 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
916 {
917  if ( new_in )
918  {
919  yy_delete_buffer( YY_CURRENT_BUFFER );
920  yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
921  }
922 
923  if ( new_out )
924  yyout = new_out;
925 }
926 
927 #ifdef YY_INTERACTIVE
928 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
929 #else
930 int yyFlexLexer::LexerInput( char* buf, int max_size )
931 #endif
932 {
933  if ( yyin->eof() || yyin->fail() )
934  return 0;
935 
936 #ifdef YY_INTERACTIVE
937  yyin->get( buf[0] );
938 
939  if ( yyin->eof() )
940  return 0;
941 
942  if ( yyin->bad() )
943  return -1;
944 
945  return 1;
946 
947 #else
948  (void) yyin->read( buf, max_size );
949 
950  if ( yyin->bad() )
951  return -1;
952  else
953  return yyin->gcount();
954 #endif
955 }
956 
957 void yyFlexLexer::LexerOutput( const char* buf, int size )
958 {
959  (void) yyout->write( buf, size );
960 }
961 
962 /* yy_get_next_buffer - try to read in a new buffer
963  *
964  * Returns a code representing an action:
965  * EOB_ACT_LAST_MATCH -
966  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
967  * EOB_ACT_END_OF_FILE - end of file
968  */
970 {
971  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
972  register char *source = (yytext_ptr);
973  register int number_to_move, i;
974  int ret_val;
975 
976  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
978  "fatal flex scanner internal error--end of buffer missed" );
979 
980  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
981  { /* Don't try to fill the buffer, so this is an EOF. */
982  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
983  {
984  /* We matched a single character, the EOB, so
985  * treat this as a final EOF.
986  */
987  return EOB_ACT_END_OF_FILE;
988  }
989 
990  else
991  {
992  /* We matched some text prior to the EOB, first
993  * process it.
994  */
995  return EOB_ACT_LAST_MATCH;
996  }
997  }
998 
999  /* Try to read more data. */
1000 
1001  /* First move last chars to start of buffer. */
1002  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1003 
1004  for ( i = 0; i < number_to_move; ++i )
1005  *(dest++) = *(source++);
1006 
1007  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1008  /* don't do the read, it's not guaranteed to return an EOF,
1009  * just force an EOF
1010  */
1011  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1012 
1013  else
1014  {
1015  int num_to_read =
1016  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1017 
1018  while ( num_to_read <= 0 )
1019  { /* Not enough room in the buffer - grow it. */
1020 
1021  /* just a shorter name for the current buffer */
1022  YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1023 
1024  int yy_c_buf_p_offset =
1025  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1026 
1027  if ( b->yy_is_our_buffer )
1028  {
1029  int new_size = b->yy_buf_size * 2;
1030 
1031  if ( new_size <= 0 )
1032  b->yy_buf_size += b->yy_buf_size / 8;
1033  else
1034  b->yy_buf_size *= 2;
1035 
1036  b->yy_ch_buf = (char *)
1037  /* Include room in for 2 EOB chars. */
1038  Lutrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1039  }
1040  else
1041  /* Can't grow it, we don't own it. */
1042  b->yy_ch_buf = 0;
1043 
1044  if ( ! b->yy_ch_buf )
1046  "fatal error - scanner input buffer overflow" );
1047 
1048  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1049 
1050  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1051  number_to_move - 1;
1052 
1053  }
1054 
1055  if ( num_to_read > YY_READ_BUF_SIZE )
1056  num_to_read = YY_READ_BUF_SIZE;
1057 
1058  /* Read in more data. */
1059  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1060  (yy_n_chars), (size_t) num_to_read );
1061 
1062  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1063  }
1064 
1065  if ( (yy_n_chars) == 0 )
1066  {
1067  if ( number_to_move == YY_MORE_ADJ )
1068  {
1069  ret_val = EOB_ACT_END_OF_FILE;
1070  yyrestart( yyin );
1071  }
1072 
1073  else
1074  {
1075  ret_val = EOB_ACT_LAST_MATCH;
1076  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1078  }
1079  }
1080 
1081  else
1082  ret_val = EOB_ACT_CONTINUE_SCAN;
1083 
1084  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1085  /* Extend the array by 50%, plus the number we really need. */
1086  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1087  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Lutrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1088  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1089  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1090  }
1091 
1092  (yy_n_chars) += number_to_move;
1093  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1094  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1095 
1096  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1097 
1098  return ret_val;
1099 }
1100 
1101 /* yy_get_previous_state - get the state just before the EOB char was reached */
1102 
1104 {
1106  register char *yy_cp;
1107 
1108  yy_current_state = (yy_start);
1109 
1110  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1111  {
1112  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1113  if ( yy_accept[yy_current_state] )
1114  {
1115  (yy_last_accepting_state) = yy_current_state;
1116  (yy_last_accepting_cpos) = yy_cp;
1117  }
1118  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1119  {
1120  yy_current_state = (int) yy_def[yy_current_state];
1121  if ( yy_current_state >= 19 )
1122  yy_c = yy_meta[(unsigned int) yy_c];
1123  }
1124  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1125  }
1126 
1127  return yy_current_state;
1128 }
1129 
1130 /* yy_try_NUL_trans - try to make a transition on the NUL character
1131  *
1132  * synopsis
1133  * next_state = yy_try_NUL_trans( current_state );
1134  */
1136 {
1137  register int yy_is_jam;
1138  register char *yy_cp = (yy_c_buf_p);
1139 
1140  register YY_CHAR yy_c = 1;
1141  if ( yy_accept[yy_current_state] )
1142  {
1143  (yy_last_accepting_state) = yy_current_state;
1144  (yy_last_accepting_cpos) = yy_cp;
1145  }
1146  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1147  {
1148  yy_current_state = (int) yy_def[yy_current_state];
1149  if ( yy_current_state >= 19 )
1150  yy_c = yy_meta[(unsigned int) yy_c];
1151  }
1152  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1153  yy_is_jam = (yy_current_state == 18);
1154 
1155  return yy_is_jam ? 0 : yy_current_state;
1156 }
1157 
1158  void yyFlexLexer::yyunput( int c, register char* yy_bp)
1159 {
1160  register char *yy_cp;
1161 
1162  yy_cp = (yy_c_buf_p);
1163 
1164  /* undo effects of setting up yytext */
1165  *yy_cp = (yy_hold_char);
1166 
1167  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1168  { /* need to shift things up to make room */
1169  /* +2 for EOB chars. */
1170  register int number_to_move = (yy_n_chars) + 2;
1171  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1172  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1173  register char *source =
1174  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1175 
1176  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1177  *--dest = *--source;
1178 
1179  yy_cp += (int) (dest - source);
1180  yy_bp += (int) (dest - source);
1181  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1182  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1183 
1184  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1185  YY_FATAL_ERROR( "flex scanner push-back overflow" );
1186  }
1187 
1188  *--yy_cp = (char) c;
1189 
1190  (yytext_ptr) = yy_bp;
1191  (yy_hold_char) = *yy_cp;
1192  (yy_c_buf_p) = yy_cp;
1193 }
1194 
1196 {
1197  int c;
1198 
1199  *(yy_c_buf_p) = (yy_hold_char);
1200 
1201  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1202  {
1203  /* yy_c_buf_p now points to the character we want to return.
1204  * If this occurs *before* the EOB characters, then it's a
1205  * valid NUL; if not, then we've hit the end of the buffer.
1206  */
1207  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1208  /* This was really a NUL. */
1209  *(yy_c_buf_p) = '\0';
1210 
1211  else
1212  { /* need more input */
1213  int offset = (yy_c_buf_p) - (yytext_ptr);
1214  ++(yy_c_buf_p);
1215 
1216  switch ( yy_get_next_buffer( ) )
1217  {
1218  case EOB_ACT_LAST_MATCH:
1219  /* This happens because yy_g_n_b()
1220  * sees that we've accumulated a
1221  * token and flags that we need to
1222  * try matching the token before
1223  * proceeding. But for input(),
1224  * there's no matching to consider.
1225  * So convert the EOB_ACT_LAST_MATCH
1226  * to EOB_ACT_END_OF_FILE.
1227  */
1228 
1229  /* Reset buffer status. */
1230  yyrestart( yyin );
1231 
1232  /*FALLTHROUGH*/
1233 
1234  case EOB_ACT_END_OF_FILE:
1235  {
1236  if ( yywrap( ) )
1237  return EOF;
1238 
1239  if ( ! (yy_did_buffer_switch_on_eof) )
1240  YY_NEW_FILE;
1241 #ifdef __cplusplus
1242  return yyinput();
1243 #else
1244  return input();
1245 #endif
1246  }
1247 
1248  case EOB_ACT_CONTINUE_SCAN:
1249  (yy_c_buf_p) = (yytext_ptr) + offset;
1250  break;
1251  }
1252  }
1253  }
1254 
1255  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1256  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1257  (yy_hold_char) = *++(yy_c_buf_p);
1258 
1259  return c;
1260 }
1261 
1262 /** Immediately switch to a different input stream.
1263  * @param input_file A readable stream.
1264  *
1265  * @note This function does not reset the start condition to @c INITIAL .
1266  */
1267  void yyFlexLexer::yyrestart( std::istream* input_file )
1268 {
1269 
1270  if ( ! YY_CURRENT_BUFFER ){
1271  yyensure_buffer_stack ();
1273  yy_create_buffer( yyin, YY_BUF_SIZE );
1274  }
1275 
1276  yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1277  yy_load_buffer_state( );
1278 }
1279 
1280 /** Switch to a different input buffer.
1281  * @param new_buffer The new input buffer.
1282  *
1283  */
1284  void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1285 {
1286 
1287  /* TODO. We should be able to replace this entire function body
1288  * with
1289  * yypop_buffer_state();
1290  * yypush_buffer_state(new_buffer);
1291  */
1292  yyensure_buffer_stack ();
1293  if ( YY_CURRENT_BUFFER == new_buffer )
1294  return;
1295 
1296  if ( YY_CURRENT_BUFFER )
1297  {
1298  /* Flush out information for old buffer. */
1299  *(yy_c_buf_p) = (yy_hold_char);
1300  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1301  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1302  }
1303 
1304  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1305  yy_load_buffer_state( );
1306 
1307  /* We don't actually know whether we did this switch during
1308  * EOF (yywrap()) processing, but the only time this flag
1309  * is looked at is after yywrap() is called, so it's safe
1310  * to go ahead and always set it.
1311  */
1312  (yy_did_buffer_switch_on_eof) = 1;
1313 }
1314 
1316 {
1317  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1318  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1319  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1320  (yy_hold_char) = *(yy_c_buf_p);
1321 }
1322 
1323 /** Allocate and initialize an input buffer state.
1324  * @param file A readable stream.
1325  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1326  *
1327  * @return the allocated buffer state.
1328  */
1329  YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1330 {
1331  YY_BUFFER_STATE b;
1332 
1333  b = (YY_BUFFER_STATE) Lutalloc(sizeof( struct yy_buffer_state ) );
1334  if ( ! b )
1335  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1336 
1337  b->yy_buf_size = size;
1338 
1339  /* yy_ch_buf has to be 2 characters longer than the size given because
1340  * we need to put in 2 end-of-buffer characters.
1341  */
1342  b->yy_ch_buf = (char *) Lutalloc(b->yy_buf_size + 2 );
1343  if ( ! b->yy_ch_buf )
1344  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1345 
1346  b->yy_is_our_buffer = 1;
1347 
1348  yy_init_buffer( b, file );
1349 
1350  return b;
1351 }
1352 
1353 /** Destroy the buffer.
1354  * @param b a buffer created with yy_create_buffer()
1355  *
1356  */
1357  void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1358 {
1359 
1360  if ( ! b )
1361  return;
1362 
1363  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1365 
1366  if ( b->yy_is_our_buffer )
1367  Lutfree((void *) b->yy_ch_buf );
1368 
1369  Lutfree((void *) b );
1370 }
1371 
1372 extern "C" int isatty (int );
1373 
1374 /* Initializes or reinitializes a buffer.
1375  * This function is sometimes called more than once on the same buffer,
1376  * such as during a yyrestart() or at EOF.
1377  */
1378  void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1379 
1380 {
1381  int oerrno = errno;
1382 
1383  yy_flush_buffer( b );
1384 
1385  b->yy_input_file = file;
1386  b->yy_fill_buffer = 1;
1387 
1388  /* If b is the current buffer, then yy_init_buffer was _probably_
1389  * called from yyrestart() or through yy_get_next_buffer.
1390  * In that case, we don't want to reset the lineno or column.
1391  */
1392  if (b != YY_CURRENT_BUFFER){
1393  b->yy_bs_lineno = 1;
1394  b->yy_bs_column = 0;
1395  }
1396 
1397  b->yy_is_interactive = 0;
1398  errno = oerrno;
1399 }
1400 
1401 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1402  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1403  *
1404  */
1405  void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1406 {
1407  if ( ! b )
1408  return;
1409 
1410  b->yy_n_chars = 0;
1411 
1412  /* We always need two end-of-buffer characters. The first causes
1413  * a transition to the end-of-buffer state. The second causes
1414  * a jam in that state.
1415  */
1418 
1419  b->yy_buf_pos = &b->yy_ch_buf[0];
1420 
1421  b->yy_at_bol = 1;
1423 
1424  if ( b == YY_CURRENT_BUFFER )
1425  yy_load_buffer_state( );
1426 }
1427 
1428 /** Pushes the new state onto the stack. The new state becomes
1429  * the current state. This function will allocate the stack
1430  * if necessary.
1431  * @param new_buffer The new state.
1432  *
1433  */
1434 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1435 {
1436  if (new_buffer == NULL)
1437  return;
1438 
1439  yyensure_buffer_stack();
1440 
1441  /* This block is copied from yy_switch_to_buffer. */
1442  if ( YY_CURRENT_BUFFER )
1443  {
1444  /* Flush out information for old buffer. */
1445  *(yy_c_buf_p) = (yy_hold_char);
1446  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1447  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1448  }
1449 
1450  /* Only push if top exists. Otherwise, replace top. */
1451  if (YY_CURRENT_BUFFER)
1452  (yy_buffer_stack_top)++;
1453  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1454 
1455  /* copied from yy_switch_to_buffer. */
1456  yy_load_buffer_state( );
1457  (yy_did_buffer_switch_on_eof) = 1;
1458 }
1459 
1460 /** Removes and deletes the top of the stack, if present.
1461  * The next element becomes the new top.
1462  *
1463  */
1465 {
1466  if (!YY_CURRENT_BUFFER)
1467  return;
1468 
1469  yy_delete_buffer(YY_CURRENT_BUFFER );
1470  YY_CURRENT_BUFFER_LVALUE = NULL;
1471  if ((yy_buffer_stack_top) > 0)
1472  --(yy_buffer_stack_top);
1473 
1474  if (YY_CURRENT_BUFFER) {
1475  yy_load_buffer_state( );
1476  (yy_did_buffer_switch_on_eof) = 1;
1477  }
1478 }
1479 
1480 /* Allocates the stack if it does not exist.
1481  * Guarantees space for at least one push.
1482  */
1484 {
1485  int num_to_alloc;
1486 
1487  if (!(yy_buffer_stack)) {
1488 
1489  /* First allocation is just for 2 elements, since we don't know if this
1490  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1491  * immediate realloc on the next call.
1492  */
1493  num_to_alloc = 1;
1494  (yy_buffer_stack) = (struct yy_buffer_state**)Lutalloc
1495  (num_to_alloc * sizeof(struct yy_buffer_state*)
1496  );
1497  if ( ! (yy_buffer_stack) )
1498  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1499 
1500  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1501 
1502  (yy_buffer_stack_max) = num_to_alloc;
1503  (yy_buffer_stack_top) = 0;
1504  return;
1505  }
1506 
1507  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1508 
1509  /* Increase the buffer to prepare for a possible push. */
1510  int grow_size = 8 /* arbitrary grow size */;
1511 
1512  num_to_alloc = (yy_buffer_stack_max) + grow_size;
1513  (yy_buffer_stack) = (struct yy_buffer_state**)Lutrealloc
1514  ((yy_buffer_stack),
1515  num_to_alloc * sizeof(struct yy_buffer_state*)
1516  );
1517  if ( ! (yy_buffer_stack) )
1518  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1519 
1520  /* zero only the new slots.*/
1521  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1522  (yy_buffer_stack_max) = num_to_alloc;
1523  }
1524 }
1525 
1526  void yyFlexLexer::yy_push_state( int new_state )
1527 {
1528  if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1529  {
1530  yy_size_t new_size;
1531 
1532  (yy_start_stack_depth) += YY_START_STACK_INCR;
1533  new_size = (yy_start_stack_depth) * sizeof( int );
1534 
1535  if ( ! (yy_start_stack) )
1536  (yy_start_stack) = (int *) Lutalloc(new_size );
1537 
1538  else
1539  (yy_start_stack) = (int *) Lutrealloc((void *) (yy_start_stack),new_size );
1540 
1541  if ( ! (yy_start_stack) )
1542  YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
1543  }
1544 
1545  (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1546 
1547  BEGIN(new_state);
1548 }
1549 
1551 {
1552  if ( --(yy_start_stack_ptr) < 0 )
1553  YY_FATAL_ERROR( "start-condition stack underflow" );
1554 
1555  BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1556 }
1557 
1559 {
1560  return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1561 }
1562 
1563 #ifndef YY_EXIT_FAILURE
1564 #define YY_EXIT_FAILURE 2
1565 #endif
1566 
1567 void yyFlexLexer::LexerError( yyconst char msg[] )
1568 {
1569  std::cerr << msg << std::endl;
1570  exit( YY_EXIT_FAILURE );
1571 }
1572 
1573 /* Redefine yyless() so it works in section 3 code. */
1574 
1575 #undef yyless
1576 #define yyless(n) \
1577  do \
1578  { \
1579  /* Undo effects of setting up yytext. */ \
1580  int yyless_macro_arg = (n); \
1581  YY_LESS_LINENO(yyless_macro_arg);\
1582  yytext[yyleng] = (yy_hold_char); \
1583  (yy_c_buf_p) = yytext + yyless_macro_arg; \
1584  (yy_hold_char) = *(yy_c_buf_p); \
1585  *(yy_c_buf_p) = '\0'; \
1586  yyleng = yyless_macro_arg; \
1587  } \
1588  while ( 0 )
1589 
1590 /* Accessor methods (get/set functions) to struct members. */
1591 
1592 /*
1593  * Internal utility routines.
1594  */
1595 
1596 #ifndef yytext_ptr
1597 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1598 {
1599  register int i;
1600  for ( i = 0; i < n; ++i )
1601  s1[i] = s2[i];
1602 }
1603 #endif
1604 
1605 #ifdef YY_NEED_STRLEN
1606 static int yy_flex_strlen (yyconst char * s )
1607 {
1608  register int n;
1609  for ( n = 0; s[n]; ++n )
1610  ;
1611 
1612  return n;
1613 }
1614 #endif
1615 
1616 void *Lutalloc (yy_size_t size )
1617 {
1618  return (void *) malloc( size );
1619 }
1620 
1621 void *Lutrealloc (void * ptr, yy_size_t size )
1622 {
1623  /* The cast to (char *) in the following accommodates both
1624  * implementations that use char* generic pointers, and those
1625  * that use void* generic pointers. It works with the latter
1626  * because both ANSI C and C++ allow castless assignment from
1627  * any pointer type to void*, and deal with argument conversions
1628  * as though doing an assignment.
1629  */
1630  return (void *) realloc( (char *) ptr, size );
1631 }
1632 
1633 void Lutfree (void * ptr )
1634 {
1635  free( (char *) ptr ); /* see Lutrealloc() for (char *) cast */
1636 }
1637 
1638 #define YYTABLES_NAME "yytables"
1639 
1640 #line 121 "scanner.ll"
1641 
1642 
1643 
1644 
1645 // ------------------------------------------------------------------------------------------------
1646 // ---------------------------------------- Additional code ---------------------------------------
1647 // ------------------------------------------------------------------------------------------------
1648 
1649 
1650 namespace torc {
1651 
1652  LutScanner::LutScanner(std::istream* in, std::ostream* out) : LutFlexLexer(in, out) {}
1653 
1655 
1656  void LutScanner::set_debug(bool b) {
1657  yy_flex_debug = b;
1658  }
1659 
1660 } // namespace torc
1661 
1662 
1663 /// \details This implementation of LutFlexLexer::yylex() is necessary to fill the vtable of class
1664 /// LutFlexLexer. We define the scanner's main yylex() function via YY_DECL to reside in class
1665 /// LutScanner instead.
1666 #ifdef yylex
1667 #undef yylex
1668 #endif
1669 
1670 int LutFlexLexer::yylex() {
1671  std::cerr << "in LutFlexLexer::yylex() !" << std::endl;
1672  return 0;
1673 }
1674 
1675 /// \details When the scanner receives an End-Of-File result from YY_INPUT, it checks yywrap() for
1676 /// permission to proceed. If yywrap() returns false (zero), we assume that the function has
1677 /// set up yyin to point to the next input file, and the scanning continues. If yywrap()
1678 /// instead returns true (non-zero), the scanner terminates and returns 0 to the caller.
1679 int LutFlexLexer::yywrap() {
1680  return 1;
1681 }
1682 
1683 //namespace {
1684 // /// \brief Suppress GCC warnings about unused boost global variables.
1685 // void suppress_boost_gcc_warnings(void);
1686 // void suppress_boost_gcc_warnings(void) {
1687 // (void) boost::system::system_category;
1688 // (void) boost::system::generic_category;
1689 // (void) boost::system::posix_category;
1690 // (void) boost::system::errno_ecat;
1691 // (void) boost::system::native_ecat;
1692 // }
1693 //}
1694 
void yy_switch_to_buffer(struct yy_buffer_state *new_buffer)
void yypush_buffer_state(struct yy_buffer_state *new_buffer)
unsigned char flex_uint8_t
Bison lexer internals.
Definition: LutScanner.cpp:58
char * yy_buf_pos
Bison lexer internals.
Definition: LutScanner.cpp:204
#define YY_CURRENT_BUFFER_LVALUE
Definition: LutScanner.cpp:275
#define yylex
Definition: LutParser.cpp:36
int yy_n_chars
Bison lexer internals.
Definition: LutScanner.cpp:214
unsigned int flex_uint32_t
Bison lexer internals.
Definition: LutScanner.cpp:60
#define YY_START_STACK_INCR
Definition: LutScanner.cpp:535
static yyconst flex_int16_t yy_accept[19]
Definition: LutScanner.cpp:332
static yyconst flex_int16_t yy_nxt[32]
Definition: LutScanner.cpp:388
#define YY_END_OF_BUFFER_CHAR
Definition: LutScanner.cpp:151
void yy_push_state(int new_state)
void * Lutrealloc(void *, yy_size_t)
yy_state_type yy_try_NUL_trans(yy_state_type current_state)
int yy_fill_buffer
Bison lexer internals.
Definition: LutScanner.cpp:241
struct yy_buffer_state * YY_BUFFER_STATE
Bison lexer internals.
Definition: LutScanner.cpp:164
size_t yy_size_t
Bison lexer internals.
Definition: LutScanner.cpp:193
#define ECHO
Definition: LutScanner.cpp:511
void yy_flush_buffer(struct yy_buffer_state *b)
#define YY_INPUT(buf, result, max_size)
Definition: LutScanner.cpp:518
int yy_bs_lineno
Bison lexer internals.
Definition: LutScanner.cpp:235
#define EOB_ACT_CONTINUE_SCAN
Definition: LutScanner.cpp:169
void Lutfree(void *)
#define YY_FATAL_ERROR(msg)
Definition: LutScanner.cpp:540
#define YY_NEW_FILE
Definition: LutScanner.cpp:149
struct yy_buffer_state * yy_create_buffer(FLEX_STD istream *s, int size)
yy_size_t yy_buf_size
Bison lexer internals.
Definition: LutScanner.cpp:209
#define yyterminate()
Definition: LutScanner.cpp:453
#define BEGIN
Definition: LutScanner.cpp:136
#define yytext_ptr
Definition: LutScanner.cpp:309
Header for the LutScanner class.
void yyunput(int c, char *buf_ptr)
void yypop_buffer_state()
virtual void LexerError(const char *msg)
#define YY_RULE_SETUP
Definition: LutScanner.cpp:565
signed char flex_int8_t
Bison lexer internals.
Definition: LutScanner.cpp:55
int yy_at_bol
Bison lexer internals.
Definition: LutScanner.cpp:233
#define YY_EXIT_FAILURE
void yy_load_buffer_state()
yyFlexLexer(FLEX_STD istream *arg_yyin=0, FLEX_STD ostream *arg_yyout=0)
LutScanner(std::istream *arg_yyin=0, std::ostream *arg_yyout=0)
Public constructor.
int yy_bs_column
Bison lexer internals.
Definition: LutScanner.cpp:236
#define YY_SC_TO_UI(c)
Definition: LutScanner.cpp:130
#define EOB_ACT_LAST_MATCH
Definition: LutScanner.cpp:171
short int flex_int16_t
Bison lexer internals.
Definition: LutScanner.cpp:56
#define YY_CURRENT_BUFFER
Definition: LutScanner.cpp:268
virtual int LexerInput(char *buf, int max_size)
Definition: LutScanner.cpp:930
#define yyconst
Definition: LutScanner.cpp:119
#define YY_BUF_SIZE
Definition: LutScanner.cpp:155
void * Lutalloc(yy_size_t)
register int yy_act
Definition: LutScanner.cpp:574
std::istream * yy_input_file
Bison lexer internals.
Definition: LutScanner.cpp:201
char * yy_ch_buf
Bison lexer internals.
Definition: LutScanner.cpp:203
virtual ~LutScanner()
Virtual destructor.
if(!(yy_init))
Definition: LutScanner.cpp:598
static yyconst flex_int16_t yy_base[20]
Definition: LutScanner.cpp:376
virtual void LexerOutput(const char *buf, int size)
Definition: LutScanner.cpp:957
Bison parser internals.
Definition: LutScanner.cpp:198
int yy_get_next_buffer()
Definition: LutScanner.cpp:969
#define YY_START
Definition: LutScanner.cpp:142
int yy_is_our_buffer
Bison lexer internals.
Definition: LutScanner.cpp:220
#define YY_STATE_EOF(state)
Definition: LutScanner.cpp:146
void yyensure_buffer_stack(void)
#define YY_BUFFER_NORMAL
Definition: LutScanner.cpp:246
int yyleng
Bison lexer internals.
#define YY_DECL
Definition: LutScanner.cpp:550
#define YY_DO_BEFORE_ACTION
Definition: LutScanner.cpp:316
static yyconst flex_int16_t yy_chk[32]
Definition: LutScanner.cpp:396
YY_DECL register yy_state_type yy_current_state
Definition: LutScanner.cpp:572
#define YY_READ_BUF_SIZE
Definition: LutScanner.cpp:506
static yyconst flex_int16_t yy_def[20]
Definition: LutScanner.cpp:382
#define EOB_ACT_END_OF_FILE
Definition: LutScanner.cpp:170
void yyrestart(FLEX_STD istream *s)
flex_int32_t yy_verify
Bison lexer internals.
Definition: LutScanner.cpp:329
void yy_delete_buffer(struct yy_buffer_state *b)
#define YY_END_OF_BUFFER
Definition: LutScanner.cpp:324
int yy_top_state()
virtual void switch_streams(FLEX_STD istream *new_in, FLEX_STD ostream *new_out)
#define YY_BUFFER_EOF_PENDING
Definition: LutScanner.cpp:257
unsigned short int flex_uint16_t
Bison lexer internals.
Definition: LutScanner.cpp:59
flex_int32_t yy_nxt
Bison lexer internals.
Definition: LutScanner.cpp:330
void set_debug(bool b)
Enables or disables debugging output.
void yy_pop_state()
void yy_init_buffer(struct yy_buffer_state *b, FLEX_STD istream *s)
int yy_is_interactive
Bison lexer internals.
Definition: LutScanner.cpp:227
static yyconst flex_int32_t yy_ec[256]
Definition: LutScanner.cpp:338
torc::LutParser::token_type token_type
Bison lexer internals.
Definition: LutScanner.cpp:449
torc::LutParser::token token
Import the parser's token types into a local typedef.
Definition: LutScanner.cpp:448
#define YY_RESTORE_YY_MORE_OFFSET
Definition: LutScanner.cpp:410
#define INITIAL
Definition: LutScanner.cpp:478
yy_state_type yy_get_previous_state()
#define YY_BUFFER_NEW
Definition: LutScanner.cpp:245
static yyconst flex_int32_t yy_meta[14]
Definition: LutScanner.cpp:370
register char * yy_cp
Definition: LutScanner.cpp:573
int flex_int32_t
Bison lexer internals.
Definition: LutScanner.cpp:57
register char * yy_bp
Definition: LutScanner.cpp:573
#define YY_BREAK
Definition: LutScanner.cpp:562
unsigned char YY_CHAR
Bison lexer internals.
Definition: LutScanner.cpp:307
Bison parser internals.
Definition: LutScanner.cpp:327
int yy_buffer_status
Bison lexer internals.
Definition: LutScanner.cpp:243
int isatty(int)
#define YY_MORE_ADJ
Definition: LutScanner.cpp:409
virtual ~yyFlexLexer()
Definition: LutScanner.cpp:905