Aprepro 5.0x
Loading...
Searching...
No Matches
SEAMS::Parser Class Reference

A Bison parser. More...

#include <aprepro_parser.h>

Collaboration diagram for SEAMS::Parser:

Classes

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

Public Types

typedef value_type semantic_type
 Backward compatibility (Bison 3.8).
 
typedef token::token_kind_type token_kind_type
 Token kind, as returned by yylex.
 
typedef token_kind_type token_type
 Backward compatibility alias (Bison 3.6).
 
typedef symbol_kind::symbol_kind_type symbol_kind_type
 (Internal) symbol kind.
 
typedef by_kind by_type
 Backward compatibility for a private implementation detail (Bison 3.6).
 

Public Member Functions

 Parser (class Aprepro &aprepro_yyarg)
 Build a parser object.
 
virtual ~Parser ()
 
int operator() ()
 
virtual int parse ()
 
virtual void error (const std::string &msg)
 
void error (const syntax_error &err)
 Report a syntax error.
 

Static Public Member Functions

static std::string symbol_name (symbol_kind_type yysymbol)
 

Static Public Attributes

static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS
 The number of tokens.
 

Private Types

enum  { yylast_ = 2057 , yynnts_ = 7 , yyfinal_ = 2 }
 Constants. More...
 
typedef short state_type
 Stored state numbers (used for stacks).
 
typedef stack< stack_symbol_typestack_type
 Stack type.
 

Private Member Functions

 Parser (const Parser &)
 Non copyable.
 
Parseroperator= (const Parser &)
 Non copyable.
 
int yy_syntax_error_arguments_ (const context &yyctx, symbol_kind_type yyarg[], int yyargn) const
 The arguments of the error message.
 
virtual std::string yysyntax_error_ (const context &yyctx) const
 
template<typename Base >
void yy_destroy_ (const char *yymsg, basic_symbol< Base > &yysym) const
 Reclaim the memory associated to a symbol.
 
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) YY_NOEXCEPT
 Pop n symbols from the stack.
 

Static Private Member Functions

static state_type yy_lr_goto_state_ (state_type yystate, int yysym)
 
static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT
 
static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT
 
static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT
 
static std::string yytnamerr_ (const char *yystr)
 Convert the symbol name n to a form suitable for a diagnostic.
 

Private Attributes

stack_type yystack_
 The stack.
 
class Apreproaprepro
 

Static Private Attributes

static const signed char yypact_ninf_ = -32
 
static const signed char yytable_ninf_ = -1
 
static const char *const yytname_ []
 For a symbol, its name in clear.
 
static const short yypact_ []
 
static const unsigned char yydefact_ []
 
static const short yypgoto_ [] = {-32, -32, -32, 30, 231, 130, -4}
 
static const unsigned char yydefgoto_ [] = {0, 1, 6, 27, 28, 76, 235}
 
static const short yytable_ []
 
static const short yycheck_ []
 
static const signed char yystos_ []
 
static const signed char yyr1_ []
 
static const signed char yyr2_ []
 

Detailed Description

A Bison parser.

Member Typedef Documentation

◆ by_type

Backward compatibility for a private implementation detail (Bison 3.6).

◆ semantic_type

Backward compatibility (Bison 3.8).

◆ stack_type

◆ state_type

Stored state numbers (used for stacks).

◆ symbol_kind_type

◆ token_kind_type

Token kind, as returned by yylex.

◆ token_type

Backward compatibility alias (Bison 3.6).

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constants.

Enumerator
yylast_ 

Last index in yytable_.

yynnts_ 

Number of nonterminal symbols.

yyfinal_ 

Termination state number.

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

Non copyable.

Member Function Documentation

◆ 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

Non copyable.

◆ 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 ().

◆ symbol_name()

std::string SEAMS::Parser::symbol_name ( symbol_kind_type yysymbol)
static

The user-facing name of the symbol whose (internal) number is YYSYMBOL. No bounds checking.

◆ 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 )
staticprivate

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_syntax_error_arguments_()

int SEAMS::Parser::yy_syntax_error_arguments_ ( const context & yyctx,
symbol_kind_type yyarg[],
int yyargn ) const
private

The arguments of the error message.

◆ 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.

◆ yysyntax_error_()

std::string SEAMS::Parser::yysyntax_error_ ( const context & yyctx) const
privatevirtual

Generate an error message.

Parameters
yyctxthe context in which the error occurred.

◆ yytnamerr_()

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

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

◆ yytranslate_()

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

Convert a scanner token kind t to a symbol kind. In theory t should be a token_kind_type, but character literals are valid, yet not members of the token_kind_type enum.

Member Data Documentation

◆ aprepro

class Aprepro& SEAMS::Parser::aprepro
private

◆ yycheck_

const short SEAMS::Parser::yycheck_
staticprivate

◆ yydefact_

const unsigned char SEAMS::Parser::yydefact_
staticprivate
Initial value:
= {
2, 0, 1, 0, 0, 4, 3, 9, 128, 95, 156, 131, 96, 132, 97, 76, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 159, 160, 0, 0, 0, 0, 0, 0, 135, 136, 0, 0,
0, 0, 0, 0, 0, 147, 148, 0, 0, 0, 0, 0, 0, 156, 131, 96, 0, 0, 192,
0, 0, 0, 188, 89, 187, 12, 129, 157, 133, 145, 130, 158, 134, 146, 0, 0, 0, 7,
0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 98, 161, 162, 163, 164, 165,
166, 32, 26, 33, 27, 52, 64, 53, 65, 54, 66, 55, 67, 56, 68, 57, 69, 85, 100,
137, 140, 141, 142, 143, 144, 84, 99, 138, 103, 149, 151, 152, 153, 154, 155, 102, 150, 0,
86, 101, 139, 167, 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 187,
25, 190, 0, 191, 0, 0, 30, 19, 21, 31, 20, 22, 88, 0, 90, 92, 94, 91, 58,
34, 46, 59, 35, 47, 60, 36, 48, 61, 37, 49, 62, 38, 50, 63, 39, 51, 109, 124,
127, 126, 122, 120, 119, 118, 108, 0, 28, 23, 17, 29, 24, 18, 70, 40, 10, 71, 41,
11, 72, 42, 13, 73, 43, 14, 74, 44, 15, 75, 45, 16, 123, 182, 125, 183, 121, 185,
93, 117, 184, 186, 189, 0, 194, 170, 0, 169, 0, 168, 107, 0, 104, 0, 106, 83, 0,
77, 0, 82, 161, 137, 138, 139, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 116, 193, 195, 196, 0, 173, 171, 172, 0, 175, 0, 0, 115, 0, 113, 110,
79, 78, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 197, 174, 177, 0, 176, 0, 114,
0, 112, 80, 0, 0, 0, 0, 179, 178, 0, 0, 0, 0, 180, 0, 111, 0, 181}

◆ yydefgoto_

const unsigned char SEAMS::Parser::yydefgoto_ = {0, 1, 6, 27, 28, 76, 235}
staticprivate

◆ YYNTOKENS

const symbol_kind_type SEAMS::Parser::YYNTOKENS = symbol_kind::YYNTOKENS
static

The number of tokens.

◆ yypact_

const short SEAMS::Parser::yypact_
staticprivate
Initial value:
= {
-32, 22, -32, 4, 352, -32, -32, -32, -32, -32, 1865, -21, 20, 178, 28,
140, 44, 51, 54, 121, 121, -32, 121, 494, 121, 253, 325, 162, 235, 115,
1901, 494, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
-32, -32, 494, 121, 121, 121, 121, 121, -32, -32, 494, 121, 121, 121, 121,
121, 121, -32, -32, 121, 121, 494, 421, 479, 494, 1883, 324, 50, 158, 121,
148, 1932, 1602, 1816, 39, -32, 39, 39, -32, -32, -32, -32, -32, -32, -32,
-32, 121, 539, 554, -32, 494, 494, 121, 494, -32, 599, 614, 659, 674, 719,
734, 121, 121, 121, 121, 121, -32, 779, 794, 839, 854, 899, 914, 959, 974,
121, 121, 121, 494, 121, 121, 188, 1932, 1951, 1967, 1967, 1967, 1967, 1967, 55,
1998, -32, 2012, -31, 263, -31, 263, -31, 263, -31, 263, -31, 263, -31, 263,
188, 1932, 1951, 1967, 1967, 1967, 1967, 1967, 188, 1932, 1951, 1932, 1967, 1967, 1967,
1967, 1967, 1967, 1932, 1967, 1337, 188, 1932, 1951, -32, 179, 175, 1367, -32, 225,
993, 1397, 255, 1021, 1427, 121, 121, 121, 121, 39, -32, -32, 121, -32, 344,
1918, 1883, 55, 1998, 1883, -32, 2012, -29, 1951, -29, 1983, -32, 1983, 1883, -31,
263, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, -31,
263, -27, 99, -27, 99, 25, 39, 25, 39, -32, 1967, 1883, 55, 1998, 1883,
-32, 2012, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883,
-31, 263, 1883, -31, 263, -27, 99, -27, 99, 25, 39, -32, 25, 39, 39,
39, 121, 63, -32, 121, -32, 121, -32, -32, 121, -32, 121, -32, -32, 121,
-32, 121, -32, 1967, 1967, 1967, 1967, 39, 121, 121, 1841, 121, 1049, 1629, 42,
1308, 1077, 1105, 1656, 1176, 1683, 1457, 1932, 1967, 73, 1967, 121, -32, -32, -32,
121, -32, 121, 121, -32, 121, -32, -32, -32, -32, 121, -32, 121, 1202, 1710,
1487, 1546, 1228, 1133, 1737, 1967, -32, -32, 121, -32, 121, -32, 121, -32, -32,
1517, 1764, 1150, 121, -32, -32, 121, 1254, 1575, 1280, -32, 121, -32, 1791, -32}

◆ yypact_ninf_

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

◆ yypgoto_

const short SEAMS::Parser::yypgoto_ = {-32, -32, -32, 30, 231, 130, -4}
staticprivate

◆ yyr1_

const signed 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, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 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, 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 signed 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, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 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, 3, 6, 12, 8, 6, 8, 6,
5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 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}

◆ yystack_

stack_type SEAMS::Parser::yystack_
private

The stack.

◆ yystos_

const signed 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, 30, 31, 32, 33, 34, 35, 36, 37, 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, 38, 39, 40, 41, 48, 20, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 54, 55, 56, 56, 56, 56, 56, 56, 53, 56, 53, 56,
55, 56, 55, 56, 55, 56, 55, 56, 55, 56, 55, 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, 5, 53, 56, 5, 53, 56, 54, 56, 54, 56, 54,
56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 55, 56, 55, 56,
55, 56, 55, 56, 55, 56, 5, 53, 56, 5, 53, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55,
56, 5, 55, 56, 5, 55, 56, 55, 56, 55, 56, 55, 56, 54, 55, 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, 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 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: