bux API Reference 1.9.0
Static library of whatever are seen required in general purpose but not directly supported from Modern C++. Or whatever reusable originated from my side projects.
Loading...
Searching...
No Matches
bux::LR1::I_ParserPolicy Struct Referenceabstract

#include <LR1.h>

Classes

struct  C_ReduceInfo
 

Public Types

typedef std::function< void(C_Parser &parser, const F_GetProduced &args, C_LexPtr &ret)> FH_Reduce
 

Public Member Functions

constexpr I_ParserPolicy (T_LexID idError)
 
virtual ~I_ParserPolicy ()=default
 
virtual size_t action (T_StateID state, T_LexID token) const =0
 Return action kind.
 
virtual bool changeToken (T_LexID &token, C_LexPtr &attr) const
 A chance to save action error.
 
virtual size_t getAcceptId () const =0
 Return id which will be passed as the 1st arg of getReduceInfo()
 
virtual bool getTokenName (T_LexID token, std::string &name) const
 Return true if token has a name.
 
virtual T_StateID nextState (T_StateID state, T_LexID lex) const =0
 Goto table.
 
virtual void getReduceInfo (size_t id, C_ReduceInfo &info) const =0
 Get reduction if available.
 
virtual void onError (C_Parser &parser, const C_SourcePos &pos, std::string_view message) const =0
 Report error (to log or to throw)
 
std::string printToken (T_LexID token) const
 

Public Attributes

const T_LexID m_IdError
 

Detailed Description

Definition at line 29 of file LR1.h.

Member Typedef Documentation

◆ FH_Reduce

std::function<void(C_Parser &parser, const F_GetProduced &args, C_LexPtr &ret)> bux::LR1::I_ParserPolicy::FH_Reduce

Definition at line 32 of file LR1.h.

Constructor & Destructor Documentation

◆ I_ParserPolicy()

bux::LR1::I_ParserPolicy::I_ParserPolicy ( T_LexID idError)
inlineconstexpr

Definition at line 45 of file LR1.h.

◆ ~I_ParserPolicy()

virtual bux::LR1::I_ParserPolicy::~I_ParserPolicy ( )
virtualdefault

Member Function Documentation

◆ action()

virtual size_t bux::LR1::I_ParserPolicy::action ( T_StateID state,
T_LexID token ) const
pure virtual

Return action kind.

◆ changeToken()

bool bux::LR1::I_ParserPolicy::changeToken ( T_LexID & token,
C_LexPtr & attr ) const
virtual

A chance to save action error.

Definition at line 12 of file LR1.cpp.

◆ getAcceptId()

virtual size_t bux::LR1::I_ParserPolicy::getAcceptId ( ) const
pure virtual

Return id which will be passed as the 1st arg of getReduceInfo()

◆ getReduceInfo()

virtual void bux::LR1::I_ParserPolicy::getReduceInfo ( size_t id,
C_ReduceInfo & info ) const
pure virtual

Get reduction if available.

◆ getTokenName()

bool bux::LR1::I_ParserPolicy::getTokenName ( T_LexID token,
std::string & name ) const
virtual

Return true if token has a name.

Definition at line 17 of file LR1.cpp.

Referenced by printToken().

Here is the caller graph for this function:

◆ nextState()

virtual T_StateID bux::LR1::I_ParserPolicy::nextState ( T_StateID state,
T_LexID lex ) const
pure virtual

Goto table.

◆ onError()

virtual void bux::LR1::I_ParserPolicy::onError ( C_Parser & parser,
const C_SourcePos & pos,
std::string_view message ) const
pure virtual

Report error (to log or to throw)

Referenced by bux::LR1::C_Parser::onError().

Here is the caller graph for this function:

◆ printToken()

std::string bux::LR1::I_ParserPolicy::printToken ( T_LexID token) const

Definition at line 22 of file LR1.cpp.

References bux::asciiLiteral(), getTokenName(), bux::ROOT_NID, bux::TID_EOF, and bux::TOKENGEN_LB.

Member Data Documentation

◆ m_IdError

const T_LexID bux::LR1::I_ParserPolicy::m_IdError

Definition at line 42 of file LR1.h.


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