xo-interpreter2 stack: handle operator expressions w/ qliterals
This commit is contained in:
parent
3f8be97290
commit
906bb2a913
24 changed files with 942 additions and 51 deletions
|
|
@ -65,6 +65,10 @@ set(SELF_SRCS
|
|||
ISyntaxStateMachine_DExpectExprSsm.cpp
|
||||
IPrintable_DExpectExprSsm.cpp
|
||||
|
||||
DExpectQLiteralSsm.cpp
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm.cpp
|
||||
IPrintable_DExpectQLiteralSsm.cpp
|
||||
|
||||
DProgressSsm.cpp
|
||||
ISyntaxStateMachine_DProgressSsm.cpp
|
||||
IPrintable_DProgressSsm.cpp
|
||||
|
|
@ -72,6 +76,7 @@ set(SELF_SRCS
|
|||
DQuoteSsm.cpp
|
||||
ISyntaxStateMachine_DQuoteSsm.cpp
|
||||
IPrintable_DQuoteSsm.cpp
|
||||
|
||||
)
|
||||
|
||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@
|
|||
#include "ParserStateMachine.hpp"
|
||||
#include "ParserStack.hpp"
|
||||
#include "SyntaxStateMachine.hpp"
|
||||
#include "ssm/ISyntaxStateMachine_DProgressSsm.hpp"
|
||||
#include "ProgressSsm.hpp"
|
||||
#include "DSequenceSsm.hpp"
|
||||
#include "IfElseSsm.hpp"
|
||||
#include "LambdaSsm.hpp"
|
||||
#include "QuoteSsm.hpp"
|
||||
#include "syntaxstatetype.hpp"
|
||||
#include <xo/expression2/Variable.hpp>
|
||||
#include <xo/expression2/Constant.hpp>
|
||||
|
|
@ -22,14 +23,10 @@
|
|||
#include <xo/facet/facet_implementation.hpp>
|
||||
|
||||
#ifdef NOT_YET
|
||||
#include "exprstatestack.hpp"
|
||||
#include "define_xs.hpp"
|
||||
#include "lambda_xs.hpp"
|
||||
#include "if_else_xs.hpp"
|
||||
#include "paren_xs.hpp"
|
||||
#include "sequence_xs.hpp"
|
||||
#include "progress_xs.hpp"
|
||||
#include "xo/expression/pretty_expression.hpp"
|
||||
#endif
|
||||
|
||||
namespace xo {
|
||||
|
|
@ -140,6 +137,10 @@ namespace xo {
|
|||
this->on_def_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_quote:
|
||||
this->on_quote_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_string:
|
||||
this->on_string_token(tk, p_psm);
|
||||
return;
|
||||
|
|
@ -169,7 +170,6 @@ namespace xo {
|
|||
case tokentype::tk_singleassign:
|
||||
case tokentype::tk_colon:
|
||||
case tokentype::tk_semicolon:
|
||||
case tokentype::tk_quote:
|
||||
case tokentype::tk_leftbracket:
|
||||
case tokentype::tk_rightbracket:
|
||||
case tokentype::tk_rightbrace:
|
||||
|
|
@ -344,6 +344,17 @@ namespace xo {
|
|||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExpectExprSsm::on_quote_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
(void)tk;
|
||||
|
||||
DProgressSsm::start(p_psm->parser_alloc(), p_psm);
|
||||
DQuoteSsm::start(p_psm);
|
||||
p_psm->on_token(Token::quote_token());
|
||||
}
|
||||
|
||||
void
|
||||
DExpectExprSsm::on_bool_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
|
|
@ -500,6 +511,21 @@ namespace xo {
|
|||
p_psm->on_parsed_expression_with_token(expr, tk);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
void
|
||||
DExpectExprSsm::on_quoted_literal(obj<AGCObject> lit,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
// note: impl here parallels .on_f64_token() .on_i64_token() etc.
|
||||
|
||||
auto expr = DConstant::make(p_psm->expr_alloc(), lit);
|
||||
|
||||
DProgressSsm::start(p_psm->parser_alloc(),
|
||||
expr,
|
||||
p_psm);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
DExpectExprSsm::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
|
|
|
|||
256
src/reader2/DExpectQLiteralSsm.cpp
Normal file
256
src/reader2/DExpectQLiteralSsm.cpp
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
/* @file DExpectQLiteralSsm.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
*/
|
||||
|
||||
#include "ExpectQLiteralSsm.hpp"
|
||||
#include <xo/object2/Float.hpp>
|
||||
//#include "DExpectFormalArgSsm.hpp"
|
||||
//#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp"
|
||||
//#include <xo/expression2/DVariable.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DVariable.hpp>
|
||||
//#include <xo/printable2/Printable.hpp>
|
||||
//#include <xo/alloc2/arena/IAllocator_DArena.hpp>
|
||||
//#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
// using xo::print::APrintable;
|
||||
// using xo::print::ppstate;
|
||||
// using xo::print::ppindentinfo;
|
||||
using xo::mm::AGCObject;
|
||||
// using xo::mm::AAllocator;
|
||||
// using xo::facet::FacetRegistry;
|
||||
// using xo::reflect::typeseq;
|
||||
|
||||
namespace scm {
|
||||
#ifdef NOT_USING
|
||||
const char *
|
||||
formalarglstatetype_descr(formalarglstatetype x) {
|
||||
switch (x) {
|
||||
case formalarglstatetype::invalid:
|
||||
return "invalid";
|
||||
case formalarglstatetype::argl_0:
|
||||
return "argl_0";
|
||||
case formalarglstatetype::argl_1a:
|
||||
return "argl_1a";
|
||||
case formalarglstatetype::argl_1b:
|
||||
return "argl_1b";
|
||||
case formalarglstatetype::n_formalarglstatetype:
|
||||
break;
|
||||
}
|
||||
|
||||
return "?formalarglstatetype";
|
||||
}
|
||||
#endif
|
||||
|
||||
DExpectQLiteralSsm::DExpectQLiteralSsm()
|
||||
{}
|
||||
|
||||
DExpectQLiteralSsm *
|
||||
DExpectQLiteralSsm::_make(DArena & arena)
|
||||
{
|
||||
/* out-of-order so argl follows ssm in arena,
|
||||
* consistent with any subsequent arglist realloc.
|
||||
* Not a load-bearing choice however
|
||||
*/
|
||||
|
||||
void * mem = arena.alloc_for<DExpectQLiteralSsm>();
|
||||
|
||||
return new (mem) DExpectQLiteralSsm();
|
||||
}
|
||||
|
||||
obj<ASyntaxStateMachine,DExpectQLiteralSsm>
|
||||
DExpectQLiteralSsm::make(DArena & arena)
|
||||
{
|
||||
obj<ASyntaxStateMachine,DExpectQLiteralSsm> retval(_make(arena));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::start(ParserStateMachine * p_psm)
|
||||
{
|
||||
DArena::Checkpoint ckp = p_psm->parser_alloc().checkpoint();
|
||||
|
||||
p_psm->push_ssm(ckp, DExpectQLiteralSsm::make(p_psm->parser_alloc()));
|
||||
}
|
||||
|
||||
syntaxstatetype
|
||||
DExpectQLiteralSsm::ssm_type() const noexcept {
|
||||
return syntaxstatetype::expect_qliteral;
|
||||
}
|
||||
|
||||
std::string_view
|
||||
DExpectQLiteralSsm::get_expect_str() const
|
||||
{
|
||||
return "leftparen|leftbracket|leftbrace|string|f64|i64|bool";
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::on_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (tk.tk_type()) {
|
||||
case tokentype::tk_f64:
|
||||
this->on_f64_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_leftparen:
|
||||
case tokentype::tk_comma:
|
||||
case tokentype::tk_rightparen:
|
||||
case tokentype::tk_lambda:
|
||||
case tokentype::tk_def:
|
||||
case tokentype::tk_if:
|
||||
case tokentype::tk_symbol:
|
||||
case tokentype::tk_colon:
|
||||
case tokentype::tk_singleassign:
|
||||
case tokentype::tk_string:
|
||||
case tokentype::tk_i64:
|
||||
case tokentype::tk_bool:
|
||||
case tokentype::tk_semicolon:
|
||||
case tokentype::tk_invalid:
|
||||
case tokentype::tk_quote:
|
||||
case tokentype::tk_leftbracket:
|
||||
case tokentype::tk_rightbracket:
|
||||
case tokentype::tk_leftbrace:
|
||||
case tokentype::tk_rightbrace:
|
||||
case tokentype::tk_leftangle:
|
||||
case tokentype::tk_rightangle:
|
||||
case tokentype::tk_lessequal:
|
||||
case tokentype::tk_greatequal:
|
||||
case tokentype::tk_dot:
|
||||
case tokentype::tk_doublecolon:
|
||||
case tokentype::tk_assign:
|
||||
case tokentype::tk_yields:
|
||||
case tokentype::tk_plus:
|
||||
case tokentype::tk_minus:
|
||||
case tokentype::tk_star:
|
||||
case tokentype::tk_slash:
|
||||
case tokentype::tk_cmpeq:
|
||||
case tokentype::tk_cmpne:
|
||||
case tokentype::tk_type:
|
||||
case tokentype::tk_then:
|
||||
case tokentype::tk_else:
|
||||
case tokentype::tk_let:
|
||||
case tokentype::tk_in:
|
||||
case tokentype::tk_end:
|
||||
case tokentype::N:
|
||||
break;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::on_f64_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
auto literal = DFloat::box<AGCObject>(p_psm->expr_alloc(),
|
||||
tk.f64_value());
|
||||
|
||||
p_psm->pop_ssm();
|
||||
p_psm->on_quoted_literal(literal);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
void
|
||||
DExpectQLiteralSsm::_accept_formal(obj<AAllocator> expr_alloc,
|
||||
DArena & parser_alloc,
|
||||
const DUniqueString * param_name,
|
||||
TypeDescr param_type)
|
||||
{
|
||||
/* note: param_type can be nullptr */
|
||||
TypeRef typeref
|
||||
= TypeRef::dwim(TypeRef::prefix_type::from_chars("formal"), param_type);
|
||||
|
||||
DVariable * var = DVariable::make(expr_alloc,
|
||||
param_name,
|
||||
typeref);
|
||||
|
||||
// need AGCObject facet to use DArray here.
|
||||
// May want to have gc feature that allows it to use
|
||||
// FacetRegistry on memory that stores obj<AExpression,..>
|
||||
//
|
||||
// In this case doesn't matter since DExpectQLiteralSsm not actually collected!
|
||||
|
||||
obj<AGCObject,DVariable> var_o(var);
|
||||
|
||||
if (argl_->size() == argl_->capacity()) {
|
||||
// need to expand argl_ capacity.
|
||||
// If DArena were to allow it (i.e. offer a realloc() feature,
|
||||
// could do this in place since this SSM is at the top of the parser stack.
|
||||
|
||||
obj<AAllocator,DArena> mm(&parser_alloc);
|
||||
DArray * argl_2x = DArray::empty(mm, 2 * argl_->capacity());
|
||||
|
||||
for (DArray::size_type i = 0, n = argl_->size(); i < n; ++i) {
|
||||
// TODO: prefer non-bounds-checked access here
|
||||
argl_2x->push_back(argl_->at(i));
|
||||
}
|
||||
|
||||
// update in place
|
||||
this->argl_ = argl_2x;
|
||||
}
|
||||
|
||||
this->argl_->push_back(var_o);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NOT_YET
|
||||
void
|
||||
DExpectQLiteralSsm::on_leftparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (fastate_ == formalarglstatetype::argl_0) {
|
||||
this->fastate_ = formalarglstatetype::argl_1a;
|
||||
|
||||
DExpectFormalArgSsm::start(p_psm);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::on_comma_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (fastate_ == formalarglstatetype::argl_1b) {
|
||||
this->fastate_ = formalarglstatetype::argl_1a;
|
||||
|
||||
DExpectFormalArgSsm::start(p_psm);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::on_rightparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (fastate_ == formalarglstatetype::argl_1b) {
|
||||
DArray * args = argl_;
|
||||
|
||||
p_psm->pop_ssm();
|
||||
p_psm->on_parsed_formal_arglist(args);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
DExpectQLiteralSsm::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct(ppii,
|
||||
"DExpectQLiteralSsm",
|
||||
refrtag("expect", this->get_expect_str()));
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
||||
/* end DExpectQLiteralSsm.cpp */
|
||||
|
|
@ -3,8 +3,7 @@
|
|||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "DProgressSsm.hpp"
|
||||
#include "ssm/ISyntaxStateMachine_DProgressSsm.hpp"
|
||||
#include "ProgressSsm.hpp"
|
||||
|
||||
#include "DExpectExprSsm.hpp"
|
||||
#include "ssm/ISyntaxStateMachine_DExpectExprSsm.hpp"
|
||||
|
|
@ -189,6 +188,7 @@ namespace xo {
|
|||
start(parser_mm, lhs, optype::invalid, p_psm);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DProgressSsm::start(DArena & parser_mm,
|
||||
ParserStateMachine * p_psm)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@
|
|||
**/
|
||||
|
||||
#include "QuoteSsm.hpp"
|
||||
#include "ExpectExprSsm.hpp"
|
||||
#include "ExpectQLiteralSsm.hpp"
|
||||
#include "syntaxstatetype.hpp"
|
||||
#include <xo/expression2/Constant.hpp>
|
||||
//#include <string_view>
|
||||
|
||||
namespace xo {
|
||||
|
|
@ -88,6 +89,10 @@ namespace xo {
|
|||
{
|
||||
switch (tk.tk_type()) {
|
||||
|
||||
case tokentype::tk_quote:
|
||||
this->on_quote_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_leftbrace:
|
||||
this->on_leftbrace_token(tk, p_psm);
|
||||
return;
|
||||
|
|
@ -108,7 +113,6 @@ namespace xo {
|
|||
case tokentype::tk_i64:
|
||||
case tokentype::tk_bool:
|
||||
case tokentype::tk_if:
|
||||
case tokentype::tk_quote:
|
||||
case tokentype::tk_leftparen:
|
||||
case tokentype::tk_rightparen:
|
||||
case tokentype::tk_leftbracket:
|
||||
|
|
@ -143,15 +147,25 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DQuoteSsm::on_leftbrace_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
DQuoteSsm::on_quote_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (quote_xst_.code() == QuoteXst::code::quote_0) {
|
||||
this->quote_xst_ = QuoteXst(QuoteXst::code::quote_1);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
//DExpectQLiteralSsm::start(p_psm);
|
||||
//return;
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DQuoteSsm::on_leftbrace_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (quote_xst_.code() == QuoteXst::code::quote_1) {
|
||||
this->quote_xst_ = QuoteXst(QuoteXst::code::quote_2);
|
||||
DExpectQLiteralSsm::start(p_psm);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
|
|
@ -173,41 +187,24 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DQuoteSsm::on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
DQuoteSsm::on_quoted_literal(obj<AGCObject> literal,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (quote_xst_.code() == QuoteXst::code::quote_2) {
|
||||
this->quote_xst_ = QuoteXst(QuoteXst::code::quote_3);
|
||||
this->expr_ = expr;
|
||||
this->expr_ = DConstant::make(p_psm->expr_alloc(), literal);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_parsed_expression(expr, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DQuoteSsm::on_parsed_expression_with_token(obj<AExpression> expr,
|
||||
const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (quote_xst_.code() == QuoteXst::code::quote_2) {
|
||||
this->quote_xst_ = QuoteXst(QuoteXst::code::quote_3);
|
||||
this->expr_ = expr;
|
||||
|
||||
this->on_token(tk, p_psm);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_parsed_expression(expr, p_psm);
|
||||
Super::illegal_quoted_literal(literal, p_psm);
|
||||
}
|
||||
|
||||
bool
|
||||
DQuoteSsm::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct(ppii,
|
||||
"DParenSsm",
|
||||
"DQuoteSsm",
|
||||
refrtag("quote_xst", quote_xst_),
|
||||
refrtag("expect", this->get_expect_str()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,13 @@
|
|||
#include "DLambdaSsm.hpp"
|
||||
#include "ProgressSsm.hpp"
|
||||
#include "DIfElseSsm.hpp"
|
||||
#include "QuoteSsm.hpp"
|
||||
#include "ParenSsm.hpp"
|
||||
#include "ExpectExprSsm.hpp"
|
||||
#include "VarRef.hpp"
|
||||
|
||||
#include <xo/expression2/DConstant.hpp>
|
||||
#include <xo/expression2/detail/IExpression_DConstant.hpp>
|
||||
#include <xo/expression2/Constant.hpp>
|
||||
//#include <xo/expression2/detail/IExpression_DConstant.hpp>
|
||||
|
||||
#include <xo/object2/DString.hpp>
|
||||
#include <xo/object2/string/IGCObject_DString.hpp>
|
||||
|
|
@ -160,9 +161,12 @@ namespace xo {
|
|||
this->on_leftparen_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_quote:
|
||||
this->on_quote_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
// all the not-yet handled cases
|
||||
case tokentype::tk_invalid:
|
||||
case tokentype::tk_quote:
|
||||
case tokentype::tk_rightparen:
|
||||
case tokentype::tk_leftbracket:
|
||||
case tokentype::tk_rightbracket:
|
||||
|
|
@ -424,6 +428,29 @@ namespace xo {
|
|||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DToplevelSeqSsm::on_quote_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
case exprseqtype::toplevel_interactive: {
|
||||
DProgressSsm::start(p_psm->parser_alloc(),
|
||||
p_psm);
|
||||
DQuoteSsm::start(p_psm);
|
||||
p_psm->on_token(Token::quote_token());
|
||||
|
||||
return;
|
||||
}
|
||||
case exprseqtype::toplevel_batch:
|
||||
break;
|
||||
case exprseqtype::N:
|
||||
assert(false); // unreachable
|
||||
break;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DToplevelSeqSsm::on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
|
|
|
|||
28
src/reader2/IPrintable_DExpectQLiteralSsm.cpp
Normal file
28
src/reader2/IPrintable_DExpectQLiteralSsm.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DExpectQLiteralSsm.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DExpectQLiteralSsm.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DExpectQLiteralSsm.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/IPrintable_DExpectQLiteralSsm.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DExpectQLiteralSsm::pretty(const DExpectQLiteralSsm & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DExpectQLiteralSsm.cpp */
|
||||
79
src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp
Normal file
79
src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/** @file ISyntaxStateMachine_DExpectQLiteralSsm.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISyntaxStateMachine_DExpectQLiteralSsm.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISyntaxStateMachine_DExpectQLiteralSsm.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::ssm_type(const DExpectQLiteralSsm & self) noexcept -> syntaxstatetype
|
||||
{
|
||||
return self.ssm_type();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::get_expect_str(const DExpectQLiteralSsm & self) noexcept -> std::string_view
|
||||
{
|
||||
return self.get_expect_str();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_token(DExpectQLiteralSsm & self, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_token(tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_symbol(DExpectQLiteralSsm & self, std::string_view sym, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_symbol(sym, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_typedescr(DExpectQLiteralSsm & self, TypeDescr td, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_typedescr(td, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_formal(DExpectQLiteralSsm & self, const DUniqueString * param_name, TypeDescr param_type, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal(param_name, param_type, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_formal_with_token(DExpectQLiteralSsm & self, const DUniqueString * param_name, TypeDescr param_type, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal_with_token(param_name, param_type, tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_formal_arglist(DExpectQLiteralSsm & self, DArray * arglist, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal_arglist(arglist, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_expression(DExpectQLiteralSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression(expr, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_parsed_expression_with_token(DExpectQLiteralSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression_with_token(expr, tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQLiteralSsm::on_quoted_literal(DExpectQLiteralSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_quoted_literal(lit, p_psm);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ISyntaxStateMachine_DExpectQLiteralSsm.cpp */
|
||||
|
|
@ -330,6 +330,12 @@ namespace xo {
|
|||
this->top_ssm().on_parsed_expression_with_token(expr, tk, this);
|
||||
}
|
||||
|
||||
void
|
||||
ParserStateMachine::on_quoted_literal(obj<AGCObject> lit)
|
||||
{
|
||||
this->top_ssm().on_quoted_literal(lit, this);
|
||||
}
|
||||
|
||||
void
|
||||
ParserStateMachine::on_token(const Token & tk)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,11 +13,13 @@
|
|||
#include "ApplySsm.hpp"
|
||||
#include "SequenceSsm.hpp"
|
||||
#include "ParenSsm.hpp"
|
||||
#include "QuoteSsm.hpp"
|
||||
#include "ExpectFormalArglistSsm.hpp"
|
||||
#include "ExpectFormalArgSsm.hpp"
|
||||
#include "ExpectSymbolSsm.hpp"
|
||||
#include "ExpectTypeSsm.hpp"
|
||||
#include "ExpectExprSsm.hpp"
|
||||
#include "ExpectQLiteralSsm.hpp"
|
||||
#include "ProgressSsm.hpp"
|
||||
#include "SyntaxStateMachine.hpp"
|
||||
|
||||
|
|
@ -75,6 +77,12 @@ namespace xo {
|
|||
FacetRegistry::register_impl<ASyntaxStateMachine, DParenSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DParenSsm>();
|
||||
|
||||
FacetRegistry::register_impl<ASyntaxStateMachine, DQuoteSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DQuoteSsm>();
|
||||
|
||||
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectQLiteralSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DExpectQLiteralSsm>();
|
||||
|
||||
// misc types showing up in aux arena
|
||||
TypeRegistry::register_type<SchematikaParser>();
|
||||
// misc types showing up in parser stack arena
|
||||
|
|
@ -91,6 +99,7 @@ namespace xo {
|
|||
log && log(xtag("DExpectExprSsm.tseq", typeseq::id<DExpectExprSsm>()));
|
||||
log && log(xtag("DProgressSsm.tseq", typeseq::id<DProgressSsm>()));
|
||||
log && log(xtag("DParenSsm.tseq", typeseq::id<DParenSsm>()));
|
||||
log && log(xtag("DQuoteSsm.tseq", typeseq::id<DQuoteSsm>()));
|
||||
log && log(xtag("ASyntaxStateMachine.tseq", typeseq::id<ASyntaxStateMachine>()));
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ namespace xo {
|
|||
return "expect-type";
|
||||
case syntaxstatetype::expect_rhs_expression:
|
||||
return "expect-rhs-expression";
|
||||
case syntaxstatetype::expect_qliteral:
|
||||
return "expect-qliteral";
|
||||
case syntaxstatetype::N:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue