Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
evalexpr_parser.h
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 2.7. */
2 
3 /* Skeleton interface for Bison LALR(1) parsers in C++
4 
5  Copyright (C) 2002-2012 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 3 of the License, or
10  (at your option) 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, see <http://www.gnu.org/licenses/>. */
19 
20 /* As a special exception, you may create a larger work that contains
21  part or all of the Bison parser skeleton and distribute that work
22  under terms of your choice, so long as that work isn't itself a
23  parser generator using the skeleton or a modified version thereof
24  as a parser skeleton. Alternatively, if you modify or redistribute
25  the parser skeleton itself, you may (at your option) remove this
26  special exception, which will cause the skeleton and the resulting
27  Bison output files to be licensed under the GNU General Public
28  License without this special exception.
29 
30  This special exception was added by the Free Software Foundation in
31  version 2.2 of Bison. */
32 
38 /* C++ LALR(1) parser skeleton written by Akim Demaille. */
39 
40 #ifndef YY_YY_EVALEXPR_PARSER_H_INCLUDED
41 # define YY_YY_EVALEXPR_PARSER_H_INCLUDED
42 
43 /* "%code requires" blocks. */
44 /* Line 33 of lalr1.cc */
45 #line 7 "evalexpr_parser.yy"
46 
47 #include <cmath>
48 #include <string>
49 
50 class EvalExpr;
51 
52 
53 /* Line 33 of lalr1.cc */
54 #line 55 "evalexpr_parser.h"
55 
56 
57 #include <string>
58 #include <iostream>
59 #include "stack.hh"
60 #include "location.hh"
61 
62 /* Enabling traces. */
63 #ifndef YYDEBUG
64 # define YYDEBUG 1
65 #endif
66 
67 /* Line 33 of lalr1.cc */
68 #line 4 "evalexpr_parser.yy"
69 namespace yy {
70 /* Line 33 of lalr1.cc */
71 #line 72 "evalexpr_parser.h"
72 
74  class parser
75  {
76  public:
78 #ifndef YYSTYPE
80  {
81 /* Line 33 of lalr1.cc */
82 #line 21 "evalexpr_parser.yy"
83 
84  double val;
85  char *sym;
86 
87 
88 /* Line 33 of lalr1.cc */
89 #line 90 "evalexpr_parser.h"
90  };
91 #else
92  typedef YYSTYPE semantic_type;
93 #endif
94  typedef location location_type;
97  struct token
98  {
99  /* Tokens. */
101  {
102  EOL = 258,
103  IDENTIFIER = 259,
104  NUMBER = 260,
105  NEG = 261,
106  PLS = 262
107  };
108  };
111 
113  parser(EvalExpr& driver_yyarg);
114  virtual ~parser();
115 
118  virtual int parse();
119 
120 #if YYDEBUG
121  std::ostream& debug_stream() const;
123 
125  void set_debug_stream(std::ostream&);
126 
128  typedef int debug_level_type;
131 
134 #endif
135 
136  private:
140  virtual void error(const location_type& loc, const std::string& msg);
141 
145  virtual std::string yysyntax_error_(int yystate, int tok);
146 
147 #if YYDEBUG
148  virtual void yy_symbol_value_print_(int yytype,
153  const semantic_type *yyvaluep,
154  const location_type *yylocationp);
155 
160  virtual void yy_symbol_print_(int yytype,
161  const semantic_type *yyvaluep,
162  const location_type *yylocationp);
163 #endif
164 
165 
167  typedef int state_type;
174 
181 
184  static bool yy_pact_value_is_default_(int yyvalue);
185 
188  static bool yy_table_value_is_error_(int yyvalue);
189 
191  typedef unsigned char token_number_type;
192  /* Tables. */
194  static const signed char yypact_[];
195  static const signed char yypact_ninf_;
196 
200  static const unsigned char yydefact_[];
201 
202  static const signed char yypgoto_[];
203  static const signed char yydefgoto_[];
204 
210  static const unsigned char yytable_[];
211  static const signed char yytable_ninf_;
212 
213  static const signed char yycheck_[];
214 
216  static const unsigned char yystos_[];
217 
219  static const unsigned char yyr1_[];
221  static const unsigned char yyr2_[];
222 
224  static std::string yytnamerr_(const char *n);
225 
226 
228  static const char *const yytname_[];
229 #if YYDEBUG
230  typedef signed char rhs_number_type;
233  static const rhs_number_type yyrhs_[];
235  static const unsigned char yyprhs_[];
237  static const unsigned char yyrline_[];
239  static const unsigned short int yytoken_number_[];
241  virtual void yy_reduce_print_(int r);
242 
244  virtual void yystack_print_();
245 
246  /* Debugging. */
247  int yydebug_;
248  std::ostream *yycdebug_;
249 #endif
250 
253 
260  inline void yydestruct_(const char *yymsg,
261  int yytype,
262  semantic_type *yyvaluep,
263  location_type *yylocationp);
264 
266  inline void yypop_(unsigned int n = 1);
267 
268  /* Constants. */
269  static const int yyeof_;
270  /* LAST_ -- Last index in TABLE_. */
271  static const int yylast_;
272  static const int yynnts_;
273  static const int yyempty_;
274  static const int yyfinal_;
275  static const int yyterror_;
276  static const int yyerrcode_;
277  static const int yyntokens_;
278  static const unsigned int yyuser_token_number_max_;
280 
281  /* User arguments. */
283  };
284 /* Line 33 of lalr1.cc */
285 #line 4 "evalexpr_parser.yy"
286 } // yy
287 /* Line 33 of lalr1.cc */
288 #line 285 "evalexpr_parser.h"
289 #endif /* !YY_YY_EVALEXPR_PARSER_H_INCLUDED */
static const signed char yypgoto_[]
location location_type
Symbol locations.
static const rhs_number_type yyrhs_[]
A `-1'-separated list of the rules' RHS.
static const char *const yytname_[]
For a symbol, its name in clear.
static const unsigned char yystos_[]
For a state, its accessing symbol.
void set_debug_stream(std::ostream &)
Set the current debugging stream.
virtual std::string yysyntax_error_(int yystate, int tok)
static const signed char yytable_ninf_
state_stack_type yystate_stack_
The state stack.
int debug_level_type
Type for debugging levels.
void yydestruct_(const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
Reclaim the memory associated to a symbol.
virtual void yy_symbol_print_(int yytype, const semantic_type *yyvaluep, const location_type *yylocationp)
Report a symbol on the debug stream.
std::ostream & debug_stream() const
The current debugging stream.
virtual int parse()
static const unsigned char yydefact_[]
virtual ~parser()
int state_type
State numbers.
signed char rhs_number_type
A type to store symbol numbers and -1.
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
debug_level_type debug_level() const
The current debugging level.
virtual void yy_symbol_value_print_(int yytype, const semantic_type *yyvaluep, const location_type *yylocationp)
Report a symbol value on the debug stream.
static const unsigned char yytable_[]
static const int yyeof_
static const unsigned char yyprhs_[]
For each rule, the index of the first RHS symbol in yyrhs_.
void set_debug_level(debug_level_type l)
Set the current debugging level.
Symbol semantic values.
parser(EvalExpr &driver_yyarg)
Build a parser object.
static const unsigned short int yytoken_number_[]
For each scanner token number, its symbol number.
static const unsigned char yyr1_[]
For a rule, its LHS.
EvalExpr class for algebraic expression in parameter strings.
Definition: evalexpr.h:39
virtual void error(const location_type &loc, const std::string &msg)
virtual void yystack_print_()
Print the state stack on the debug stream.
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
stack< location_type > location_stack_type
location stack type.
static const unsigned char yyrline_[]
For each rule, its source line number.
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
static const int yynnts_
static bool yy_table_value_is_error_(int yyvalue)
token::yytokentype token_type
Token type.
static const signed char yypact_ninf_
static const int yyntokens_
std::ostream * yycdebug_
static const signed char yycheck_[]
static const int yyfinal_
stack< semantic_type > semantic_stack_type
Semantic value stack type.
token_number_type yytranslate_(int t)
Convert a scanner token number t to a symbol number.
Abstract a location.
Definition: location.hh:50
static const token_number_type yyundef_token_
A Bison parser.
static const unsigned char yyr2_[]
For a rule, its RHS length.
stack< state_type > state_stack_type
State stack type.
static const signed char yydefgoto_[]
static const int yyerrcode_
EvalExpr & driver
location_stack_type yylocation_stack_
The location stack.
static const unsigned int yyuser_token_number_max_
static const signed char yypact_[]
For a state, the index in yytable_ of its portion.
static bool yy_pact_value_is_default_(int yyvalue)
static const int yylast_
unsigned char token_number_type
Internal symbol numbers.
static const int yyterror_
static const int yyempty_
semantic_stack_type yysemantic_stack_
The semantic value stack.