#include <parser.h>
Classes | |
union | semantic_type |
Symbol semantic values. More... | |
struct | token |
Tokens. More... | |
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_ |
class 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_ = -9 |
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 unsigned 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_ = 42 |
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 |
Definition at line 114 of file parser.h.
typedef int example::Parser::debug_level_type |
typedef stack<location_type> example::Parser::location_stack_type [private] |
typedef signed char example::Parser::rhs_number_type [private] |
typedef stack<semantic_type> example::Parser::semantic_stack_type [private] |
typedef stack<state_type> example::Parser::state_stack_type [private] |
typedef int example::Parser::state_type [private] |
typedef unsigned char example::Parser::token_number_type [private] |
example::Parser::Parser | ( | class Driver & | driver_yyarg | ) |
debug_level_type example::Parser::debug_level | ( | ) | const |
The current debugging level.
std::ostream& example::Parser::debug_stream | ( | ) | const |
The current debugging 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 1210 of file parser.cc.
References driver, and example::Driver::error().
Referenced by parse().
int example::Parser::parse | ( | ) | [virtual] |
Parse.
Lookahead and lookahead in internal form.
Semantic value of the lookahead.
Location of the lookahead.
The locations where the error started and ended.
$$.
$.
Definition at line 368 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().
void example::Parser::set_debug_level | ( | debug_level_type | l | ) |
void example::Parser::set_debug_stream | ( | std::ostream & | ) |
Set the current debugging stream.
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::yy_symbol_print_ | ( | int | yytype, | |
const semantic_type * | yyvaluep, | |||
const location_type * | yylocationp | |||
) | [private, virtual] |
virtual void example::Parser::yy_symbol_value_print_ | ( | int | yytype, | |
const semantic_type * | yyvaluep, | |||
const location_type * | yylocationp | |||
) | [private, virtual] |
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 234 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 333 of file parser.cc.
References example::stack< T, S >::pop(), yylocation_stack_, yysemantic_stack_, and yystate_stack_.
Referenced by parse().
virtual void example::Parser::yystack_print_ | ( | ) | [private, virtual] |
Print the state stack on the debug stream.
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 lookahead token. |
Definition at line 903 of file parser.cc.
References YY_, yycheck_, yylast_, yyntokens_, yypact_, yypact_ninf_, yyterror_, yytname_, yytnamerr_(), and YYUSE.
Referenced by parse().
virtual std::string example::Parser::yytnamerr_ | ( | const char * | n | ) | [private, virtual] |
Parser::token_number_type example::Parser::yytranslate_ | ( | int | t | ) | [private] |
Convert a scanner token number t to a symbol number.
Definition at line 1144 of file parser.cc.
References yyundef_token_, and yyuser_token_number_max_.
Referenced by parse().
class Driver& example::Parser::driver [private] |
std::ostream* example::Parser::yycdebug_ [private] |
const unsigned char example::Parser::yycheck_ [static, private] |
Initial value:
{ 8, 9, 0, 10, 11, 3, 4, 5, 6, 7, 7, 0, 10, 11, 3, 15, 0, 25, 16, 3, 12, 13, 14, 20, 26, 27, 28, 16, 4, 5, 6, 7, 16, 8, 10, 11, 4, 5, 6, 7, 9, 29, 30 }
Definition at line 246 of file parser.h.
Referenced by parse(), and yysyntax_error_().
int example::Parser::yydebug_ [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 233 of file parser.h.
Referenced by parse().
const signed char example::Parser::yydefgoto_ [static, private] |
const int example::Parser::yyempty_ = -2 [static, private] |
const int example::Parser::yyeof_ = 0 [static, private] |
const int example::Parser::yyerrcode_ = 256 [static, private] |
const int example::Parser::yyfinal_ = 2 [static, private] |
const int example::Parser::yylast_ = 42 [static, private] |
const int example::Parser::yynnts_ = 11 [static, private] |
const int example::Parser::yyntokens_ = 17 [static, private] |
const signed char example::Parser::yypact_ [static, private] |
Initial value:
{ -9, 2, -9, -9, -9, -9, 0, 24, 32, 32, -9, -9, -9, 31, -9, -9, 8, -7, 11, 16, 24, -9, 25, -9, -9, 32, 24, 24, 24, 24, 24, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 8, 8 }
Definition at line 227 of file parser.h.
Referenced by parse(), and yysyntax_error_().
const signed char example::Parser::yypact_ninf_ = -9 [static, private] |
const signed char example::Parser::yypgoto_ [static, private] |
const unsigned char example::Parser::yyprhs_[] [static, private] |
const unsigned char example::Parser::yyr1_ [static, private] |
const unsigned char example::Parser::yyr2_ [static, private] |
const rhs_number_type example::Parser::yyrhs_[] [static, private] |
const unsigned char example::Parser::yyrline_[] [static, private] |
const unsigned char example::Parser::yystos_ [static, private] |
const unsigned char example::Parser::yytable_ [static, private] |
Initial value:
{ 23, 24, 2, 29, 30, 3, 4, 5, 6, 7, 22, 31, 8, 9, 32, 20, 34, 39, 10, 35, 26, 27, 28, 37, 40, 41, 42, 33, 4, 5, 21, 7, 36, 38, 8, 9, 4, 5, 21, 7, 25, 43, 44 }
yytable_[yypact_[s]]: what to do in state s.
Definition at line 243 of file parser.h.
Referenced by parse().
const signed char example::Parser::yytable_ninf_ = -1 [static, private] |
const int example::Parser::yyterror_ = 1 [static, private] |
const char* const example::Parser::yytname_[] [static, private] |
For a symbol, its name in clear.
Definition at line 258 of file parser.h.
Referenced by yysyntax_error_().
const unsigned short int example::Parser::yytoken_number_[] [static, private] |
const Parser::token_number_type example::Parser::yyundef_token_ = 2 [static, private] |
const unsigned int example::Parser::yyuser_token_number_max_ = 261 [static, private] |