#include <parser.h>
Public Types | |
typedef location | location_type |
Symbol locations. | |
typedef token::yytokentype | token_type |
Token type. | |
typedef int | debug_level_type |
Type for debugging levels. | |
Public Member Functions | |
Parser (class Driver &driver_yyarg) | |
Build a parser object. | |
virtual | ~Parser () |
virtual int | parse () |
Parse. | |
std::ostream & | debug_stream () const |
The current debugging stream. | |
void | set_debug_stream (std::ostream &) |
Set the current debugging stream. | |
debug_level_type | debug_level () const |
The current debugging level. | |
void | set_debug_level (debug_level_type l) |
Set the current debugging level. | |
Private Types | |
typedef int | state_type |
State numbers. | |
typedef stack< state_type > | state_stack_type |
State stack type. | |
typedef stack< semantic_type > | semantic_stack_type |
Semantic value stack type. | |
typedef stack< location_type > | location_stack_type |
location stack type. | |
typedef unsigned char | token_number_type |
Internal symbol numbers. | |
typedef signed char | rhs_number_type |
A type to store symbol numbers and -1. | |
Private Member Functions | |
virtual void | error (const location_type &loc, const std::string &msg) |
Report a syntax error. | |
virtual std::string | yysyntax_error_ (int yystate, int tok) |
Generate an error message. | |
virtual void | yy_symbol_value_print_ (int yytype, const semantic_type *yyvaluep, const location_type *yylocationp) |
Report a symbol value on the debug stream. | |
virtual void | yy_symbol_print_ (int yytype, const semantic_type *yyvaluep, const location_type *yylocationp) |
Report a symbol on the debug stream. | |
virtual std::string | yytnamerr_ (const char *n) |
Convert the symbol name n to a form suitable for a diagnostic. | |
virtual void | yy_reduce_print_ (int r) |
Report on the debug stream that the rule r is going to be reduced. | |
virtual void | yystack_print_ () |
Print the state stack on the debug stream. | |
token_number_type | yytranslate_ (int t) |
Convert a scanner token number t to a symbol number. | |
void | yydestruct_ (const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp) |
Reclaim the memory associated to a symbol. | |
void | yypop_ (unsigned int n=1) |
Pop n symbols the three stacks. | |
Private Attributes | |
state_stack_type | yystate_stack_ |
The state stack. | |
semantic_stack_type | yysemantic_stack_ |
The semantic value stack. | |
location_stack_type | yylocation_stack_ |
The location stack. | |
int | yydebug_ |
std::ostream * | yycdebug_ |
Driver & | driver |
Static Private Attributes | |
static const signed char | yypact_ [] |
For a state, the index in yytable_ of its portion. | |
static const signed char | yypact_ninf_ = -15 |
static const unsigned char | yydefact_ [] |
For a state, default rule to reduce. | |
static const signed char | yypgoto_ [] |
static const signed char | yydefgoto_ [] |
static const unsigned char | yytable_ [] |
What to do in a state. | |
static const signed char | yytable_ninf_ = -1 |
static const signed char | yycheck_ [] |
static const unsigned char | yystos_ [] |
For a state, its accessing symbol. | |
static const unsigned char | yyr1_ [] |
For a rule, its LHS. | |
static const unsigned char | yyr2_ [] |
For a rule, its RHS length. | |
static const char *const | yytname_ [] |
For a symbol, its name in clear. | |
static const rhs_number_type | yyrhs_ [] |
A `-1'-separated list of the rules' RHS. | |
static const unsigned char | yyprhs_ [] |
For each rule, the index of the first RHS symbol in yyrhs_. | |
static const unsigned char | yyrline_ [] |
For each rule, its source line number. | |
static const unsigned short int | yytoken_number_ [] |
For each scanner token number, its symbol number. | |
static const int | yyeof_ = 0 |
static const int | yylast_ = 44 |
static const int | yynnts_ = 11 |
static const int | yyempty_ = -2 |
static const int | yyfinal_ = 2 |
static const int | yyterror_ = 1 |
static const int | yyerrcode_ = 256 |
static const int | yyntokens_ = 17 |
static const unsigned int | yyuser_token_number_max_ = 261 |
static const token_number_type | yyundef_token_ = 2 |
Classes | |
union | semantic_type |
Symbol semantic values. More... | |
struct | token |
Tokens. More... |
Definition at line 108 of file parser.h.
typedef int example::Parser::debug_level_type |
typedef int example::Parser::state_type [private] |
typedef stack<state_type> example::Parser::state_stack_type [private] |
typedef stack<semantic_type> example::Parser::semantic_stack_type [private] |
typedef stack<location_type> example::Parser::location_stack_type [private] |
typedef unsigned char example::Parser::token_number_type [private] |
typedef signed char example::Parser::rhs_number_type [private] |
example::Parser::Parser | ( | class Driver & | driver_yyarg | ) |
int example::Parser::parse | ( | ) | [virtual] |
Parse.
Look-ahead and look-ahead in internal form.
Semantic value of the look-ahead.
Location of the look-ahead.
The locations where the error started and ended.
$$.
$.
Definition at line 299 of file parser.cc.
References example::location::begin, example::Driver::calc, example::Parser::semantic_type::calcnode, driver, example::location::end, error(), CalcContext::existsVariable(), CalcContext::expressions, example::position::filename, CalcContext::getVariable(), example::stack< T, S >::push(), example::Driver::streamname, CalcContext::variables, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYCDEBUG, yycheck_, yydefact_, yydefgoto_, yydestruct_(), yyempty_, yyeof_, YYERROR, yyfinal_, yylast_, yylex, YYLLOC_DEFAULT, yylocation_stack_, yyntokens_, yypact_, yypact_ninf_, yypgoto_, yypop_(), yyr1_, yyr2_, yysemantic_stack_, yystate_stack_, yystos_, yysyntax_error_(), yytable_, yytable_ninf_, yyterror_, and yytranslate_().
Referenced by example::Driver::parse_stream().
std::ostream & example::Parser::debug_stream | ( | ) | const |
void example::Parser::set_debug_stream | ( | std::ostream & | ) |
Parser::debug_level_type example::Parser::debug_level | ( | ) | const |
void example::Parser::set_debug_level | ( | debug_level_type | l | ) |
Set the current debugging level.
Definition at line 292 of file parser.cc.
References yydebug_.
Referenced by example::Driver::parse_stream().
void example::Parser::error | ( | const location_type & | loc, | |
const std::string & | msg | |||
) | [private, virtual] |
Report a syntax error.
loc | where the syntax error is found. | |
msg | a description of the syntax error. |
Definition at line 1083 of file parser.cc.
References driver, and example::Driver::error().
Referenced by parse().
std::string example::Parser::yysyntax_error_ | ( | int | yystate, | |
int | tok | |||
) | [private, virtual] |
Generate an error message.
state | the state where the error occurred. | |
tok | the look-ahead token. |
Definition at line 785 of file parser.cc.
References YY_, yycheck_, yylast_, yyntokens_, yypact_, yypact_ninf_, yyterror_, yytname_, yytnamerr_(), and YYUSE.
Referenced by parse().
virtual void example::Parser::yy_symbol_value_print_ | ( | int | yytype, | |
const semantic_type * | yyvaluep, | |||
const location_type * | yylocationp | |||
) | [private, virtual] |
virtual void example::Parser::yy_symbol_print_ | ( | int | yytype, | |
const semantic_type * | yyvaluep, | |||
const location_type * | yylocationp | |||
) | [private, virtual] |
virtual std::string example::Parser::yytnamerr_ | ( | const char * | n | ) | [private, virtual] |
virtual void example::Parser::yy_reduce_print_ | ( | int | r | ) | [private, virtual] |
Report on the debug stream that the rule r is going to be reduced.
virtual void example::Parser::yystack_print_ | ( | ) | [private, virtual] |
Print the state stack on the debug stream.
Parser::token_number_type example::Parser::yytranslate_ | ( | int | t | ) | [private] |
Convert a scanner token number t to a symbol number.
Definition at line 1026 of file parser.cc.
References yyundef_token_, and yyuser_token_number_max_.
Referenced by parse().
void example::Parser::yydestruct_ | ( | const char * | yymsg, | |
int | yytype, | |||
semantic_type * | yyvaluep, | |||
location_type * | yylocationp | |||
) | [inline, private] |
Reclaim the memory associated to a symbol.
yymsg | Why this token is reclaimed. | |
yytype | The symbol type. | |
yyvaluep | Its semantic value. | |
yylocationp | Its location. |
Definition at line 202 of file parser.cc.
References example::Parser::semantic_type::calcnode, example::Parser::semantic_type::stringVal, YY_SYMBOL_PRINT, and YYUSE.
Referenced by parse().
void example::Parser::yypop_ | ( | unsigned int | n = 1 |
) | [inline, private] |
Pop n symbols the three stacks.
Definition at line 265 of file parser.cc.
References example::stack< T, S >::pop(), yylocation_stack_, yysemantic_stack_, and yystate_stack_.
Referenced by parse().
const signed char example::Parser::yypact_ [static, private] |
Initial value:
{ -15, 0, -15, -15, -15, -15, -14, 16, 27, 27, -15, -15, -15, -15, -1, -15, 23, 8, 9, 14, 16, -15, 5, -1, -1, 27, 16, 16, 16, 16, 16, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, 23, 23 }
Definition at line 214 of file parser.h.
Referenced by parse(), and yysyntax_error_().
const signed char example::Parser::yypact_ninf_ = -15 [static, private] |
const unsigned char example::Parser::yydefact_ [static, private] |
Initial value:
{ 22, 0, 1, 24, 2, 3, 4, 0, 0, 0, 23, 5, 6, 8, 10, 13, 17, 20, 0, 0, 0, 4, 0, 11, 12, 0, 0, 0, 0, 0, 0, 30, 29, 28, 27, 26, 25, 21, 7, 9, 14, 15, 16, 18, 19 }
Unlessyytable_ specifies something else to do. Zero means the default is an error.
Definition at line 220 of file parser.h.
Referenced by parse().
const signed char example::Parser::yypgoto_ [static, private] |
const signed char example::Parser::yydefgoto_ [static, private] |
const unsigned char example::Parser::yytable_ [static, private] |
Initial value:
{ 2, 20, 22, 3, 4, 5, 6, 7, 25, 31, 8, 9, 32, 38, 34, 37, 10, 35, 29, 30, 4, 5, 21, 7, 0, 33, 8, 9, 23, 24, 36, 4, 5, 21, 7, 26, 27, 28, 40, 41, 42, 0, 43, 44, 39 }
yytable_[yypact_[s]]: what to do in state s.
Definition at line 230 of file parser.h.
Referenced by parse().
const signed char example::Parser::yytable_ninf_ = -1 [static, private] |
const signed char example::Parser::yycheck_ [static, private] |
Initial value:
{ 0, 15, 7, 3, 4, 5, 6, 7, 9, 0, 10, 11, 3, 8, 0, 20, 16, 3, 10, 11, 4, 5, 6, 7, -1, 16, 10, 11, 8, 9, 16, 4, 5, 6, 7, 12, 13, 14, 26, 27, 28, -1, 29, 30, 25 }
Definition at line 233 of file parser.h.
Referenced by parse(), and yysyntax_error_().
const unsigned char example::Parser::yystos_ [static, private] |
const unsigned char example::Parser::yyr1_ [static, private] |
const unsigned char example::Parser::yyr2_ [static, private] |
const char* const example::Parser::yytname_[] [static, private] |
For a symbol, its name in clear.
Definition at line 245 of file parser.h.
Referenced by yysyntax_error_().
const rhs_number_type example::Parser::yyrhs_[] [static, private] |
const unsigned char example::Parser::yyprhs_[] [static, private] |
const unsigned char example::Parser::yyrline_[] [static, private] |
const unsigned short int example::Parser::yytoken_number_[] [static, private] |
const int example::Parser::yyeof_ = 0 [static, private] |
const int example::Parser::yylast_ = 44 [static, private] |
const int example::Parser::yynnts_ = 11 [static, private] |
const int example::Parser::yyempty_ = -2 [static, private] |
const int example::Parser::yyfinal_ = 2 [static, private] |
const int example::Parser::yyterror_ = 1 [static, private] |
const int example::Parser::yyerrcode_ = 256 [static, private] |
const int example::Parser::yyntokens_ = 17 [static, private] |
const unsigned int example::Parser::yyuser_token_number_max_ = 261 [static, private] |
const Parser::token_number_type example::Parser::yyundef_token_ = 2 [static, private] |
int example::Parser::yydebug_ [private] |
std::ostream* example::Parser::yycdebug_ [private] |
class Driver& example::Parser::driver [private] |