Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::detail::dot::parser Class Reference

A Bison parser. More...

#include <parse.hh>

Collaboration diagram for vcsn::detail::dot::parser:

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

typedef variant< sizeof(union_type)> semantic_type
 Symbol semantic values. More...
 
typedef vcsn::rat::location location_type
 Symbol locations. More...
 
typedef token::yytokentype token_type
 (External) token type, as returned by yylex. More...
 
typedef int symbol_number_type
 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_typesymbol_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...
 

Static Public Member Functions

static symbol_type make_END (const location_type &l)
 
static symbol_type make_DIGRAPH (const location_type &l)
 
static symbol_type make_EDGE (const location_type &l)
 
static symbol_type make_GRAPH (const location_type &l)
 
static symbol_type make_NODE (const location_type &l)
 
static symbol_type make_LBRACE (const location_type &l)
 
static symbol_type make_RBRACE (const location_type &l)
 
static symbol_type make_LBRACKET (const location_type &l)
 
static symbol_type make_RBRACKET (const location_type &l)
 
static symbol_type make_EQ (const location_type &l)
 
static symbol_type make_ARROW (const location_type &l)
 
static symbol_type make_COLON (const location_type &l)
 
static symbol_type make_COMMA (const location_type &l)
 
static symbol_type make_SEMI (const location_type &l)
 
static symbol_type make_ID (const string_t &v, const location_type &l)
 

Private Types

enum  {
  yyeof_ = 0, yylast_ = 68, yynnts_ = 20, yyempty_ = -2,
  yyfinal_ = 5, yyterror_ = 1, yyerrcode_ = 256, yyntokens_ = 18
}
 
typedef int state_type
 State numbers. More...
 
typedef stack< stack_symbol_typestack_type
 Stack type. More...
 

Private Member Functions

 parser (const parser &)
 This class is not copyable. More...
 
parseroperator= (const parser &)
 
virtual std::string yysyntax_error_ (state_type yystate, symbol_number_type yytoken) 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...
 
driverdriver_
 

Static Private Attributes

static const signed char yypact_ninf_ = -23
 
static const signed char yytable_ninf_ = -27
 
static const signed char yypact_ []
 
static const unsigned char yydefact_ []
 
static const signed char yypgoto_ []
 
static const signed char yydefgoto_ []
 
static const signed 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_ []
 

Detailed Description

A Bison parser.

Definition at line 306 of file parse.hh.

Member Typedef Documentation

Type for debugging levels.

Definition at line 544 of file parse.hh.

Symbol locations.

Definition at line 341 of file parse.hh.

Symbol semantic values.

Definition at line 336 of file parse.hh.

Stack type.

Definition at line 701 of file parse.hh.

State numbers.

Definition at line 565 of file parse.hh.

Internal symbol number.

Definition at line 377 of file parse.hh.

"External" symbols: returned by the scanner.

Definition at line 465 of file parse.hh.

Internal symbol number for tokens (subsumed by symbol_number_type).

Definition at line 380 of file parse.hh.

(External) token type, as returned by yylex.

Definition at line 374 of file parse.hh.

Member Enumeration Documentation

anonymous enum
private
Enumerator
yyeof_ 
yylast_ 

Last index in yytable_.

yynnts_ 

Number of nonterminal symbols.

yyempty_ 
yyfinal_ 

Termination state number.

yyterror_ 
yyerrcode_ 
yyntokens_ 

Number of tokens.

Definition at line 725 of file parse.hh.

Constructor & Destructor Documentation

vcsn::detail::dot::parser::parser ( driver driver__yyarg)

Build a parser object.

Definition at line 251 of file parse.cc.

vcsn::detail::dot::parser::~parser ( )
virtual

Definition at line 260 of file parse.cc.

vcsn::detail::dot::parser::parser ( const parser )
private

This class is not copyable.

Member Function Documentation

parser::debug_level_type vcsn::detail::dot::parser::debug_level ( ) const

The current debugging level.

Definition at line 559 of file parse.cc.

References yydebug_.

std::ostream & vcsn::detail::dot::parser::debug_stream ( ) const

The current debugging stream.

Definition at line 546 of file parse.cc.

References yycdebug_.

Referenced by yy_print_().

void vcsn::detail::dot::parser::error ( const location_type loc,
const std::string &  msg 
)
virtual

Report a syntax error.

Parameters
locwhere the syntax error is found.
msga description of the syntax error.

Definition at line 1425 of file parse.cc.

References driver_, and vcsn::detail::dot::driver::error().

Referenced by error(), and parse().

Here is the call graph for this function:

void vcsn::detail::dot::parser::error ( const syntax_error err)

Report a syntax error.

Definition at line 1159 of file parse.cc.

References error(), and vcsn::detail::dot::parser::syntax_error::location.

Here is the call graph for this function:

parser::symbol_type vcsn::detail::dot::parser::make_ARROW ( const location_type l)
inlinestatic

Definition at line 1109 of file parse.hh.

References vcsn::detail::dot::parser::token::ARROW.

parser::symbol_type vcsn::detail::dot::parser::make_COLON ( const location_type l)
inlinestatic

Definition at line 1115 of file parse.hh.

References vcsn::detail::dot::parser::token::COLON.

parser::symbol_type vcsn::detail::dot::parser::make_COMMA ( const location_type l)
inlinestatic

Definition at line 1121 of file parse.hh.

References vcsn::detail::dot::parser::token::COMMA.

parser::symbol_type vcsn::detail::dot::parser::make_DIGRAPH ( const location_type l)
inlinestatic

Definition at line 1055 of file parse.hh.

References vcsn::detail::dot::parser::token::DIGRAPH.

parser::symbol_type vcsn::detail::dot::parser::make_EDGE ( const location_type l)
inlinestatic

Definition at line 1061 of file parse.hh.

References vcsn::detail::dot::parser::token::EDGE.

parser::symbol_type vcsn::detail::dot::parser::make_END ( const location_type l)
inlinestatic

Definition at line 1049 of file parse.hh.

References vcsn::detail::dot::parser::token::END.

parser::symbol_type vcsn::detail::dot::parser::make_EQ ( const location_type l)
inlinestatic

Definition at line 1103 of file parse.hh.

References vcsn::detail::dot::parser::token::EQ.

parser::symbol_type vcsn::detail::dot::parser::make_GRAPH ( const location_type l)
inlinestatic

Definition at line 1067 of file parse.hh.

References vcsn::detail::dot::parser::token::GRAPH.

parser::symbol_type vcsn::detail::dot::parser::make_ID ( const string_t v,
const location_type l 
)
inlinestatic

Definition at line 1133 of file parse.hh.

References vcsn::detail::dot::parser::token::ID.

parser::symbol_type vcsn::detail::dot::parser::make_LBRACE ( const location_type l)
inlinestatic

Definition at line 1079 of file parse.hh.

References vcsn::detail::dot::parser::token::LBRACE.

parser::symbol_type vcsn::detail::dot::parser::make_LBRACKET ( const location_type l)
inlinestatic

Definition at line 1091 of file parse.hh.

References vcsn::detail::dot::parser::token::LBRACKET.

parser::symbol_type vcsn::detail::dot::parser::make_NODE ( const location_type l)
inlinestatic

Definition at line 1073 of file parse.hh.

References vcsn::detail::dot::parser::token::NODE.

parser::symbol_type vcsn::detail::dot::parser::make_RBRACE ( const location_type l)
inlinestatic

Definition at line 1085 of file parse.hh.

References vcsn::detail::dot::parser::token::RBRACE.

parser::symbol_type vcsn::detail::dot::parser::make_RBRACKET ( const location_type l)
inlinestatic

Definition at line 1097 of file parse.hh.

References vcsn::detail::dot::parser::token::RBRACKET.

parser::symbol_type vcsn::detail::dot::parser::make_SEMI ( const location_type l)
inlinestatic

Definition at line 1127 of file parse.hh.

References vcsn::detail::dot::parser::token::SEMI.

parser& vcsn::detail::dot::parser::operator= ( const parser )
private
int vcsn::detail::dot::parser::parse ( )
virtual
void vcsn::detail::dot::parser::set_debug_level ( debug_level_type  l)

Set the current debugging level.

Definition at line 565 of file parse.cc.

References yydebug_.

Referenced by vcsn::detail::dot::driver::parse().

void vcsn::detail::dot::parser::set_debug_stream ( std::ostream &  o)

Set the current debugging stream.

Definition at line 552 of file parse.cc.

References yycdebug_.

template<typename Base >
void vcsn::detail::dot::parser::yy_destroy_ ( const char yymsg,
basic_symbol< Base > &  yysym 
) const
inlineprivate

Reclaim the memory associated to a symbol.

Parameters
yymsgWhy this token is reclaimed. If null, print nothing.
yysymThe symbol.

Definition at line 387 of file parse.cc.

References YY_SYMBOL_PRINT.

Referenced by parse().

parser::state_type vcsn::detail::dot::parser::yy_lr_goto_state_ ( state_type  yystate,
int  yysym 
)
inlineprivate

Compute post-reduction state.

Parameters
yystatethe current state
yysymthe nonterminal to push on the stack

Definition at line 572 of file parse.cc.

References yycheck_, yydefgoto_, yylast_, yyntokens_, yypgoto_, and yytable_.

Referenced by parse().

bool vcsn::detail::dot::parser::yy_pact_value_is_default_ ( int  yyvalue)
inlinestaticprivate

Whether the given yypact_ value indicates a defaulted state.

Parameters
yyvaluethe value to check

Definition at line 582 of file parse.cc.

References yypact_ninf_.

Referenced by parse(), and yysyntax_error_().

template<typename Base >
void vcsn::detail::dot::parser::yy_print_ ( std::ostream &  yyo,
const basic_symbol< Base > &  yysym 
) const
private

Display a symbol type, value and location.

Parameters
yyoThe output stream.
yysymThe symbol.

Definition at line 396 of file parse.cc.

References debug_stream(), vcsn::detail::dot::parser::basic_symbol< Base >::location, vcsn::detail::dot::parser::basic_symbol< Base >::value, yyntokens_, yytname_, and YYUSE.

Here is the call graph for this function:

void vcsn::detail::dot::parser::yy_reduce_print_ ( int  r)
privatevirtual

Report on the debug stream that the rule r is going to be reduced.

Definition at line 1397 of file parse.cc.

References YY_SYMBOL_PRINT, yycdebug_, yyr2_, yyrline_, and yystack_.

bool vcsn::detail::dot::parser::yy_table_value_is_error_ ( int  yyvalue)
inlinestaticprivate

Whether the given yytable_ value indicates a syntax error.

Parameters
yyvaluethe value to check

Definition at line 588 of file parse.cc.

References yytable_ninf_.

Referenced by parse(), and yysyntax_error_().

void vcsn::detail::dot::parser::yypop_ ( unsigned int  n = 1)
inlineprivate

Pop n symbols the three stacks.

Definition at line 539 of file parse.cc.

References vcsn::detail::dot::stack< T, S >::pop(), and yystack_.

Referenced by parse().

Here is the call graph for this function:

void vcsn::detail::dot::parser::yypush_ ( const char m,
stack_symbol_type s 
)
inlineprivate

Push a new state on the stack.

Parameters
ma debug message to display if null, no trace is output.
sthe symbol
Warning
the contents of s.value is stolen.

Definition at line 530 of file parse.cc.

References vcsn::detail::dot::stack< T, S >::push(), YY_SYMBOL_PRINT, and yystack_.

Referenced by parse(), and yypush_().

Here is the call graph for this function:

void vcsn::detail::dot::parser::yypush_ ( const char m,
state_type  s,
symbol_type sym 
)
inlineprivate

Push a new look ahead token on the state on the stack.

Parameters
ma debug message to display if null, no trace is output.
sthe state
symthe symbol (for its value and location).
Warning
the contents of s.value is stolen.

Definition at line 522 of file parse.cc.

References yypush_().

Here is the call graph for this function:

void vcsn::detail::dot::parser::yystack_print_ ( )
privatevirtual

Print the state stack on the debug stream.

Definition at line 1384 of file parse.cc.

References vcsn::detail::dot::stack< T, S >::begin(), vcsn::detail::dot::stack< T, S >::end(), yycdebug_, and yystack_.

Here is the call graph for this function:

std::string vcsn::detail::dot::parser::yysyntax_error_ ( state_type  yystate,
symbol_number_type  yytoken 
) const
privatevirtual

Generate an error message.

Parameters
yystatethe state where the error occurred.
yytokenthe lookahead token type, or yyempty_.

Definition at line 1166 of file parse.cc.

References YY_, YY_NULLPTR, yy_pact_value_is_default_(), yy_table_value_is_error_(), YYCASE_, yycheck_, yyempty_, yylast_, yyntokens_, yypact_, yytable_, yyterror_, yytname_, and yytnamerr_().

Referenced by parse().

Here is the call graph for this function:

std::string vcsn::detail::dot::parser::yytnamerr_ ( const char n)
staticprivate

Convert the symbol name n to a form suitable for a diagnostic.

Definition at line 218 of file parse.cc.

Referenced by yysyntax_error_().

parser::token_number_type vcsn::detail::dot::parser::yytranslate_ ( token_type  t)
inlinestaticprivate

Convert a scanner token number t to a symbol number.

Definition at line 745 of file parse.hh.

References yyeof_.

Member Data Documentation

driver& vcsn::detail::dot::parser::driver_
private

Definition at line 739 of file parse.hh.

Referenced by error(), and parse().

std::ostream* vcsn::detail::dot::parser::yycdebug_
private

Definition at line 642 of file parse.hh.

Referenced by debug_stream(), set_debug_stream(), yy_reduce_print_(), and yystack_print_().

const signed char vcsn::detail::dot::parser::yycheck_
staticprivate
Initial value:
=
{
11, 22, 24, 4, 5, 6, 7, 8, 4, 5,
6, 7, 8, 7, 9, 16, 17, 12, 35, 36,
16, 17, 16, 17, 16, 4, 5, 6, 7, 8,
11, 9, 13, 55, 12, 56, 47, 16, 17, 8,
9, 10, 14, 15, 35, 36, 35, 36, 3, 0,
7, 9, 15, 12, 16, 16, 12, 7, 11, -1,
-1, 10, 16, -1, 16, 13, 13, 55, 14
}

Definition at line 613 of file parse.hh.

Referenced by parse(), yy_lr_goto_state_(), and yysyntax_error_().

int vcsn::detail::dot::parser::yydebug_
private

Definition at line 641 of file parse.hh.

Referenced by debug_level(), and set_debug_level().

const unsigned char vcsn::detail::dot::parser::yydefact_
staticprivate
Initial value:
=
{
0, 37, 0, 38, 0, 1, 3, 0, 0, 0,
0, 3, 2, 32, 37, 21, 7, 8, 0, 14,
6, 5, 14, 9, 23, 12, 10, 11, 0, 0,
0, 31, 0, 22, 4, 0, 0, 15, 29, 30,
0, 18, 24, 0, 36, 16, 33, 3, 32, 27,
25, 26, 28, 19, 20, 23, 14, 0, 0, 17,
13, 34, 35
}

Definition at line 600 of file parse.hh.

Referenced by parse().

const signed char vcsn::detail::dot::parser::yydefgoto_
staticprivate
Initial value:
=
{
-1, 2, 7, 15, 16, 37, 38, 17, 42, 55,
34, 43, 18, 19, 20, 21, 22, 31, 23, 4
}

Definition at line 606 of file parse.hh.

Referenced by yy_lr_goto_state_().

const signed char vcsn::detail::dot::parser::yypact_
staticprivate
Initial value:
=
{
45, 8, 49, -23, 43, -23, -23, -1, 42, 42,
42, -23, -23, 19, 8, 37, -23, -23, 41, 5,
-23, -23, 22, 44, 38, -23, -23, -23, 4, 39,
46, -23, 50, -23, -23, 6, 6, -23, -23, -23,
47, 28, -23, 51, -23, -23, 52, -23, 53, -23,
-23, -23, -23, -23, -23, 38, 42, 48, 21, -23,
-23, -23, -23
}

Definition at line 595 of file parse.hh.

Referenced by parse(), and yysyntax_error_().

const signed char vcsn::detail::dot::parser::yypact_ninf_ = -23
staticprivate

Definition at line 586 of file parse.hh.

Referenced by yy_pact_value_is_default_().

const signed char vcsn::detail::dot::parser::yypgoto_
staticprivate
Initial value:
=
{
-23, -23, -11, -23, -23, 31, -21, -22, -23, -23,
-23, 12, -17, -23, -23, -23, 9, -23, 11, 54
}

Definition at line 603 of file parse.hh.

Referenced by yy_lr_goto_state_().

const unsigned char vcsn::detail::dot::parser::yyr1_
staticprivate
Initial value:
=
{
0, 18, 19, 20, 20, 21, 21, 21, 21, 21,
22, 22, 22, 23, 24, 24, 25, 26, 27, 27,
27, 28, 28, 29, 29, 30, 30, 31, 31, 32,
33, 34, 35, 35, 35, 36, 36, 37, 37
}

Definition at line 620 of file parse.hh.

Referenced by parse().

const unsigned char vcsn::detail::dot::parser::yyr2_
staticprivate
Initial value:
=
{
0, 2, 5, 0, 3, 1, 1, 1, 1, 1,
2, 2, 2, 4, 0, 1, 3, 3, 0, 1,
1, 0, 1, 0, 1, 1, 1, 3, 3, 2,
2, 2, 0, 2, 4, 5, 3, 0, 1
}

Definition at line 623 of file parse.hh.

Referenced by parse(), and yy_reduce_print_().

const unsigned short int vcsn::detail::dot::parser::yyrline_
staticprivate
Initial value:
=
{
0, 184, 184, 188, 189, 199, 200, 201, 202, 203,
207, 208, 209, 213, 222, 223, 227, 242, 249, 249,
249, 253, 254, 259, 260, 264, 265, 283, 290, 301,
309, 316, 337, 338, 339, 343, 344, 348, 349
}

Definition at line 634 of file parse.hh.

Referenced by yy_reduce_print_().

stack_type vcsn::detail::dot::parser::yystack_
private

The stack.

Definition at line 704 of file parse.hh.

Referenced by parse(), yy_reduce_print_(), yypop_(), yypush_(), and yystack_print_().

const unsigned char vcsn::detail::dot::parser::yystos_
staticprivate
Initial value:
=
{
0, 3, 19, 16, 37, 0, 7, 20, 4, 5,
6, 7, 8, 16, 17, 21, 22, 25, 30, 31,
32, 33, 34, 36, 9, 23, 23, 23, 20, 11,
13, 35, 37, 15, 28, 12, 12, 23, 24, 24,
16, 25, 26, 29, 8, 16, 16, 7, 16, 30,
34, 36, 30, 14, 15, 27, 10, 13, 20, 29,
24, 16, 8
}

Definition at line 617 of file parse.hh.

Referenced by vcsn::detail::dot::parser::by_state::type_get().

const signed char vcsn::detail::dot::parser::yytable_
staticprivate
Initial value:
=
{
28, 39, 41, 8, 9, 10, 11, 12, 8, 9,
10, 11, 44, 11, 24, 13, 14, 36, 49, 52,
13, 14, 48, 14, 3, 8, 9, 10, 11, 62,
29, 24, 30, 41, -25, 60, 58, 13, 14, 25,
26, 27, 53, 54, 50, 50, 51, 51, 1, 5,
6, 24, 33, 35, 40, 45, -26, 47, 29, 0,
0, 56, 46, 0, 61, 57, 30, 59, 32
}

Definition at line 611 of file parse.hh.

Referenced by parse(), yy_lr_goto_state_(), and yysyntax_error_().

const signed char vcsn::detail::dot::parser::yytable_ninf_ = -27
staticprivate

Definition at line 587 of file parse.hh.

Referenced by yy_table_value_is_error_().

const char *const vcsn::detail::dot::parser::yytname_
staticprivate
Initial value:
=
{
"END", "error", "$undefined", "\"digraph\"", "\"edge\"", "\"graph\"",
"\"node\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\"=\"", "\"->\"",
"\":\"", "\",\"", "\";\"", "ID", "\"subgraph\"", "$accept", "graph",
"stmt_list", "stmt", "attr_stmt", "attr_list", "attr_list.opt",
"attr_assign", "a_list.1", "comma.opt", "semi.opt", "a_list.0", "nodes",
"path", "edge_stmt", "node_stmt", "node_id", "port.opt", "subgraph",
"id.opt", 0
}

For a symbol, its name in clear.

Definition at line 631 of file parse.hh.

Referenced by yy_print_(), and yysyntax_error_().


The documentation for this class was generated from the following files: