Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
yy::parser Class Reference

A Bison parser. More...

#include <evalexpr_parser.h>

Classes

union  semantic_type
 Symbol semantic values. More...
 
struct  token
 Tokens. More...
 

Public Types

typedef location location_type
 Symbol locations. More...
 
typedef token::yytokentype token_type
 Token type. More...
 
typedef int debug_level_type
 Type for debugging levels. More...
 

Public Member Functions

 parser (EvalExpr &driver_yyarg)
 Build a parser object. More...
 
virtual ~parser ()
 
virtual int parse ()
 
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...
 

Private Types

typedef int state_type
 State numbers. More...
 
typedef stack< state_typestate_stack_type
 State stack type. More...
 
typedef stack< semantic_typesemantic_stack_type
 Semantic value stack type. More...
 
typedef stack< location_typelocation_stack_type
 location stack type. More...
 
typedef unsigned char token_number_type
 Internal symbol numbers. More...
 
typedef signed char rhs_number_type
 A type to store symbol numbers and -1. More...
 

Private Member Functions

virtual void error (const location_type &loc, const std::string &msg)
 
virtual std::string yysyntax_error_ (int yystate, int tok)
 
virtual void yy_symbol_value_print_ (int yytype, const semantic_type *yyvaluep, const location_type *yylocationp)
 Report a symbol value on the debug stream. More...
 
virtual void yy_symbol_print_ (int yytype, const semantic_type *yyvaluep, const location_type *yylocationp)
 Report a symbol on the debug stream. 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...
 
token_number_type yytranslate_ (int t)
 Convert a scanner token number t to a symbol number. More...
 
void yydestruct_ (const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
 Reclaim the memory associated to a symbol. 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)
 
static bool yy_table_value_is_error_ (int yyvalue)
 
static std::string yytnamerr_ (const char *n)
 Convert the symbol name n to a form suitable for a diagnostic. More...
 

Private Attributes

state_stack_type yystate_stack_
 The state stack. More...
 
semantic_stack_type yysemantic_stack_
 The semantic value stack. More...
 
location_stack_type yylocation_stack_
 The location stack. More...
 
int yydebug_
 
std::ostream * yycdebug_
 
EvalExprdriver
 

Static Private Attributes

static const signed char yypact_ []
 For a state, the index in yytable_ of its portion. More...
 
static const signed char yypact_ninf_ = -11
 
static const unsigned char yydefact_ []
 
static const signed char yypgoto_ []
 
static const signed char yydefgoto_ []
 
static const unsigned char yytable_ []
 
static const signed char yytable_ninf_ = -1
 
static const signed char yycheck_ []
 
static const unsigned char yystos_ []
 For a state, its accessing symbol. More...
 
static const unsigned char yyr1_ []
 For a rule, its LHS. More...
 
static const unsigned char yyr2_ []
 For a rule, its RHS length. More...
 
static const char *const yytname_ []
 For a symbol, its name in clear. More...
 
static const rhs_number_type yyrhs_ []
 A `-1'-separated list of the rules' RHS. More...
 
static const unsigned char yyprhs_ []
 For each rule, the index of the first RHS symbol in yyrhs_. More...
 
static const unsigned char yyrline_ []
 For each rule, its source line number. More...
 
static const unsigned short int yytoken_number_ []
 For each scanner token number, its symbol number. More...
 
static const int yyeof_ = 0
 
static const int yylast_ = 42
 
static const int yynnts_ = 3
 
static const int yyempty_ = -2
 
static const int yyfinal_ = 12
 
static const int yyterror_ = 1
 
static const int yyerrcode_ = 256
 
static const int yyntokens_ = 15
 
static const unsigned int yyuser_token_number_max_ = 262
 
static const token_number_type yyundef_token_ = 2
 

Detailed Description

A Bison parser.

Definition at line 74 of file evalexpr_parser.h.

Member Typedef Documentation

Type for debugging levels.

Definition at line 128 of file evalexpr_parser.h.

location stack type.

Definition at line 173 of file evalexpr_parser.h.

Symbol locations.

Definition at line 95 of file evalexpr_parser.h.

typedef signed char yy::parser::rhs_number_type
private

A type to store symbol numbers and -1.

Definition at line 231 of file evalexpr_parser.h.

Semantic value stack type.

Definition at line 171 of file evalexpr_parser.h.

State stack type.

Definition at line 169 of file evalexpr_parser.h.

typedef int yy::parser::state_type
private

State numbers.

Definition at line 167 of file evalexpr_parser.h.

typedef unsigned char yy::parser::token_number_type
private

Internal symbol numbers.

Definition at line 191 of file evalexpr_parser.h.

Token type.

Definition at line 110 of file evalexpr_parser.h.

Constructor & Destructor Documentation

yy::parser::parser ( EvalExpr driver_yyarg)

Build a parser object.

Definition at line 201 of file evalexpr_parser.cpp.

yy::parser::~parser ( )
virtual

Definition at line 212 of file evalexpr_parser.cpp.

Member Function Documentation

parser::debug_level_type yy::parser::debug_level ( ) const

The current debugging level.

Definition at line 335 of file evalexpr_parser.cpp.

std::ostream & yy::parser::debug_stream ( ) const

The current debugging stream.

Definition at line 321 of file evalexpr_parser.cpp.

void yy::parser::error ( const location_type loc,
const std::string &  msg 
)
privatevirtual

Report a syntax error.

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

Definition at line 1161 of file evalexpr_parser.cpp.

int yy::parser::parse ( )
virtual

Parse.

Returns
0 iff parsing succeeded.

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 363 of file evalexpr_parser.cpp.

void yy::parser::set_debug_level ( debug_level_type  l)

Set the current debugging level.

Definition at line 342 of file evalexpr_parser.cpp.

void yy::parser::set_debug_stream ( std::ostream &  o)

Set the current debugging stream.

Definition at line 328 of file evalexpr_parser.cpp.

bool yy::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 349 of file evalexpr_parser.cpp.

void yy::parser::yy_reduce_print_ ( int  r)
privatevirtual

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

Definition at line 1077 of file evalexpr_parser.cpp.

void yy::parser::yy_symbol_print_ ( int  yytype,
const semantic_type yyvaluep,
const location_type yylocationp 
)
privatevirtual

Report a symbol on the debug stream.

Parameters
yytypeThe token type.
yyvaluepIts semantic value.
yylocationpIts location.

Definition at line 270 of file evalexpr_parser.cpp.

void yy::parser::yy_symbol_value_print_ ( int  yytype,
const semantic_type yyvaluep,
const location_type yylocationp 
)
inlineprivatevirtual

Report a symbol value on the debug stream.

Parameters
yytypeThe token type.
yyvaluepIts semantic value.
yylocationpIts location.

Definition at line 223 of file evalexpr_parser.cpp.

bool yy::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 356 of file evalexpr_parser.cpp.

void yy::parser::yydestruct_ ( const char *  yymsg,
int  yytype,
semantic_type yyvaluep,
location_type yylocationp 
)
inlineprivate

Reclaim the memory associated to a symbol.

Parameters
yymsgWhy this token is reclaimed. If null, do not display the symbol, just free it.
yytypeThe symbol type.
yyvaluepIts semantic value.
yylocationpIts location.

Definition at line 282 of file evalexpr_parser.cpp.

void yy::parser::yypop_ ( unsigned int  n = 1)
inlineprivate

Pop n symbols the three stacks.

Definition at line 311 of file evalexpr_parser.cpp.

void yy::parser::yystack_print_ ( )
privatevirtual

Print the state stack on the debug stream.

Definition at line 1064 of file evalexpr_parser.cpp.

std::string yy::parser::yysyntax_error_ ( int  yystate,
int  tok 
)
privatevirtual

Generate an error message.

Parameters
statethe state where the error occurred.
tokthe lookahead token.

Definition at line 825 of file evalexpr_parser.cpp.

std::string yy::parser::yytnamerr_ ( const char *  n)
staticprivate

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

Definition at line 166 of file evalexpr_parser.cpp.

parser::token_number_type yy::parser::yytranslate_ ( int  t)
private

Convert a scanner token number t to a symbol number.

Definition at line 1097 of file evalexpr_parser.cpp.

Member Data Documentation

EvalExpr& yy::parser::driver
private

Definition at line 282 of file evalexpr_parser.h.

std::ostream* yy::parser::yycdebug_
private

Definition at line 248 of file evalexpr_parser.h.

const signed char yy::parser::yycheck_
staticprivate
Initial value:
=
{
3, 4, 5, 13, 0, 8, 4, 5, 6, 7,
13, 14, 15, 16, 17, 13, 6, 7, 8, 9,
12, -1, 12, -1, 14, 6, 7, 8, 9, -1,
-1, 12, -1, 14, 6, 7, 8, 9, 8, 9,
12, -1, 12
}

Definition at line 213 of file evalexpr_parser.h.

int yy::parser::yydebug_
private

Definition at line 247 of file evalexpr_parser.h.

const unsigned char yy::parser::yydefact_
staticprivate
Initial value:
=
{
2, 5, 4, 0, 0, 0, 0, 3, 0, 12,
11, 0, 1, 0, 0, 0, 0, 0, 0, 14,
8, 7, 9, 10, 13, 6
}

For a state, default reduction number. Unlessyytable_ specifies something else to do. Zero means the default is an error.

Definition at line 200 of file evalexpr_parser.h.

const signed char yy::parser::yydefgoto_
staticprivate
Initial value:
=
{
-1, 6, 7
}

Definition at line 203 of file evalexpr_parser.h.

const int yy::parser::yyempty_ = -2
staticprivate

Definition at line 273 of file evalexpr_parser.h.

const int yy::parser::yyeof_ = 0
staticprivate

Definition at line 269 of file evalexpr_parser.h.

const int yy::parser::yyerrcode_ = 256
staticprivate

Definition at line 276 of file evalexpr_parser.h.

const int yy::parser::yyfinal_ = 12
staticprivate

Definition at line 274 of file evalexpr_parser.h.

const int yy::parser::yylast_ = 42
staticprivate

Definition at line 271 of file evalexpr_parser.h.

location_stack_type yy::parser::yylocation_stack_
private

The location stack.

Definition at line 180 of file evalexpr_parser.h.

const int yy::parser::yynnts_ = 3
staticprivate

Definition at line 272 of file evalexpr_parser.h.

const int yy::parser::yyntokens_ = 15
staticprivate

Definition at line 277 of file evalexpr_parser.h.

const signed char yy::parser::yypact_
staticprivate
Initial value:
=
{
2, -10, -11, 2, 2, 2, 4, 28, 2, 8,
8, 10, -11, 2, 2, 2, 2, 2, 19, -11,
30, 30, 8, 8, 8, -11
}

For a state, the index in yytable_ of its portion.

Definition at line 194 of file evalexpr_parser.h.

const signed char yy::parser::yypact_ninf_ = -11
staticprivate

Definition at line 195 of file evalexpr_parser.h.

const signed char yy::parser::yypgoto_
staticprivate
Initial value:
=
{
-11, -11, -3
}

Definition at line 202 of file evalexpr_parser.h.

const unsigned char yy::parser::yyprhs_
staticprivate
Initial value:
=
{
0, 0, 3, 4, 6, 8, 10, 15, 19, 23,
27, 31, 34, 37, 41
}

For each rule, the index of the first RHS symbol in yyrhs_.

Definition at line 235 of file evalexpr_parser.h.

const unsigned char yy::parser::yyr1_
staticprivate
Initial value:
=
{
0, 15, 16, 16, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17
}

For a rule, its LHS.

Definition at line 219 of file evalexpr_parser.h.

const unsigned char yy::parser::yyr2_
staticprivate
Initial value:
=
{
0, 2, 0, 1, 1, 1, 4, 3, 3, 3,
3, 2, 2, 3, 3
}

For a rule, its RHS length.

Definition at line 221 of file evalexpr_parser.h.

const parser::rhs_number_type yy::parser::yyrhs_
staticprivate
Initial value:
=
{
16, 0, -1, -1, 17, -1, 5, -1, 4, -1,
4, 13, 17, 14, -1, 17, 7, 17, -1, 17,
6, 17, -1, 17, 8, 17, -1, 17, 9, 17,
-1, 7, 17, -1, 6, 17, -1, 17, 12, 17,
-1, 13, 17, 14, -1
}

A `-1'-separated list of the rules' RHS.

Definition at line 233 of file evalexpr_parser.h.

const unsigned char yy::parser::yyrline_
staticprivate
Initial value:
=
{
0, 48, 48, 49, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61
}

For each rule, its source line number.

Definition at line 237 of file evalexpr_parser.h.

semantic_stack_type yy::parser::yysemantic_stack_
private

The semantic value stack.

Definition at line 178 of file evalexpr_parser.h.

state_stack_type yy::parser::yystate_stack_
private

The state stack.

Definition at line 176 of file evalexpr_parser.h.

const unsigned char yy::parser::yystos_
staticprivate
Initial value:
=
{
0, 4, 5, 6, 7, 13, 16, 17, 13, 17,
17, 17, 0, 6, 7, 8, 9, 12, 17, 14,
17, 17, 17, 17, 17, 14
}

For a state, its accessing symbol.

Definition at line 216 of file evalexpr_parser.h.

const unsigned char yy::parser::yytable_
staticprivate
Initial value:
=
{
9, 10, 11, 8, 12, 18, 1, 2, 3, 4,
20, 21, 22, 23, 24, 5, 13, 14, 15, 16,
17, 0, 17, 0, 19, 13, 14, 15, 16, 0,
0, 17, 0, 25, 13, 14, 15, 16, 15, 16,
17, 0, 17
}

What to do in a state. yytable_[yypact_[s]]: what to do in state s.

  • if positive, shift that token.
  • if negative, reduce the rule which number is the opposite.
  • if zero, do what YYDEFACT says.

Definition at line 210 of file evalexpr_parser.h.

const signed char yy::parser::yytable_ninf_ = -1
staticprivate

Definition at line 211 of file evalexpr_parser.h.

const int yy::parser::yyterror_ = 1
staticprivate

Definition at line 275 of file evalexpr_parser.h.

const char *const yy::parser::yytname_
staticprivate
Initial value:
=
{
"$end", "error", "$undefined", "EOL", "IDENTIFIER", "NUMBER", "'-'",
"'+'", "'*'", "'/'", "NEG", "PLS", "'^'", "'('","')'","$accept",
"line", "expr", YY_NULL
}

For a symbol, its name in clear.

Definition at line 228 of file evalexpr_parser.h.

const unsigned short int yy::parser::yytoken_number_
staticprivate
Initial value:
=
{
0, 256, 257, 258, 259, 260, 45, 43, 42, 47,
261, 262, 94, 40, 41
}

For each scanner token number, its symbol number.

Definition at line 239 of file evalexpr_parser.h.

const parser::token_number_type yy::parser::yyundef_token_ = 2
staticprivate

Definition at line 279 of file evalexpr_parser.h.

const unsigned int yy::parser::yyuser_token_number_max_ = 262
staticprivate

Definition at line 278 of file evalexpr_parser.h.


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