torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LutParser.cpp
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 2.3. */
2 
3 /* Skeleton implementation for Bison LALR(1) parsers in C++
4 
5  Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2, or (at your option)
10  any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA. */
21 
22 /* As a special exception, you may create a larger work that contains
23  part or all of the Bison parser skeleton and distribute that work
24  under terms of your choice, so long as that work isn't itself a
25  parser generator using the skeleton or a modified version thereof
26  as a parser skeleton. Alternatively, if you modify or redistribute
27  the parser skeleton itself, you may (at your option) remove this
28  special exception, which will cause the skeleton and the resulting
29  Bison output files to be licensed under the GNU General Public
30  License without this special exception.
31 
32  This special exception was added by the Free Software Foundation in
33  version 2.2 of Bison. */
34 
35 // Take the name prefix into account.
36 #define yylex torclex
37 
38 #include "y.tab.h"
39 
40 /* User implementation prologue. */
41 
42 
43 /* Line 317 of lalr1.cc. */
44 #line 45 "LutParser.cpp"
45 
46 #ifndef YY_
47 # if defined YYENABLE_NLS && YYENABLE_NLS
48 # if ENABLE_NLS
49 # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
50 # define YY_(msgid) dgettext ("bison-runtime", msgid)
51 # endif
52 # endif
53 # ifndef YY_
54 # define YY_(msgid) msgid
55 # endif
56 #endif
57 
58 /* Suppress unused-variable warnings by "using" E. */
59 #define YYUSE(e) ((void) (e))
60 
61 /* A pseudo ostream that takes yydebug_ into account. */
62 # define YYCDEBUG \
63  for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
64  (*yycdebug_)
65 
66 /* Enable debugging if requested. */
67 #if YYDEBUG
68 
69 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
70 do { \
71  if (yydebug_) \
72  { \
73  *yycdebug_ << Title << ' '; \
74  yy_symbol_print_ ((Type), (Value), (Location)); \
75  *yycdebug_ << std::endl; \
76  } \
77 } while (false)
78 
79 # define YY_REDUCE_PRINT(Rule) \
80 do { \
81  if (yydebug_) \
82  yy_reduce_print_ (Rule); \
83 } while (false)
84 
85 # define YY_STACK_PRINT() \
86 do { \
87  if (yydebug_) \
88  yystack_print_ (); \
89 } while (false)
90 
91 #else /* !YYDEBUG */
92 
93 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
94 # define YY_REDUCE_PRINT(Rule)
95 # define YY_STACK_PRINT()
96 
97 #endif /* !YYDEBUG */
98 
99 #define YYACCEPT goto yyacceptlab
100 #define YYABORT goto yyabortlab
101 #define YYERROR goto yyerrorlab
102 
103 namespace torc
104 {
105 #if YYERROR_VERBOSE
106 
107  /* Return YYSTR after stripping away unnecessary quotes and
108  backslashes, so that it's suitable for yyerror. The heuristic is
109  that double-quoting is unnecessary unless the string contains an
110  apostrophe, a comma, or backslash (other than backslash-backslash).
111  YYSTR is taken from yytname. */
113  LutParser::yytnamerr_ (const char *yystr)
114  {
115  if (*yystr == '"')
116  {
117  std::string yyr = "";
118  char const *yyp = yystr;
119 
120  for (;;)
121  switch (*++yyp)
122  {
123  case '\'':
124  case ',':
125  goto do_not_strip_quotes;
126 
127  case '\\':
128  if (*++yyp != '\\')
129  goto do_not_strip_quotes;
130  /* Fall through. */
131  default:
132  yyr += *yyp;
133  break;
134 
135  case '"':
136  return yyr;
137  }
138  do_not_strip_quotes: ;
139  }
140 
141  return yystr;
142  }
143 
144 #endif
145 
146  /// Build a parser object.
147  LutParser::LutParser (class Assembler& lut_yyarg)
148  : yydebug_ (false),
149  yycdebug_ (&std::cerr),
150  lut (lut_yyarg)
151  {
152  }
153 
155  {
156  }
157 
158 #if YYDEBUG
159  /*--------------------------------.
160  | Print this symbol on YYOUTPUT. |
161  `--------------------------------*/
162 
163  inline void
164  LutParser::yy_symbol_value_print_ (int yytype,
165  const semantic_type* yyvaluep, const location_type* yylocationp)
166  {
167  YYUSE (yylocationp);
168  YYUSE (yyvaluep);
169  switch (yytype)
170  {
171  default:
172  break;
173  }
174  }
175 
176 
177  void
178  LutParser::yy_symbol_print_ (int yytype,
179  const semantic_type* yyvaluep, const location_type* yylocationp)
180  {
181  *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
182  << ' ' << yytname_[yytype] << " ("
183  << *yylocationp << ": ";
184  yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
185  *yycdebug_ << ')';
186  }
187 #endif /* ! YYDEBUG */
188 
189  void
190  LutParser::yydestruct_ (const char* yymsg,
191  int yytype, semantic_type* yyvaluep, location_type* yylocationp)
192  {
193  YYUSE (yylocationp);
194  YYUSE (yymsg);
195  YYUSE (yyvaluep);
196 
197  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
198 
199  switch (yytype)
200  {
201 
202  default:
203  break;
204  }
205  }
206 
207  void
208  LutParser::yypop_ (unsigned int n)
209  {
210  yystate_stack_.pop (n);
213  }
214 
215  std::ostream&
217  {
218  return *yycdebug_;
219  }
220 
221  void
222  LutParser::set_debug_stream (std::ostream& o)
223  {
224  yycdebug_ = &o;
225  }
226 
227 
230  {
231  return yydebug_;
232  }
233 
234  void
236  {
237  yydebug_ = l;
238  }
239 
240 
241  int
243  {
244  /// Look-ahead and look-ahead in internal form.
245  int yychar = yyempty_;
246  int yytoken = 0;
247 
248  /* State. */
249  int yyn;
250  int yylen = 0;
251  int yystate = 0;
252 
253  /* Error handling. */
254  int yynerrs_ = 0;
255  int yyerrstatus_ = 0;
256 
257  /// Semantic value of the look-ahead.
258  semantic_type yylval;
259  /// Location of the look-ahead.
260  location_type yylloc;
261  /// The locations where the error started and ended.
262  location yyerror_range[2];
263 
264  /// $$.
265  semantic_type yyval;
266  /// @$.
267  location_type yyloc;
268 
269  int yyresult;
270 
271  YYCDEBUG << "Starting parse" << std::endl;
272 
273 
274  /* User initialization code. */
275  #line 88 "/Volumes/project/dev/torc/trunk/src/torc/bitstream/assembler/lut/parser.yy"
276 {
277  // initialize the initial location object
278  yylloc.begin.filename = yylloc.end.filename = &lut.mStreamName;
279 }
280  /* Line 555 of yacc.c. */
281 #line 282 "LutParser.cpp"
282  /* Initialize the stacks. The initial state will be pushed in
283  yynewstate, since the latter expects the semantical and the
284  location values to have been already stored, initialize these
285  stacks with a primary value. */
289  yysemantic_stack_.push (yylval);
290  yylocation_stack_.push (yylloc);
291 
292  /* New state. */
293  yynewstate:
294  yystate_stack_.push (yystate);
295  YYCDEBUG << "Entering state " << yystate << std::endl;
296  goto yybackup;
297 
298  /* Backup. */
299  yybackup:
300 
301  /* Try to take a decision without look-ahead. */
302  yyn = yypact_[yystate];
303  if (yyn == yypact_ninf_)
304  goto yydefault;
305 
306  /* Read a look-ahead token. */
307  if (yychar == yyempty_)
308  {
309  YYCDEBUG << "Reading a token: ";
310  yychar = yylex (&yylval, &yylloc);
311  }
312 
313 
314  /* Convert token to internal form. */
315  if (yychar <= yyeof_)
316  {
317  yychar = yytoken = yyeof_;
318  YYCDEBUG << "Now at end of input." << std::endl;
319  }
320  else
321  {
322  yytoken = yytranslate_ (yychar);
323  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
324  }
325 
326  /* If the proper action on seeing token YYTOKEN is to reduce or to
327  detect an error, take that action. */
328  yyn += yytoken;
329  if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
330  goto yydefault;
331 
332  /* Reduce or error. */
333  yyn = yytable_[yyn];
334  if (yyn <= 0)
335  {
336  if (yyn == 0 || yyn == yytable_ninf_)
337  goto yyerrlab;
338  yyn = -yyn;
339  goto yyreduce;
340  }
341 
342  /* Accept? */
343  if (yyn == yyfinal_)
344  goto yyacceptlab;
345 
346  /* Shift the look-ahead token. */
347  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
348 
349  /* Discard the token being shifted unless it is eof. */
350  if (yychar != yyeof_)
351  yychar = yyempty_;
352 
353  yysemantic_stack_.push (yylval);
354  yylocation_stack_.push (yylloc);
355 
356  /* Count tokens shifted since error; after three, turn off error
357  status. */
358  if (yyerrstatus_)
359  --yyerrstatus_;
360 
361  yystate = yyn;
362  goto yynewstate;
363 
364  /*-----------------------------------------------------------.
365  | yydefault -- do the default action for the current state. |
366  `-----------------------------------------------------------*/
367  yydefault:
368  yyn = yydefact_[yystate];
369  if (yyn == 0)
370  goto yyerrlab;
371  goto yyreduce;
372 
373  /*-----------------------------.
374  | yyreduce -- Do a reduction. |
375  `-----------------------------*/
376  yyreduce:
377  yylen = yyr2_[yyn];
378  /* If YYLEN is nonzero, implement the default value of the action:
379  `$$ = $1'. Otherwise, use the top of the stack.
380 
381  Otherwise, the following line sets YYVAL to garbage.
382  This behavior is undocumented and Bison
383  users should not rely upon it. */
384  if (yylen)
385  yyval = yysemantic_stack_[yylen - 1];
386  else
387  yyval = yysemantic_stack_[0];
388 
389  {
391  YYLLOC_DEFAULT (yyloc, slice, yylen);
392  }
393  YY_REDUCE_PRINT (yyn);
394  switch (yyn)
395  {
396  case 4:
397 #line 147 "parser.yy"
398  { (yyval) = (yysemantic_stack_[(3) - (1)]) + " xor " + (yysemantic_stack_[(3) - (3)]); lut.binaryLutFrameOperation(Assembler::eOR); }
399  break;
400 
401  case 6:
402 #line 153 "parser.yy"
403  { (yyval) = (yysemantic_stack_[(3) - (1)]) + " xor " + (yysemantic_stack_[(3) - (3)]); lut.binaryLutFrameOperation(Assembler::eXOR); }
404  break;
405 
406  case 8:
407 #line 159 "parser.yy"
408  { (yyval) = (yysemantic_stack_[(3) - (1)]) + " and " + (yysemantic_stack_[(3) - (3)]); lut.binaryLutFrameOperation(Assembler::eAND); }
409  break;
410 
411  case 10:
412 #line 164 "parser.yy"
413  { (yyval) = "not " + (yysemantic_stack_[(2) - (2)]); lut.binaryLutFrameOperation(Assembler::eNOT); }
414  break;
415 
416  case 11:
417 #line 167 "parser.yy"
418  { (yyval) = (yysemantic_stack_[(3) - (2)]); }
419  break;
420 
421  case 12:
422 #line 168 "parser.yy"
423  { (yyval) = (yysemantic_stack_[(1) - (1)]); lut.pushLutFrame(yylval); }
424  break;
425 
426 
427  /* Line 675 of lalr1.cc. */
428 #line 429 "LutParser.cpp"
429  default: break;
430  }
431  YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
432 
433  yypop_ (yylen);
434  yylen = 0;
435  YY_STACK_PRINT ();
436 
437  yysemantic_stack_.push (yyval);
438  yylocation_stack_.push (yyloc);
439 
440  /* Shift the result of the reduction. */
441  yyn = yyr1_[yyn];
442  yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
443  if (0 <= yystate && yystate <= yylast_
444  && yycheck_[yystate] == yystate_stack_[0])
445  yystate = yytable_[yystate];
446  else
447  yystate = yydefgoto_[yyn - yyntokens_];
448  goto yynewstate;
449 
450  /*------------------------------------.
451  | yyerrlab -- here on detecting error |
452  `------------------------------------*/
453  yyerrlab:
454  /* If not already recovering from an error, report this error. */
455  if (!yyerrstatus_)
456  {
457  ++yynerrs_;
458  error (yylloc, yysyntax_error_ (yystate, yytoken));
459  }
460 
461  yyerror_range[0] = yylloc;
462  if (yyerrstatus_ == 3)
463  {
464  /* If just tried and failed to reuse look-ahead token after an
465  error, discard it. */
466 
467  if (yychar <= yyeof_)
468  {
469  /* Return failure if at end of input. */
470  if (yychar == yyeof_)
471  YYABORT;
472  }
473  else
474  {
475  yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
476  yychar = yyempty_;
477  }
478  }
479 
480  /* Else will try to reuse look-ahead token after shifting the error
481  token. */
482  goto yyerrlab1;
483 
484 
485  /*---------------------------------------------------.
486  | yyerrorlab -- error raised explicitly by YYERROR. |
487  `---------------------------------------------------*/
488  yyerrorlab:
489 
490  /* Pacify compilers like GCC when the user code never invokes
491  YYERROR and the label yyerrorlab therefore never appears in user
492  code. */
493  if (false)
494  goto yyerrorlab;
495 
496  yyerror_range[0] = yylocation_stack_[yylen - 1];
497  /* Do not reclaim the symbols of the rule which action triggered
498  this YYERROR. */
499  yypop_ (yylen);
500  yylen = 0;
501  yystate = yystate_stack_[0];
502  goto yyerrlab1;
503 
504  /*-------------------------------------------------------------.
505  | yyerrlab1 -- common code for both syntax error and YYERROR. |
506  `-------------------------------------------------------------*/
507  yyerrlab1:
508  yyerrstatus_ = 3; /* Each real token shifted decrements this. */
509 
510  for (;;)
511  {
512  yyn = yypact_[yystate];
513  if (yyn != yypact_ninf_)
514  {
515  yyn += yyterror_;
516  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
517  {
518  yyn = yytable_[yyn];
519  if (0 < yyn)
520  break;
521  }
522  }
523 
524  /* Pop the current state because it cannot handle the error token. */
525  if (yystate_stack_.height () == 1)
526  YYABORT;
527 
528  yyerror_range[0] = yylocation_stack_[0];
529  yydestruct_ ("Error: popping",
530  yystos_[yystate],
532  yypop_ ();
533  yystate = yystate_stack_[0];
534  YY_STACK_PRINT ();
535  }
536 
537  if (yyn == yyfinal_)
538  goto yyacceptlab;
539 
540  yyerror_range[1] = yylloc;
541  // Using YYLLOC is tempting, but would change the location of
542  // the look-ahead. YYLOC is available though.
543  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
544  yysemantic_stack_.push (yylval);
545  yylocation_stack_.push (yyloc);
546 
547  /* Shift the error token. */
548  YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
550 
551  yystate = yyn;
552  goto yynewstate;
553 
554  /* Accept. */
555  yyacceptlab:
556  yyresult = 0;
557  goto yyreturn;
558 
559  /* Abort. */
560  yyabortlab:
561  yyresult = 1;
562  goto yyreturn;
563 
564  yyreturn:
565  if (yychar != yyeof_ && yychar != yyempty_)
566  yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
567 
568  /* Do not reclaim the symbols of the rule which action triggered
569  this YYABORT or YYACCEPT. */
570  yypop_ (yylen);
571  while (yystate_stack_.height () != 1)
572  {
573  yydestruct_ ("Cleanup: popping",
574  yystos_[yystate_stack_[0]],
575  &yysemantic_stack_[0],
576  &yylocation_stack_[0]);
577  yypop_ ();
578  }
579 
580  return yyresult;
581  }
582 
583  // Generate an error message.
585  LutParser::yysyntax_error_ (int yystate, int tok)
586  {
587  std::string res;
588  YYUSE (yystate);
589 #if YYERROR_VERBOSE
590  int yyn = yypact_[yystate];
591  if (yypact_ninf_ < yyn && yyn <= yylast_)
592  {
593  /* Start YYX at -YYN if negative to avoid negative indexes in
594  YYCHECK. */
595  int yyxbegin = yyn < 0 ? -yyn : 0;
596 
597  /* Stay within bounds of both yycheck and yytname. */
598  int yychecklim = yylast_ - yyn + 1;
599  int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
600  int count = 0;
601  for (int x = yyxbegin; x < yyxend; ++x)
602  if (yycheck_[x + yyn] == x && x != yyterror_)
603  ++count;
604 
605  // FIXME: This method of building the message is not compatible
606  // with internationalization. It should work like yacc.c does it.
607  // That is, first build a string that looks like this:
608  // "syntax error, unexpected %s or %s or %s"
609  // Then, invoke YY_ on this string.
610  // Finally, use the string as a format to output
611  // yytname_[tok], etc.
612  // Until this gets fixed, this message appears in English only.
613  res = "syntax error, unexpected ";
614  res += yytnamerr_ (yytname_[tok]);
615  if (count < 5)
616  {
617  count = 0;
618  for (int x = yyxbegin; x < yyxend; ++x)
619  if (yycheck_[x + yyn] == x && x != yyterror_)
620  {
621  res += (!count++) ? ", expecting " : " or ";
622  res += yytnamerr_ (yytname_[x]);
623  }
624  }
625  }
626  else
627 #endif
628  res = YY_("syntax error");
629  return res;
630  }
631 
632 
633  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
634  STATE-NUM. */
635  const signed char LutParser::yypact_ninf_ = -5;
636  const signed char
638  {
639  -4, -5, -5, -2, -4, 5, -1, 3, 4, -5,
640  -5, -5, 1, -5, -4, -4, -4, -5, 3, 4,
641  -5
642  };
643 
644  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
645  doesn't specify something else to do. Zero means the default is an
646  error. */
647  const unsigned char
649  {
650  0, 12, 13, 0, 0, 0, 2, 3, 5, 7,
651  9, 10, 0, 1, 0, 0, 0, 11, 4, 6,
652  8
653  };
654 
655  /* YYPGOTO[NTERM-NUM]. */
656  const signed char
658  {
659  -5, -5, 9, 0, 2, 6, 12
660  };
661 
662  /* YYDEFGOTO[NTERM-NUM]. */
663  const signed char
665  {
666  -1, 5, 6, 7, 8, 9, 10
667  };
668 
669  /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
670  positive, shift that token. If negative, reduce the rule which
671  number is the opposite. If zero, do what YYDEFACT says. */
672  const signed char LutParser::yytable_ninf_ = -1;
673  const unsigned char
675  {
676  1, 2, 1, 2, 3, 13, 14, 4, 14, 4,
677  16, 17, 15, 12, 18, 11, 0, 19, 0, 0,
678  0, 0, 20
679  };
680 
681  /* YYCHECK. */
682  const signed char
684  {
685  4, 5, 4, 5, 8, 0, 7, 11, 7, 11,
686  6, 10, 9, 4, 14, 3, -1, 15, -1, -1,
687  -1, -1, 16
688  };
689 
690  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
691  symbol of state STATE-NUM. */
692  const unsigned char
694  {
695  0, 4, 5, 8, 11, 14, 15, 16, 17, 18,
696  19, 19, 15, 0, 7, 9, 6, 10, 16, 17,
697  18
698  };
699 
700 #if YYDEBUG
701  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
702  to YYLEX-NUM. */
703  const unsigned short int
704  LutParser::yytoken_number_[] =
705  {
706  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
707  265, 266, 267
708  };
709 #endif
710 
711  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
712  const unsigned char
713  LutParser::yyr1_[] =
714  {
715  0, 13, 14, 15, 15, 16, 16, 17, 17, 18,
716  18, 19, 19, 19
717  };
718 
719  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
720  const unsigned char
721  LutParser::yyr2_[] =
722  {
723  0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
724  2, 3, 1, 1
725  };
726 
727 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
728  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
729  First, the terminals, then, starting at \a yyntokens_, nonterminals. */
730  const char*
731  const LutParser::yytname_[] =
732  {
733  "\"end of file\"", "error", "$undefined", "\"end of line\"", "VAR",
734  "LITERAL", "AND", "OR", "NOT", "XOR", "RP", "LP", "INVALID", "$accept",
735  "lut_equation", "expression", "xor_expression", "and_expression",
736  "not_expression", "factor", 0
737  };
738 #endif
739 
740 #if YYDEBUG
741  /* YYRHS -- A `-1'-separated list of the rules' RHS. */
742  const LutParser::rhs_number_type
743  LutParser::yyrhs_[] =
744  {
745  14, 0, -1, 15, -1, 16, -1, 15, 7, 16,
746  -1, 17, -1, 16, 9, 17, -1, 18, -1, 17,
747  6, 18, -1, 19, -1, 8, 19, -1, 11, 15,
748  10, -1, 4, -1, 5, -1
749  };
750 
751  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
752  YYRHS. */
753  const unsigned char
754  LutParser::yyprhs_[] =
755  {
756  0, 0, 3, 5, 7, 11, 13, 17, 19, 23,
757  25, 28, 32, 34
758  };
759 
760  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
761  const unsigned char
762  LutParser::yyrline_[] =
763  {
764  0, 141, 141, 145, 146, 151, 152, 157, 158, 163,
765  164, 167, 168, 169
766  };
767 
768  // Print the state stack on the debug stream.
769  void
770  LutParser::yystack_print_ ()
771  {
772  *yycdebug_ << "Stack now";
774  i != yystate_stack_.end (); ++i)
775  *yycdebug_ << ' ' << *i;
776  *yycdebug_ << std::endl;
777  }
778 
779  // Report on the debug stream that the rule \a yyrule is going to be reduced.
780  void
781  LutParser::yy_reduce_print_ (int yyrule)
782  {
783  unsigned int yylno = yyrline_[yyrule];
784  int yynrhs = yyr2_[yyrule];
785  /* Print the symbols being reduced, and their result. */
786  *yycdebug_ << "Reducing stack by rule " << yyrule - 1
787  << " (line " << yylno << "), ";
788  /* The symbols being reduced. */
789  for (int yyi = 0; yyi < yynrhs; yyi++)
790  YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
791  yyrhs_[yyprhs_[yyrule] + yyi],
792  &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
793  &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
794  }
795 #endif // YYDEBUG
796 
797  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
800  {
801  static
802  const token_number_type
803  translate_table[] =
804  {
805  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
806  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
807  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
808  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
809  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
810  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
811  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
812  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
813  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
814  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
815  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
816  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
817  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
818  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
819  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
820  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
821  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
822  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
823  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
824  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
825  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
826  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
827  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
828  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
829  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
830  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
831  5, 6, 7, 8, 9, 10, 11, 12
832  };
833  if ((unsigned int) t <= yyuser_token_number_max_)
834  return translate_table[t];
835  else
836  return yyundef_token_;
837  }
838 
839  const int LutParser::yyeof_ = 0;
840  const int LutParser::yylast_ = 22;
841  const int LutParser::yynnts_ = 7;
842  const int LutParser::yyempty_ = -2;
843  const int LutParser::yyfinal_ = 13;
844  const int LutParser::yyterror_ = 1;
845  const int LutParser::yyerrcode_ = 256;
846  const int LutParser::yyntokens_ = 13;
847 
848  const unsigned int LutParser::yyuser_token_number_max_ = 267;
850 
851 } // namespace torc
852 
853 #line 178 "parser.yy"
854 
855 
856 
857 // ------------------------------------------------------------------------------------------------
858 // ------------------------------------- Additional parser code -----------------------------------
859 // ------------------------------------------------------------------------------------------------
860 
861 
863  lut.error(l, m);
864 }
865 
866 //namespace {
867 // /// \brief Suppress GCC warnings about unused boost global variables.
868 // void suppress_boost_gcc_warnings(void);
869 // void suppress_boost_gcc_warnings(void) {
870 // (void) boost::system::system_category;
871 // (void) boost::system::generic_category;
872 // (void) boost::system::posix_category;
873 // (void) boost::system::errno_ecat;
874 // (void) boost::system::native_ecat;
875 // }
876 //}
877 
stack< semantic_type > semantic_stack_type
Semantic value stack type.
Definition: LutParser.hpp:231
token_number_type yytranslate_(int t)
Convert a scanner token number t to a symbol number.
Definition: LutParser.cpp:799
#define yylex
Definition: LutParser.cpp:36
static const signed char yydefgoto_[]
Definition: LutParser.hpp:255
#define YYCDEBUG
Definition: LutParser.cpp:62
virtual int parse()
Definition: LutParser.cpp:242
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: LutParser.cpp:208
position begin
Beginning of the located region.
YYSTYPE semantic_type
Symbol semantic values.
Definition: LutParser.hpp:151
void yydestruct_(const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
Reclaim the memory associated to a symbol.
Definition: LutParser.cpp:190
static const int yyntokens_
Definition: LutParser.hpp:327
const_iterator end() const
Bison undocumented.
location_stack_type yylocation_stack_
The location stack.
Definition: LutParser.hpp:240
semantic_stack_type yysemantic_stack_
The semantic value stack.
Definition: LutParser.hpp:238
Present a slice of the top of a stack.
string mStreamName
Name of file or input stream for error messages.
Definition: Assembler.hpp:112
static const signed char yypgoto_[]
Definition: LutParser.hpp:254
static const unsigned char yyr2_[]
For a rule, its RHS length.
Definition: LutParser.hpp:273
int debug_level_type
Type for debugging levels.
Definition: LutParser.hpp:191
Header forwarding LutScanner includes to the LutParser.
const_iterator begin() const
Bison undocumented.
std::ostream & debug_stream() const
The current debugging stream.
Definition: LutParser.cpp:216
static const unsigned char yyr1_[]
For a rule, its LHS.
Definition: LutParser.hpp:271
static const int yyeof_
Definition: LutParser.hpp:319
std::string string
static const unsigned int yyuser_token_number_max_
Definition: LutParser.hpp:328
#define YY_STACK_PRINT()
Definition: LutParser.cpp:95
static const signed char yytable_ninf_
Definition: LutParser.hpp:263
static const int yyerrcode_
Definition: LutParser.hpp:326
void binaryLutFrameOperation(EOperation inOperation)
Function called from parser when it encounters a bit operator.
Definition: Assembler.cpp:747
#define YYUSE(e)
Definition: LutParser.cpp:59
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: LutParser.hpp:126
void push(const T &t)
Bison undocumented.
static const signed char yypact_[]
For a state, the index in yytable_ of its portion.
Definition: LutParser.hpp:246
static const signed char yypact_ninf_
Definition: LutParser.hpp:247
void pushLutFrame(string inLiteral)
Function called from parser when it encounters a literal.
Definition: Assembler.cpp:803
std::string * filename
File name to which this position refers.
class Assembler & lut
Definition: LutParser.hpp:337
stack< location_type > location_stack_type
location stack type.
Definition: LutParser.hpp:233
LutParser(class Assembler &lut_yyarg)
Build a parser object.
Definition: LutParser.cpp:147
std::ostream * yycdebug_
Definition: LutParser.hpp:333
static const int yyempty_
Definition: LutParser.hpp:323
virtual std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
static const token_number_type yyundef_token_
Definition: LutParser.hpp:329
static const int yyterror_
Definition: LutParser.hpp:325
#define YY_REDUCE_PRINT(Rule)
Definition: LutParser.cpp:94
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: LutParser.hpp:277
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: LutParser.cpp:222
static const unsigned char yytable_[]
Definition: LutParser.hpp:262
stack< state_type > state_stack_type
State stack type.
Definition: LutParser.hpp:229
virtual ~LutParser()
Definition: LutParser.cpp:154
#define YY_(msgid)
Definition: LutParser.cpp:54
static const signed char yycheck_[]
Definition: LutParser.hpp:265
position end
End of the located region.
static const int yynnts_
Definition: LutParser.hpp:322
std::deque< state_type >::const_reverse_iterator const_iterator
static const int yyfinal_
Definition: LutParser.hpp:324
void pop(unsigned int n=1)
Bison undocumented.
void error(const location &l, const string &m)
Lut parse error handling.
Definition: Assembler.cpp:849
virtual std::string yysyntax_error_(int yystate, int tok)
Definition: LutParser.cpp:585
unsigned char token_number_type
Internal symbol numbers.
Definition: LutParser.hpp:243
debug_level_type debug_level() const
The current debugging level.
Definition: LutParser.cpp:229
state_stack_type yystate_stack_
The state stack.
Definition: LutParser.hpp:236
static const int yylast_
Definition: LutParser.hpp:321
Base class for bitstream assembly.
Definition: Assembler.hpp:46
#define YYABORT
Definition: LutParser.cpp:100
static const unsigned char yystos_[]
For a state, its accessing symbol.
Definition: LutParser.hpp:268
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: LutParser.cpp:235
static const unsigned char yydefact_[]
Definition: LutParser.hpp:252
virtual void error(const location_type &loc, const std::string &msg)
Definition: LutParser.cpp:862
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition: LutParser.cpp:93