88 std::string_view
setSource(std::string_view src)
override;
99 typedef C_ResourceStack<C_StateLR1> C_StateStackLR1;
102 C_StateStackLR1 m_CurStack;
103 std::string_view m_CurSrc;
106 C_SourcePos m_ErrPos;
107 std::function<void()> m_OnPostShift;
108 unsigned m_ShiftCountdown;
116 void panicRollback(C_StateStackLR1 &unreadStack);
121 bool reduceOn(
size_t id,
const C_SourcePos &pos);
127template<
class T_Data>
139 template<
class...T_Args>
#define RUNTIME_ERROR(fmtStr,...)
Wrap FILE(DATE)#__LINE__ FUNCTION: msg into std::runtime_error.
bool takeOver(C_AutoNode< T2 > &another)
void assign(C_LexDataT< T_Data > *ptr, bool owned)
const I_ParserPolicy & m_Policy
void onError(const C_SourcePos &pos, std::string_view message)
void add(T_LexID token, unsigned line, unsigned col, I_LexAttr *unownedAttr) override
C_Parser(const I_ParserPolicy &policy)
std::string_view setSource(std::string_view src) override
void reservePostShift(std::function< void()> calledOnce, unsigned shifts)
F_GetProducedT< I_LexAttr, C_AutoNode > F_GetProduced
C_LexInfoT< I_LexAttr, C_AutoNode > C_LexInfo
C_AutoNode< I_LexAttr > C_LexPtr
THE common namespace of bux library.
std::function< C_LexInfoT< T, C_Ptr > &(size_t)> F_GetProducedT
Render any copyable "type" token attribute on the fly.
C_NewLex(T_Args &&...args)
std::function< void(C_Parser &parser, const F_GetProduced &args, C_LexPtr &ret)> FH_Reduce
virtual size_t action(T_StateID state, T_LexID token) const =0
Return action kind.
std::string printToken(T_LexID token) const
virtual T_StateID nextState(T_StateID state, T_LexID lex) const =0
Goto table.
virtual bool getTokenName(T_LexID token, std::string &name) const
Return true if token has a name.
virtual size_t getAcceptId() const =0
Return id which will be passed as the 1st arg of getReduceInfo()
constexpr I_ParserPolicy(T_LexID idError)
virtual ~I_ParserPolicy()=default
virtual void getReduceInfo(size_t id, C_ReduceInfo &info) const =0
Get reduction if available.
virtual bool changeToken(T_LexID &token, C_LexPtr &attr) const
A chance to save action error.
virtual void onError(C_Parser &parser, const C_SourcePos &pos, std::string_view message) const =0
Report error (to log or to throw)