![]() |
Vcsn
2.8
Be Rational
|
A Bison parser. More...
#include <parse.hh>
Classes | |
struct | basic_symbol |
A complete symbol. More... | |
struct | by_state |
Type access provider for state based symbols. More... | |
struct | by_type |
Type access provider for token (enum) based symbols. More... | |
struct | stack_symbol_type |
"Internal" symbol: element of the stack. More... | |
struct | syntax_error |
Syntax errors thrown from user actions. More... | |
struct | token |
Tokens. More... | |
union | union_type |
An auxiliary type to compute the largest semantic type. More... | |
Public Types | |
enum | { empty_symbol = -2 } |
The symbol type number to denote an empty symbol. More... | |
typedef variant< sizeof(union_type)> | semantic_type |
Symbol semantic values. More... | |
typedef location | location_type |
Symbol locations. More... | |
typedef token::yytokentype | token_type |
(External) token type, as returned by yylex. More... | |
typedef int | symbol_number_type |
Symbol type: an internal symbol number. More... | |
typedef unsigned char | token_number_type |
Internal symbol number for tokens (subsumed by symbol_number_type). More... | |
typedef basic_symbol< by_type > | symbol_type |
"External" symbols: returned by the scanner. More... | |
typedef int | debug_level_type |
Type for debugging levels. More... | |
Public Member Functions | |
parser (driver &driver__yyarg) | |
Build a parser object. More... | |
virtual | ~parser () |
virtual int | parse () |
Parse. More... | |
std::ostream & | debug_stream () const |
The current debugging stream. More... | |
void | set_debug_stream (std::ostream &) |
Set the current debugging stream. More... | |
debug_level_type | debug_level () const |
The current debugging level. More... | |
void | set_debug_level (debug_level_type l) |
Set the current debugging level. More... | |
virtual void | error (const location_type &loc, const std::string &msg) |
Report a syntax error. More... | |
void | error (const syntax_error &err) |
Report a syntax error. More... | |
Private Types | |
enum | { yyeof_ = 0, yylast_ = 227, yynnts_ = 11, yyfinal_ = 5, yyterror_ = 1, yyerrcode_ = 256, yyntokens_ = 33 } |
Constants. More... | |
typedef int | state_type |
State numbers. More... | |
typedef stack< stack_symbol_type > | stack_type |
Stack type. More... | |
Private Member Functions | |
parser (const parser &) | |
This class is not copyable. More... | |
parser & | operator= (const parser &) |
virtual std::string | yysyntax_error_ (state_type yystate, const symbol_type &yyla) const |
Generate an error message. More... | |
state_type | yy_lr_goto_state_ (state_type yystate, int yysym) |
Compute post-reduction state. More... | |
virtual void | yy_reduce_print_ (int r) |
Report on the debug stream that the rule r is going to be reduced. More... | |
virtual void | yystack_print_ () |
Print the state stack on the debug stream. More... | |
template<typename Base > | |
void | yy_print_ (std::ostream &yyo, const basic_symbol< Base > &yysym) const |
Display a symbol type, value and location. More... | |
template<typename Base > | |
void | yy_destroy_ (const char *yymsg, basic_symbol< Base > &yysym) const |
Reclaim the memory associated to a symbol. More... | |
void | yypush_ (const char *m, stack_symbol_type &s) |
Push a new state on the stack. More... | |
void | yypush_ (const char *m, state_type s, symbol_type &sym) |
Push a new look ahead token on the state on the stack. More... | |
void | yypop_ (unsigned int n=1) |
Pop n symbols the three stacks. More... | |
Static Private Member Functions | |
static bool | yy_pact_value_is_default_ (int yyvalue) |
Whether the given yypact_ value indicates a defaulted state. More... | |
static bool | yy_table_value_is_error_ (int yyvalue) |
Whether the given yytable_ value indicates a syntax error. More... | |
static token_number_type | yytranslate_ (token_type t) |
Convert a scanner token number t to a symbol number. More... | |
static std::string | yytnamerr_ (const char *n) |
Convert the symbol name n to a form suitable for a diagnostic. More... | |
Private Attributes | |
int | yydebug_ |
std::ostream * | yycdebug_ |
stack_type | yystack_ |
The stack. More... | |
driver & | driver_ |
Static Private Attributes | |
static const signed char | yypact_ninf_ = -17 |
static const signed char | yytable_ninf_ = -1 |
static const short int | yypact_ [] |
static const unsigned char | yydefact_ [] |
static const signed char | yypgoto_ [] |
static const signed char | yydefgoto_ [] |
static const unsigned char | yytable_ [] |
static const signed char | yycheck_ [] |
static const unsigned char | yystos_ [] |
static const unsigned char | yyr1_ [] |
static const unsigned char | yyr2_ [] |
static const char *const | yytname_ [] |
For a symbol, its name in clear. More... | |
static const unsigned short int | yyrline_ [] |
typedef int vcsn::rat::parser::debug_level_type |
typedef variant<sizeof(union_type)> vcsn::rat::parser::semantic_type |
|
private |
|
private |
typedef int vcsn::rat::parser::symbol_number_type |
typedef unsigned char vcsn::rat::parser::token_number_type |
anonymous enum |
|
private |
vcsn::rat::parser::parser | ( | driver & | driver__yyarg | ) |
|
private |
This class is not copyable.
parser::debug_level_type vcsn::rat::parser::debug_level | ( | ) | const |
std::ostream & vcsn::rat::parser::debug_stream | ( | ) | const |
|
virtual |
void vcsn::rat::parser::error | ( | const syntax_error & | err | ) |
Report a syntax error.
Definition at line 1212 of file parse.cc.
References error(), and vcsn::rat::parser::syntax_error::location.
|
inlinestatic |
Definition at line 1243 of file parse.hh.
References vcsn::rat::parser::token::AMPERSAND.
|
inlinestatic |
Definition at line 1249 of file parse.hh.
References vcsn::rat::parser::token::AMPERSAND_COLON.
|
inlinestatic |
Definition at line 1255 of file parse.hh.
References vcsn::rat::parser::token::AT.
|
inlinestatic |
Definition at line 1261 of file parse.hh.
References vcsn::rat::parser::token::BACKSLASH.
|
inlinestatic |
Definition at line 1267 of file parse.hh.
References vcsn::rat::parser::token::BANG.
|
inlinestatic |
Definition at line 1273 of file parse.hh.
References vcsn::rat::parser::token::CARET.
|
inlinestatic |
Definition at line 1279 of file parse.hh.
References vcsn::rat::parser::token::COLON.
|
inlinestatic |
Definition at line 1285 of file parse.hh.
References vcsn::rat::parser::token::COMMA.
|
inlinestatic |
Definition at line 1291 of file parse.hh.
References vcsn::rat::parser::token::COMPLEMENT.
|
inlinestatic |
Definition at line 1405 of file parse.hh.
References vcsn::rat::parser::token::CONCAT.
|
inlinestatic |
Definition at line 1297 of file parse.hh.
References vcsn::rat::parser::token::DASH.
|
inlinestatic |
Definition at line 1303 of file parse.hh.
References vcsn::rat::parser::token::DOT.
|
inlinestatic |
Definition at line 1237 of file parse.hh.
References vcsn::rat::parser::token::END.
|
inlinestatic |
Definition at line 1309 of file parse.hh.
References vcsn::rat::parser::token::LBRACKET.
|
inlinestatic |
Definition at line 1387 of file parse.hh.
References vcsn::rat::parser::token::LETTER.
|
inlinestatic |
Definition at line 1399 of file parse.hh.
References vcsn::rat::parser::token::LPAREN.
|
inlinestatic |
Definition at line 1315 of file parse.hh.
References vcsn::rat::parser::token::LT_PLUS.
|
inlinestatic |
Definition at line 1417 of file parse.hh.
References vcsn::rat::parser::token::LWEIGHT.
|
inlinestatic |
Definition at line 1321 of file parse.hh.
References vcsn::rat::parser::token::ONE.
|
inlinestatic |
Definition at line 1327 of file parse.hh.
References vcsn::rat::parser::token::PERCENT.
|
inlinestatic |
Definition at line 1333 of file parse.hh.
References vcsn::rat::parser::token::PIPE.
|
inlinestatic |
Definition at line 1339 of file parse.hh.
References vcsn::rat::parser::token::PLUS.
|
inlinestatic |
Definition at line 1345 of file parse.hh.
References vcsn::rat::parser::token::RBRACKET.
|
inlinestatic |
Definition at line 1351 of file parse.hh.
References vcsn::rat::parser::token::RPAREN.
|
inlinestatic |
Definition at line 1411 of file parse.hh.
References vcsn::rat::parser::token::RWEIGHT.
|
inlinestatic |
Definition at line 1357 of file parse.hh.
References vcsn::rat::parser::token::SLASH.
|
inlinestatic |
Definition at line 1381 of file parse.hh.
References vcsn::rat::parser::token::STAR.
|
inlinestatic |
Definition at line 1369 of file parse.hh.
References vcsn::rat::parser::token::TRANSPOSE.
|
inlinestatic |
Definition at line 1363 of file parse.hh.
References vcsn::rat::parser::token::TRANSPOSITION.
|
inlinestatic |
Definition at line 1393 of file parse.hh.
References vcsn::rat::parser::token::WEIGHT.
|
inlinestatic |
Definition at line 1375 of file parse.hh.
References vcsn::rat::parser::token::ZERO.
|
virtual |
Parse.
Length of the RHS of the rule being reduced.
The lookahead symbol.
The locations where the error started and ended.
The return value of parse ().
Definition at line 598 of file parse.cc.
References vcsn::rat::add, vcsn::dyn::value_impl< Tag >::as(), vcsn::detail::dot::variant< S >::as(), vcsn::detail::back(), vcsn::detail::dot::variant< S >::build(), vcsn::rat::stack< T, S >::clear(), vcsn::rat::parser::basic_symbol< Base >::clear(), vcsn::rat::complement, vcsn::rat::compose, vcsn::dyn::concatenate(), vcsn::rat::conjunction, vcsn::dyn::detail::context_of(), vcsn::rat::copy(), vcsn::rat::ctx(), vcsn::rat::driver::ctx_, vcsn::rat::driver::debug_level(), driver_, vcsn::rat::parser::basic_symbol< Base >::empty(), error(), vcsn::rat::braced_expression::exp, vcsn::dyn::expression_one(), vcsn::dyn::expression_zero(), vcsn::rat::ids(), vcsn::rat::driver::ids_, vcsn::rat::infiltrate, vcsn::rat::ldivide, vcsn::rat::location::location(), vcsn::rat::parser::basic_symbol< Base >::location, vcsn::rat::driver::location_, vcsn::rat::braced_expression::lparen, vcsn::rat::lweight, vcsn::rat::driver::make_atom(), vcsn::rat::driver::make_expression(), vcsn::rat::driver::make_weight(), vcsn::rat::parser::basic_symbol< Base >::move(), vcsn::dyn::multiply(), vcsn::rat::name, vcsn::rat::prefer(), vcsn::dyn::rdivide(), vcsn::rat::driver::result_, vcsn::rat::braced_expression::rparen, vcsn::rat::rweight, vcsn::rat::driver::scanner_, vcsn::rat::shuffle, vcsn::rat::stack< T, S >::size(), vcsn::rat::parser::by_state::state, vcsn::rat::driver::tape_ctx_, vcsn::rat::driver::tape_inc(), vcsn::rat::driver::tape_pop(), vcsn::rat::driver::tape_push(), vcsn::rat::to_string(), vcsn::dyn::transpose(), vcsn::rat::transposition, TRY, vcsn::dyn::tuple(), vcsn::rat::parser::basic_symbol< by_state >::value, vcsn::rat::parser::basic_symbol< Base >::value, yy_destroy_(), yy_lr_goto_state_(), YY_NULLPTR, yy_pact_value_is_default_(), YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, yy_table_value_is_error_(), YYABORT, YYACCEPT, YYCDEBUG, yycheck_, yydefact_, yyeof_, YYERROR, yyfinal_, yylast_, vcsn::rat::yylex(), YYLLOC_DEFAULT, yypact_, yypop_(), yypush_(), yyr1_, yyr2_, yystack_, yysyntax_error_(), yytable_, and yyterror_.
void vcsn::rat::parser::set_debug_level | ( | debug_level_type | l | ) |
void vcsn::rat::parser::set_debug_stream | ( | std::ostream & | o | ) |
|
inlineprivate |
Reclaim the memory associated to a symbol.
yymsg | Why this token is reclaimed. If null, print nothing. |
yysym | The symbol. |
Definition at line 394 of file parse.cc.
References YY_SYMBOL_PRINT.
Referenced by parse().
|
inlineprivate |
Compute post-reduction state.
yystate | the current state |
yysym | the nonterminal to push on the stack |
Definition at line 576 of file parse.cc.
References yycheck_, yydefgoto_, yylast_, yyntokens_, yypgoto_, and yytable_.
Referenced by parse().
|
inlinestaticprivate |
Whether the given yypact_
value indicates a defaulted state.
yyvalue | the value to check |
Definition at line 586 of file parse.cc.
References yypact_ninf_.
Referenced by parse(), and yysyntax_error_().
|
private |
Display a symbol type, value and location.
yyo | The output stream. |
yysym | The symbol. |
Definition at line 403 of file parse.cc.
References vcsn::rat::parser::basic_symbol< Base >::empty(), vcsn::rat::parser::basic_symbol< Base >::location, vcsn::dyn::print(), vcsn::rat::parser::basic_symbol< Base >::value, yyntokens_, yytname_, and YYUSE.
|
privatevirtual |
|
inlinestaticprivate |
Whether the given yytable_
value indicates a syntax error.
yyvalue | the value to check |
Definition at line 592 of file parse.cc.
References yytable_ninf_.
Referenced by parse(), and yysyntax_error_().
|
inlineprivate |
Pop n symbols the three stacks.
Definition at line 543 of file parse.cc.
References vcsn::rat::stack< T, S >::pop(), and yystack_.
Referenced by parse().
|
inlineprivate |
Push a new state on the stack.
m | a debug message to display if null, no trace is output. |
s | the symbol |
Definition at line 534 of file parse.cc.
References vcsn::rat::stack< T, S >::push(), YY_SYMBOL_PRINT, and yystack_.
Referenced by parse(), and yypush_().
|
inlineprivate |
Push a new look ahead token on the state on the stack.
m | a debug message to display if null, no trace is output. |
s | the state |
sym | the symbol (for its value and location). |
Definition at line 526 of file parse.cc.
References yypush_().
|
privatevirtual |
Print the state stack on the debug stream.
Definition at line 1473 of file parse.cc.
References vcsn::rat::stack< T, S >::begin(), vcsn::rat::stack< T, S >::end(), yycdebug_, and yystack_.
|
privatevirtual |
Generate an error message.
yystate | the state where the error occurred. |
yyla | the lookahead token. |
Definition at line 1219 of file parse.cc.
References vcsn::rat::parser::basic_symbol< Base >::empty(), YY_, YY_NULLPTR, yy_pact_value_is_default_(), yy_table_value_is_error_(), YYCASE_, yycheck_, yydefact_, yydefgoto_, yylast_, yyntokens_, yypact_, yypact_ninf_, yypgoto_, yyr1_, yyr2_, yyrline_, yystos_, yytable_, yytable_ninf_, yyterror_, yytname_, and yytnamerr_().
Referenced by parse().
|
staticprivate |
Convert the symbol name n to a form suitable for a diagnostic.
Definition at line 199 of file parse.cc.
Referenced by yysyntax_error_().
|
inlinestaticprivate |
|
private |
|
private |
Definition at line 739 of file parse.hh.
Referenced by debug_stream(), set_debug_stream(), yy_reduce_print_(), and yystack_print_().
|
staticprivate |
Definition at line 710 of file parse.hh.
Referenced by parse(), yy_lr_goto_state_(), and yysyntax_error_().
|
private |
Definition at line 738 of file parse.hh.
Referenced by debug_level(), and set_debug_level().
|
staticprivate |
Definition at line 697 of file parse.hh.
Referenced by parse(), and yysyntax_error_().
|
staticprivate |
Definition at line 703 of file parse.hh.
Referenced by yy_lr_goto_state_(), and yysyntax_error_().
|
staticprivate |
Definition at line 692 of file parse.hh.
Referenced by parse(), and yysyntax_error_().
|
staticprivate |
Definition at line 683 of file parse.hh.
Referenced by yy_pact_value_is_default_(), and yysyntax_error_().
|
staticprivate |
Definition at line 700 of file parse.hh.
Referenced by yy_lr_goto_state_(), and yysyntax_error_().
|
staticprivate |
Definition at line 717 of file parse.hh.
Referenced by parse(), and yysyntax_error_().
|
staticprivate |
Definition at line 720 of file parse.hh.
Referenced by parse(), yy_reduce_print_(), and yysyntax_error_().
|
staticprivate |
Definition at line 731 of file parse.hh.
Referenced by yy_reduce_print_(), and yysyntax_error_().
|
private |
The stack.
Definition at line 806 of file parse.hh.
Referenced by parse(), yy_reduce_print_(), yypop_(), yypush_(), and yystack_print_().
|
staticprivate |
Definition at line 714 of file parse.hh.
Referenced by vcsn::rat::parser::by_state::type_get(), and yysyntax_error_().
|
staticprivate |
Definition at line 708 of file parse.hh.
Referenced by parse(), yy_lr_goto_state_(), and yysyntax_error_().
|
staticprivate |
Definition at line 684 of file parse.hh.
Referenced by yy_table_value_is_error_(), and yysyntax_error_().
|
staticprivate |
For a symbol, its name in clear.
Definition at line 728 of file parse.hh.
Referenced by yy_print_(), and yysyntax_error_().