xo-interpreter2 stack: parse literal lists (w/ implicit types)
This commit is contained in:
parent
906bb2a913
commit
f2a9aa3f52
19 changed files with 1052 additions and 99 deletions
|
|
@ -69,6 +69,10 @@ set(SELF_SRCS
|
|||
ISyntaxStateMachine_DExpectQLiteralSsm.cpp
|
||||
IPrintable_DExpectQLiteralSsm.cpp
|
||||
|
||||
DExpectQListSsm.cpp
|
||||
ISyntaxStateMachine_DExpectQListSsm.cpp
|
||||
IPrintable_DExpectQListSsm.cpp
|
||||
|
||||
DProgressSsm.cpp
|
||||
ISyntaxStateMachine_DProgressSsm.cpp
|
||||
IPrintable_DProgressSsm.cpp
|
||||
|
|
|
|||
255
src/reader2/DExepctQListSsm.cpp
Normal file
255
src/reader2/DExepctQListSsm.cpp
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/* @file DExpectQListSsm.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
|
||||
|
||||
DExpectQListSsm::DExpectQListSsm()
|
||||
{}
|
||||
|
||||
DExpectQListSsm *
|
||||
DExpectQListSsm::_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<DExpectQListSsm>();
|
||||
|
||||
return new (mem) DExpectQListSsm();
|
||||
}
|
||||
|
||||
obj<ASyntaxStateMachine,DExpectQListSsm>
|
||||
DExpectQListSsm::make(DArena & arena)
|
||||
{
|
||||
obj<ASyntaxStateMachine,DExpectQListSsm> retval(_make(arena));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::start(ParserStateMachine * p_psm)
|
||||
{
|
||||
DArena::Checkpoint ckp = p_psm->parser_alloc().checkpoint();
|
||||
|
||||
p_psm->push_ssm(ckp, DExpectQListSsm::make(p_psm->parser_alloc()));
|
||||
}
|
||||
|
||||
syntaxstatetype
|
||||
DExpectQListSsm::ssm_type() const noexcept {
|
||||
return syntaxstatetype::expect_qliteral;
|
||||
}
|
||||
|
||||
std::string_view
|
||||
DExpectQListSsm::get_expect_str() const
|
||||
{
|
||||
return "leftparen|leftbracket|leftbrace|string|f64|i64|bool";
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::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
|
||||
DExpectQListSsm::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
|
||||
DExpectQListSsm::_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 DExpectQListSsm 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
|
||||
DExpectQListSsm::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
|
||||
DExpectQListSsm::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
|
||||
DExpectQListSsm::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
|
||||
DExpectQListSsm::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct(ppii,
|
||||
"DExpectQListSsm",
|
||||
refrtag("expect", this->get_expect_str()));
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DExpectQListSsm.cpp */
|
||||
215
src/reader2/DExpectQListSsm.cpp
Normal file
215
src/reader2/DExpectQListSsm.cpp
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/** @file DExpectQListSsm.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "ExpectQListSsm.hpp"
|
||||
#include "ExpectQLiteralSsm.hpp"
|
||||
#include <xo/object2/List.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/print/pretty.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::print::APrintable;
|
||||
using xo::facet::FacetRegistry;
|
||||
using xo::mm::AGCObject;
|
||||
|
||||
namespace scm {
|
||||
const char *
|
||||
QListXst::_descr(enum code x)
|
||||
{
|
||||
switch (x) {
|
||||
case code::invalid: break;
|
||||
case code::qlist_0: return "qlist_0";
|
||||
case code::qlist_1a: return "qlist_1a";
|
||||
case code::qlist_2: return "qlist_2";
|
||||
case code::N: break;
|
||||
}
|
||||
|
||||
return "?QListXst";
|
||||
}
|
||||
|
||||
DExpectQListSsm::DExpectQListSsm() : state_{QListXst::code::qlist_0} {}
|
||||
|
||||
obj<ASyntaxStateMachine,DExpectQListSsm>
|
||||
DExpectQListSsm::make(DArena & parser_mm)
|
||||
{
|
||||
return obj<ASyntaxStateMachine,DExpectQListSsm>(_make(parser_mm));
|
||||
}
|
||||
|
||||
DExpectQListSsm *
|
||||
DExpectQListSsm::_make(DArena & parser_mm)
|
||||
{
|
||||
void * mem = parser_mm.alloc_for<DExpectQListSsm>();
|
||||
|
||||
return new (mem) DExpectQListSsm();
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::start(ParserStateMachine * p_psm)
|
||||
{
|
||||
DArena::Checkpoint ckp = p_psm->parser_alloc().checkpoint();
|
||||
|
||||
p_psm->push_ssm(ckp, DExpectQListSsm::make(p_psm->parser_alloc()));
|
||||
}
|
||||
|
||||
syntaxstatetype
|
||||
DExpectQListSsm::ssm_type() const noexcept {
|
||||
return syntaxstatetype::expect_qlist;
|
||||
}
|
||||
|
||||
std::string_view
|
||||
DExpectQListSsm::get_expect_str() const {
|
||||
switch (state_.code()) {
|
||||
case QListXst::code::qlist_0:
|
||||
return "leftparen";
|
||||
case QListXst::code::qlist_1a:
|
||||
return "qliteral|rightparen";
|
||||
case QListXst::code::qlist_2:
|
||||
return "(done)";
|
||||
case QListXst::code::invalid:
|
||||
case QListXst::code::N:
|
||||
break;
|
||||
}
|
||||
|
||||
return "?DExpectQListSsm";
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::on_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch(tk.tk_type())
|
||||
{
|
||||
case tokentype::tk_leftparen:
|
||||
this->on_leftparen_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_rightparen:
|
||||
this->on_rightparen_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_comma:
|
||||
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_f64:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::on_leftparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (state_.code() == QListXst::code::qlist_0) {
|
||||
this->state_ = QListXst(QListXst::code::qlist_1a);
|
||||
this->start_ = DList::_nil();
|
||||
this->end_ = nullptr;
|
||||
|
||||
DExpectQLiteralSsm::start(p_psm,
|
||||
true /*cxl_on_rightparen*/);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::illegal_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::on_rightparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (state_.code() == QListXst::code::qlist_1a) {
|
||||
this->state_ = QListXst(QListXst::code::qlist_2);
|
||||
|
||||
obj<AGCObject> lit = obj<AGCObject,DList>(start_);
|
||||
|
||||
p_psm->pop_ssm();
|
||||
p_psm->on_quoted_literal(lit);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::illegal_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQListSsm::on_quoted_literal(obj<AGCObject> lit,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if(state_.code() == QListXst::code::qlist_1a) {
|
||||
// append lit at the end of list start_ .. end_
|
||||
{
|
||||
DList * new_last
|
||||
= DList::_cons(p_psm->expr_alloc(), lit, DList::_nil());
|
||||
|
||||
if (this->end_) {
|
||||
end_->assign_rest(new_last);
|
||||
|
||||
this->end_ = new_last;
|
||||
} else {
|
||||
this->start_ = DList::_cons(p_psm->expr_alloc(),
|
||||
lit,
|
||||
DList::_nil());
|
||||
this->end_ = this->start_;
|
||||
}
|
||||
}
|
||||
|
||||
// start syntax to receive next literal
|
||||
DExpectQLiteralSsm::start(p_psm,
|
||||
true /*cxl_on_rightparen*/);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::illegal_quoted_literal(lit, p_psm);
|
||||
}
|
||||
|
||||
bool
|
||||
DExpectQListSsm::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
obj<AGCObject,DList> list(start_);
|
||||
auto list_pr = FacetRegistry::instance().variant<APrintable,AGCObject>(list);
|
||||
|
||||
return ppii.pps()->pretty_struct(ppii,
|
||||
"DExpectQListSsm",
|
||||
refrtag("state", state_),
|
||||
refrtag("expect", this->get_expect_str()),
|
||||
refrtag("list", list_pr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* end DExpectQListSsm.cpp */
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
#include "ExpectQLiteralSsm.hpp"
|
||||
#include "ExpectQListSsm.hpp"
|
||||
#include <xo/object2/Float.hpp>
|
||||
//#include "DExpectFormalArgSsm.hpp"
|
||||
//#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp"
|
||||
|
|
@ -24,31 +25,13 @@ namespace xo {
|
|||
// 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(bool cxl_on_rightparen)
|
||||
: cxl_on_rightparen_{cxl_on_rightparen}
|
||||
{}
|
||||
|
||||
DExpectQLiteralSsm *
|
||||
DExpectQLiteralSsm::_make(DArena & arena)
|
||||
DExpectQLiteralSsm::_make(DArena & arena,
|
||||
bool cxl_on_rightparen)
|
||||
{
|
||||
/* out-of-order so argl follows ssm in arena,
|
||||
* consistent with any subsequent arglist realloc.
|
||||
|
|
@ -57,23 +40,26 @@ namespace xo {
|
|||
|
||||
void * mem = arena.alloc_for<DExpectQLiteralSsm>();
|
||||
|
||||
return new (mem) DExpectQLiteralSsm();
|
||||
return new (mem) DExpectQLiteralSsm(cxl_on_rightparen);
|
||||
}
|
||||
|
||||
obj<ASyntaxStateMachine,DExpectQLiteralSsm>
|
||||
DExpectQLiteralSsm::make(DArena & arena)
|
||||
DExpectQLiteralSsm::make(DArena & arena,
|
||||
bool cxl_on_rightparen)
|
||||
{
|
||||
obj<ASyntaxStateMachine,DExpectQLiteralSsm> retval(_make(arena));
|
||||
|
||||
obj<ASyntaxStateMachine,DExpectQLiteralSsm> retval(_make(arena,
|
||||
cxl_on_rightparen));
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::start(ParserStateMachine * p_psm)
|
||||
DExpectQLiteralSsm::start(ParserStateMachine * p_psm,
|
||||
bool cxl_on_rightparen)
|
||||
{
|
||||
DArena::Checkpoint ckp = p_psm->parser_alloc().checkpoint();
|
||||
|
||||
p_psm->push_ssm(ckp, DExpectQLiteralSsm::make(p_psm->parser_alloc()));
|
||||
p_psm->push_ssm(ckp, DExpectQLiteralSsm::make(p_psm->parser_alloc(),
|
||||
cxl_on_rightparen));
|
||||
}
|
||||
|
||||
syntaxstatetype
|
||||
|
|
@ -97,8 +83,14 @@ namespace xo {
|
|||
return;
|
||||
|
||||
case tokentype::tk_leftparen:
|
||||
case tokentype::tk_comma:
|
||||
this->on_leftparen_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_rightparen:
|
||||
this->on_rightparen_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_comma:
|
||||
case tokentype::tk_lambda:
|
||||
case tokentype::tk_def:
|
||||
case tokentype::tk_if:
|
||||
|
|
@ -197,21 +189,18 @@ namespace xo {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef NOT_YET
|
||||
void
|
||||
DExpectQLiteralSsm::on_leftparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (fastate_ == formalarglstatetype::argl_0) {
|
||||
this->fastate_ = formalarglstatetype::argl_1a;
|
||||
// replace self with specialized version for parsing a literal list
|
||||
|
||||
DExpectFormalArgSsm::start(p_psm);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
p_psm->pop_ssm();
|
||||
DExpectQListSsm::start(p_psm);
|
||||
p_psm->on_token(tk);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
void
|
||||
DExpectQLiteralSsm::on_comma_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
|
|
@ -225,22 +214,20 @@ namespace xo {
|
|||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
DExpectQLiteralSsm::on_rightparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (fastate_ == formalarglstatetype::argl_1b) {
|
||||
DArray * args = argl_;
|
||||
|
||||
if (cxl_on_rightparen_) {
|
||||
p_psm->pop_ssm();
|
||||
p_psm->on_parsed_formal_arglist(args);
|
||||
p_psm->on_token(tk);
|
||||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
DExpectQLiteralSsm::pretty(const ppindentinfo & ppii) const
|
||||
|
|
|
|||
28
src/reader2/IPrintable_DExpectQListSsm.cpp
Normal file
28
src/reader2/IPrintable_DExpectQListSsm.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DExpectQListSsm.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DExpectQListSsm.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DExpectQListSsm.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/IPrintable_DExpectQListSsm.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DExpectQListSsm::pretty(const DExpectQListSsm & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DExpectQListSsm.cpp */
|
||||
79
src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp
Normal file
79
src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/** @file ISyntaxStateMachine_DExpectQListSsm.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISyntaxStateMachine_DExpectQListSsm.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISyntaxStateMachine_DExpectQListSsm.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/ISyntaxStateMachine_DExpectQListSsm.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::ssm_type(const DExpectQListSsm & self) noexcept -> syntaxstatetype
|
||||
{
|
||||
return self.ssm_type();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::get_expect_str(const DExpectQListSsm & self) noexcept -> std::string_view
|
||||
{
|
||||
return self.get_expect_str();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_token(DExpectQListSsm & self, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_token(tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_parsed_symbol(DExpectQListSsm & self, std::string_view sym, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_symbol(sym, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_parsed_typedescr(DExpectQListSsm & self, TypeDescr td, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_typedescr(td, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_parsed_formal(DExpectQListSsm & self, const DUniqueString * param_name, TypeDescr param_type, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal(param_name, param_type, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_parsed_formal_with_token(DExpectQListSsm & 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_DExpectQListSsm::on_parsed_formal_arglist(DExpectQListSsm & self, DArray * arglist, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal_arglist(arglist, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_parsed_expression(DExpectQListSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression(expr, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_parsed_expression_with_token(DExpectQListSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression_with_token(expr, tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExpectQListSsm::on_quoted_literal(DExpectQListSsm & self, obj<AGCObject> lit, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_quoted_literal(lit, p_psm);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ISyntaxStateMachine_DExpectQListSsm.cpp */
|
||||
|
|
@ -14,14 +14,15 @@
|
|||
#include "SequenceSsm.hpp"
|
||||
#include "ParenSsm.hpp"
|
||||
#include "QuoteSsm.hpp"
|
||||
#include "ProgressSsm.hpp"
|
||||
#include "SyntaxStateMachine.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"
|
||||
#include "ExpectQListSsm.hpp"
|
||||
|
||||
#include <xo/printable2/detail/APrintable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
@ -83,6 +84,9 @@ namespace xo {
|
|||
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectQLiteralSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DExpectQLiteralSsm>();
|
||||
|
||||
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectQListSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DExpectQListSsm>();
|
||||
|
||||
// misc types showing up in aux arena
|
||||
TypeRegistry::register_type<SchematikaParser>();
|
||||
// misc types showing up in parser stack arena
|
||||
|
|
@ -97,6 +101,9 @@ namespace xo {
|
|||
log && log(xtag("DExpectSymbolSsm.tseq", typeseq::id<DExpectSymbolSsm>()));
|
||||
log && log(xtag("DExpectTypeSsm.tseq", typeseq::id<DExpectTypeSsm>()));
|
||||
log && log(xtag("DExpectExprSsm.tseq", typeseq::id<DExpectExprSsm>()));
|
||||
log && log(xtag("DExpectQLiteralSsm.tseq", typeseq::id<DExpectQLiteralSsm>()));
|
||||
log && log(xtag("DExpectQListSsm.tseq", typeseq::id<DExpectQListSsm>()));
|
||||
|
||||
log && log(xtag("DProgressSsm.tseq", typeseq::id<DProgressSsm>()));
|
||||
log && log(xtag("DParenSsm.tseq", typeseq::id<DParenSsm>()));
|
||||
log && log(xtag("DQuoteSsm.tseq", typeseq::id<DQuoteSsm>()));
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ namespace xo {
|
|||
return "expect-rhs-expression";
|
||||
case syntaxstatetype::expect_qliteral:
|
||||
return "expect-qliteral";
|
||||
case syntaxstatetype::expect_qlist:
|
||||
return "expect-qlist";
|
||||
case syntaxstatetype::N:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue