Aprepro  5.0x
SEAMS::Parser Class Reference

A Bison parser. More...

#include <aprepro_parser.h>

Collaboration diagram for SEAMS::Parser:

Classes

struct  basic_symbol
 
struct  by_state
 Type access provider for state based symbols. More...
 
struct  by_type
 Type access provider for token (enum) based symbols. More...
 
union  semantic_type
 Symbol semantic values. More...
 
class  stack
 A stack with random access from its top. More...
 
struct  stack_symbol_type
 "Internal" symbol: element of the stack. More...
 
struct  symbol_type
 "External" symbols: returned by the scanner. More...
 
struct  syntax_error
 Syntax errors thrown from user actions. More...
 
struct  token
 Tokens. More...
 

Public Types

enum  { empty_symbol = -2 }
 The symbol type number to denote an empty symbol. 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 int debug_level_type
 Type for debugging levels. More...
 

Public Member Functions

 Parser (class Aprepro &aprepro_yyarg)
 Build a parser object. More...
 
virtual ~Parser ()
 
int operator() ()
 
virtual int parse ()
 
std::ostream & debug_stream () const YY_ATTRIBUTE_PURE
 The current debugging stream. More...
 
void set_debug_stream (std::ostream &)
 Set the current debugging stream. More...
 
debug_level_type debug_level () const YY_ATTRIBUTE_PURE
 The current debugging level. More...
 
void set_debug_level (debug_level_type l)
 Set the current debugging level. More...
 
virtual void error (const std::string &msg)
 
void error (const syntax_error &err)
 Report a syntax error. More...
 

Private Types

enum  {
  yyeof_ = 0, yylast_ = 1315, yynnts_ = 7, yyfinal_ = 2,
  yyterror_ = 1, yyerrcode_ = 256, yyntokens_ = 50
}
 Constants. More...
 
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 copiable. More...
 
Parseroperator= (const Parser &)
 
virtual std::string yysyntax_error_ (state_type yystate, const symbol_type &yyla) const
 
state_type yy_lr_goto_state_ (state_type yystate, int yysym)
 
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, YY_MOVE_REF(stack_symbol_type) sym)
 
void yypush_ (const char *m, state_type s, YY_MOVE_REF(symbol_type) sym)
 
void yypop_ (int n=1)
 Pop n symbols from the stack. More...
 

Static Private Member Functions

static bool yy_pact_value_is_default_ (int yyvalue)
 
static bool yy_table_value_is_error_ (int yyvalue)
 
static token_number_type yytranslate_ (int 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_
 Debugging level. More...
 
std::ostream * yycdebug_
 Debug stream. More...
 
stack_type yystack_
 The stack. More...
 
class Apreproaprepro
 

Static Private Attributes

static const signed char yypact_ninf_ = -34
 
static const signed char yytable_ninf_ = -1
 
static const short yypact_ []
 
static const unsigned char yydefact_ []
 
static const signed char yypgoto_ [] = {-34, -34, -34, -18, 103, 85, -4}
 
static const short yydefgoto_ [] = {-1, 1, 6, 27, 28, 68, 169}
 
static const unsigned short yytable_ []
 
static const short 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 yyrline_ []
 

Detailed Description

A Bison parser.

Member Typedef Documentation

◆ debug_level_type

Type for debugging levels.

◆ stack_type

Stack type.

◆ state_type

typedef int SEAMS::Parser::state_type
private

State numbers.

◆ symbol_number_type

Symbol type: an internal symbol number.

◆ token_number_type

typedef unsigned char SEAMS::Parser::token_number_type

Internal symbol number for tokens (subsumed by symbol_number_type).

◆ token_type

(External) token type, as returned by yylex.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The symbol type number to denote an empty symbol.

Enumerator
empty_symbol 

◆ anonymous enum

anonymous enum
private

Constants.

Enumerator
yyeof_ 
yylast_ 

Last index in yytable_.

yynnts_ 

Number of nonterminal symbols.

yyfinal_ 

Termination state number.

yyterror_ 
yyerrcode_ 
yyntokens_ 

Number of tokens.

Constructor & Destructor Documentation

◆ Parser() [1/2]

SEAMS::Parser::Parser ( class Aprepro aprepro_yyarg)

Build a parser object.

◆ ~Parser()

SEAMS::Parser::~Parser ( )
virtual

◆ Parser() [2/2]

SEAMS::Parser::Parser ( const Parser )
private

This class is not copiable.

Member Function Documentation

◆ debug_level()

Parser::debug_level_type SEAMS::Parser::debug_level ( ) const

The current debugging level.

◆ debug_stream()

std::ostream & SEAMS::Parser::debug_stream ( ) const

The current debugging stream.

◆ error() [1/2]

void SEAMS::Parser::error ( const std::string &  msg)
virtual

Report a syntax error.

Parameters
msga description of the syntax error.

◆ error() [2/2]

void SEAMS::Parser::error ( const syntax_error err)

Report a syntax error.

◆ operator()()

int SEAMS::Parser::operator() ( )

Parse. An alias for parse ().

Returns
0 iff parsing succeeded.

◆ operator=()

Parser& SEAMS::Parser::operator= ( const Parser )
private

◆ parse()

int SEAMS::Parser::parse ( )
virtual

Parse.

Returns
0 iff parsing succeeded.

Length of the RHS of the rule being reduced.

The lookahead symbol.

The return value of parse ().

◆ set_debug_level()

void SEAMS::Parser::set_debug_level ( debug_level_type  l)

Set the current debugging level.

◆ set_debug_stream()

void SEAMS::Parser::set_debug_stream ( std::ostream &  o)

Set the current debugging stream.

◆ yy_destroy_()

template<typename Base >
void SEAMS::Parser::yy_destroy_ ( const char *  yymsg,
basic_symbol< Base > &  yysym 
) const
private

Reclaim the memory associated to a symbol.

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

◆ yy_lr_goto_state_()

Parser::state_type SEAMS::Parser::yy_lr_goto_state_ ( state_type  yystate,
int  yysym 
)
private

Compute post-reduction state.

Parameters
yystatethe current state
yysymthe nonterminal to push on the stack

◆ yy_pact_value_is_default_()

bool SEAMS::Parser::yy_pact_value_is_default_ ( int  yyvalue)
staticprivate

Whether the given yypact_ value indicates a defaulted state.

Parameters
yyvaluethe value to check

◆ yy_print_()

template<typename Base >
void SEAMS::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.

◆ yy_reduce_print_()

void SEAMS::Parser::yy_reduce_print_ ( int  r)
privatevirtual

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

◆ yy_table_value_is_error_()

bool SEAMS::Parser::yy_table_value_is_error_ ( int  yyvalue)
staticprivate

Whether the given yytable_ value indicates a syntax error.

Parameters
yyvaluethe value to check

◆ yypop_()

void SEAMS::Parser::yypop_ ( int  n = 1)
private

Pop n symbols from the stack.

◆ yypush_() [1/2]

void SEAMS::Parser::yypush_ ( const char *  m,
state_type  s,
YY_MOVE_REF(symbol_type sym 
)
private

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 sym.value is stolen.

◆ yypush_() [2/2]

void SEAMS::Parser::yypush_ ( const char *  m,
YY_MOVE_REF(stack_symbol_type sym 
)
private

Push a new state on the stack.

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

◆ yystack_print_()

void SEAMS::Parser::yystack_print_ ( )
privatevirtual

Print the state stack on the debug stream.

◆ yysyntax_error_()

std::string SEAMS::Parser::yysyntax_error_ ( state_type  yystate,
const symbol_type yyla 
) const
privatevirtual

Generate an error message.

Parameters
yystatethe state where the error occurred.
yylathe lookahead token.

◆ yytnamerr_()

std::string SEAMS::Parser::yytnamerr_ ( const char *  n)
staticprivate

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

◆ yytranslate_()

Parser::token_number_type SEAMS::Parser::yytranslate_ ( int  t)
staticprivate

Convert a scanner token number t to a symbol number.

Member Data Documentation

◆ aprepro

class Aprepro& SEAMS::Parser::aprepro
private

◆ yycdebug_

std::ostream* SEAMS::Parser::yycdebug_
private

Debug stream.

◆ yycheck_

const short SEAMS::Parser::yycheck_
staticprivate

◆ yydebug_

int SEAMS::Parser::yydebug_
private

Debugging level.

◆ yydefact_

const unsigned char SEAMS::Parser::yydefact_
staticprivate
Initial value:
= {
2, 0, 1, 0, 0, 4, 3, 9, 67, 47, 95, 70, 48, 71, 49, 28, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, 0, 0,
0, 98, 99, 0, 0, 0, 0, 0, 0, 74, 75, 0, 0, 0, 0, 0, 0, 0,
86, 87, 0, 0, 0, 0, 0, 0, 95, 70, 48, 0, 0, 131, 0, 0, 0, 127,
41, 126, 12, 68, 96, 72, 84, 69, 97, 73, 85, 0, 0, 0, 7, 0, 0, 0,
0, 6, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 39, 50, 100, 101, 102, 103, 104, 105, 37, 52, 76, 79,
80, 81, 82, 83, 36, 51, 77, 55, 88, 90, 91, 92, 93, 94, 54, 89, 0, 38,
53, 78, 106, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126,
21, 129, 0, 130, 0, 0, 19, 0, 20, 40, 0, 42, 44, 46, 43, 22, 23, 24,
25, 26, 27, 60, 17, 18, 10, 11, 13, 14, 15, 16, 121, 122, 124, 45, 123, 125,
128, 0, 133, 109, 0, 108, 0, 107, 59, 0, 56, 0, 58, 35, 0, 29, 0, 34,
100, 76, 77, 78, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 66, 132, 134, 135, 0, 112, 110, 111, 0, 114, 0, 0, 65, 0, 61, 31, 30,
0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 136, 113, 116, 0, 115, 0, 64, 0,
63, 32, 0, 0, 0, 0, 118, 117, 0, 0, 0, 0, 119, 0, 62, 0, 120}

◆ yydefgoto_

const short SEAMS::Parser::yydefgoto_ = {-1, 1, 6, 27, 28, 68, 169}
staticprivate

◆ yypact_

const short SEAMS::Parser::yypact_
staticprivate
Initial value:
= {
-34, 2, -34, -3, 305, -34, -34, -34, -34, -34, -13, 68, 4, 312, 28, 47,
53, 62, 67, 421, 421, -34, 421, 376, 421, 55, 181, 50, -16, 39, 1142, 376,
421, 421, 421, 421, 421, -34, -34, 376, 421, 421, 421, 421, 421, -34, -34, 376,
421, 421, 421, 421, 421, 421, -34, -34, 421, 421, 376, 221, 361, 376, 616, 646,
95, 48, 421, 107, 1190, 880, 1094, 82, -34, 82, 82, -34, -34, -34, -34, -34,
-34, -34, -34, 421, 421, 421, -34, 376, 376, 421, 376, -34, 421, 421, 421, 421,
421, 421, 421, -34, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 376,
421, 421, -33, 1190, 1209, 1225, 1225, 1225, 1225, 1225, -33, 1190, 1209, 1225, 1225, 1225,
1225, 1225, -33, 1190, 1209, 1190, 1225, 1225, 1225, 1225, 1225, 1225, 1190, 1225, 615, -33,
1190, 1209, -34, 72, 240, 645, -34, 262, 248, 675, 288, 437, 705, 421, 421, 421,
421, 82, -34, -34, 421, -34, 1156, 1176, 97, 1225, -34, 1, 1209, 1, 1241, -34,
1241, 81, 81, 81, 81, 81, 81, -34, 1256, 1270, 80, 80, 80, 80, 80, 80,
161, 161, 82, -34, 82, 82, 82, 421, 108, -34, 421, -34, 421, -34, -34, 421,
-34, 421, -34, -34, 421, -34, 421, -34, 1225, 1225, 1225, 1225, 82, 421, 421, 1119,
421, 447, 907, 500, 586, 472, 137, 934, 506, 961, 735, 1190, 1225, 109, 1225, 421,
-34, -34, -34, 421, -34, 421, 421, -34, 421, -34, -34, -34, 421, -34, 421, 528,
988, 765, 824, 534, 478, 1015, 1225, -34, -34, 421, -34, 421, -34, 421, -34, -34,
795, 1042, 407, 421, -34, -34, 421, 556, 853, 562, -34, 421, -34, 1069, -34}

◆ yypact_ninf_

const signed char SEAMS::Parser::yypact_ninf_ = -34
staticprivate

◆ yypgoto_

const signed char SEAMS::Parser::yypgoto_ = {-34, -34, -34, -18, 103, 85, -4}
staticprivate

◆ yyr1_

const unsigned char SEAMS::Parser::yyr1_
staticprivate
Initial value:
= {
0, 50, 51, 51, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56}

◆ yyr2_

const unsigned char SEAMS::Parser::yyr2_
staticprivate
Initial value:
= {
0, 2, 0, 2, 1, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1, 4, 6, 6, 8, 6, 4, 4, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3,
4, 3, 4, 4, 3, 6, 12, 8, 8, 6, 5, 1, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 6, 6,
6, 8, 6, 8, 8, 10, 10, 12, 14, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 1, 5, 4, 6, 6, 8}

◆ yyrline_

const unsigned short SEAMS::Parser::yyrline_
staticprivate
Initial value:
= {
0, 145, 145, 146, 149, 150, 157, 161, 162, 163, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 180, 181, 182, 183, 184, 185, 187, 188, 194, 200, 206, 212, 218, 224,
230, 234, 238, 241, 243, 251, 253, 261, 262, 263, 264, 273, 274, 275, 276, 278, 281, 285,
290, 291, 292, 298, 304, 310, 316, 317, 323, 329, 335, 341, 347, 349, 350, 351, 352, 353,
354, 355, 356, 357, 358, 360, 363, 368, 369, 370, 371, 372, 377, 378, 379, 380, 381, 382,
383, 384, 385, 386, 387, 389, 391, 394, 397, 400, 403, 405, 408, 411, 414, 417, 424, 431,
438, 445, 452, 459, 466, 473, 480, 486, 492, 498, 504, 510, 516, 522, 523, 524, 525, 532,
539, 540, 541, 544, 545, 548, 549, 550, 551, 552, 574}

◆ yystack_

stack_type SEAMS::Parser::yystack_
private

The stack.

◆ yystos_

const unsigned char SEAMS::Parser::yystos_
staticprivate
Initial value:
= {
0, 51, 0, 1, 19, 49, 52, 20, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 20, 38,
39, 44, 46, 47, 53, 54, 55, 56, 22, 23, 24, 25, 26, 27, 46, 47, 22, 23, 24, 25, 26, 27, 46,
47, 22, 22, 23, 24, 25, 26, 27, 46, 47, 22, 17, 22, 15, 15, 15, 5, 6, 7, 10, 39, 53, 55,
56, 56, 56, 54, 56, 56, 3, 5, 6, 8, 3, 5, 6, 8, 28, 30, 31, 20, 38, 39, 40, 41, 20,
32, 33, 34, 35, 36, 37, 48, 20, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 54,
55, 56, 56, 56, 56, 56, 56, 54, 55, 56, 56, 56, 56, 56, 56, 54, 55, 56, 55, 56, 56, 56, 56,
56, 56, 55, 56, 56, 54, 55, 56, 16, 54, 55, 56, 16, 54, 55, 56, 54, 55, 56, 22, 22, 22, 22,
56, 16, 16, 41, 18, 55, 56, 53, 56, 53, 54, 56, 54, 56, 54, 56, 55, 55, 55, 55, 55, 55, 55,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 54, 56, 56, 56, 14, 18, 16, 14, 16, 14, 16, 16,
14, 16, 14, 16, 16, 14, 16, 14, 16, 56, 56, 56, 56, 56, 29, 29, 56, 22, 55, 56, 55, 56, 55,
55, 56, 55, 56, 56, 55, 56, 18, 56, 14, 16, 16, 16, 14, 16, 21, 14, 16, 14, 16, 16, 16, 14,
16, 22, 55, 56, 56, 56, 55, 55, 56, 56, 16, 16, 14, 16, 14, 16, 14, 16, 16, 56, 56, 55, 14,
16, 16, 14, 55, 56, 55, 16, 14, 16, 56, 16}

◆ yytable_

const unsigned short SEAMS::Parser::yytable_
staticprivate

◆ yytable_ninf_

const signed char SEAMS::Parser::yytable_ninf_ = -1
staticprivate

◆ yytname_

const char *const SEAMS::Parser::yytname_
staticprivate

For a symbol, its name in clear.


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