xo-reader2: rename DExprSeqState -> DToplevelSeqSsm
This commit is contained in:
parent
f48927a4be
commit
44e6bac3b2
17 changed files with 180 additions and 180 deletions
|
|
@ -17,9 +17,9 @@ set(SELF_SRCS
|
|||
syntaxstatetype.cpp
|
||||
ISyntaxStateMachine_Any.cpp
|
||||
|
||||
DExprSeqState.cpp
|
||||
ISyntaxStateMachine_DExprSeqState.cpp
|
||||
IPrintable_DExprSeqState.cpp
|
||||
DToplevelSeqSsm.cpp
|
||||
ISyntaxStateMachine_DToplevelSeqSsm.cpp
|
||||
IPrintable_DToplevelSeqSsm.cpp
|
||||
|
||||
DDefineSsm.cpp
|
||||
ISyntaxStateMachine_DDefineSsm.cpp
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/** @file DExprSeqState.cpp
|
||||
/** @file DToplevelSeqSsm.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "DExprSeqState.hpp"
|
||||
#include "ssm/ISyntaxStateMachine_DExprSeqState.hpp"
|
||||
#include "DToplevelSeqSsm.hpp"
|
||||
#include "ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp"
|
||||
#include "DDefineSsm.hpp"
|
||||
#include "DLambdaSsm.hpp"
|
||||
#include "ProgressSsm.hpp"
|
||||
|
|
@ -55,7 +55,7 @@ namespace xo {
|
|||
return "exprseqtype?";
|
||||
}
|
||||
|
||||
DExprSeqState::DExprSeqState(exprseqtype ty) : seqtype_{ty}
|
||||
DToplevelSeqSsm::DToplevelSeqSsm(exprseqtype ty) : seqtype_{ty}
|
||||
{}
|
||||
|
||||
namespace {
|
||||
|
|
@ -63,17 +63,17 @@ namespace xo {
|
|||
make_exprseq_ssm(DArena & mm,
|
||||
exprseqtype seqtype)
|
||||
{
|
||||
void * mem = mm.alloc(typeseq::id<DExprSeqState>(),
|
||||
sizeof(DExprSeqState));
|
||||
void * mem = mm.alloc(typeseq::id<DToplevelSeqSsm>(),
|
||||
sizeof(DToplevelSeqSsm));
|
||||
|
||||
DExprSeqState * ssm = new (mem) DExprSeqState(seqtype);
|
||||
DToplevelSeqSsm * ssm = new (mem) DToplevelSeqSsm(seqtype);
|
||||
|
||||
return obj<ASyntaxStateMachine,DExprSeqState>(ssm);
|
||||
return obj<ASyntaxStateMachine,DToplevelSeqSsm>(ssm);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DExprSeqState::establish_interactive(DArena & mm,
|
||||
DToplevelSeqSsm::establish_interactive(DArena & mm,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->establish_toplevel_ssm(make_exprseq_ssm
|
||||
|
|
@ -82,7 +82,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::establish_batch(DArena & mm,
|
||||
DToplevelSeqSsm::establish_batch(DArena & mm,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->establish_toplevel_ssm(make_exprseq_ssm
|
||||
|
|
@ -93,13 +93,13 @@ namespace xo {
|
|||
// SyntaxStateMachine facet methods
|
||||
|
||||
syntaxstatetype
|
||||
DExprSeqState::ssm_type() const noexcept
|
||||
DToplevelSeqSsm::ssm_type() const noexcept
|
||||
{
|
||||
return syntaxstatetype::expect_toplevel_expression_sequence;
|
||||
}
|
||||
|
||||
std::string_view
|
||||
DExprSeqState::get_expect_str() const noexcept
|
||||
DToplevelSeqSsm::get_expect_str() const noexcept
|
||||
{
|
||||
// TODO: provisional. Will expand as more syntax implemented
|
||||
|
||||
|
|
@ -113,11 +113,11 @@ namespace xo {
|
|||
}
|
||||
|
||||
assert(false);
|
||||
return "impossible-DExprSeqState::get_expr_str";
|
||||
return "impossible-DToplevelSeqSsm::get_expr_str";
|
||||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
scope log(XO_DEBUG(p_psm->debug_flag()), xtag("tk", tk));
|
||||
|
|
@ -197,13 +197,13 @@ namespace xo {
|
|||
break;
|
||||
}
|
||||
|
||||
p_psm->illegal_input_on_token("DExprSeqState::on_token",
|
||||
p_psm->illegal_input_on_token("DToplevelSeqSsm::on_token",
|
||||
tk,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_symbol_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_symbol_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -215,7 +215,7 @@ namespace xo {
|
|||
if (var) {
|
||||
DProgressSsm::start(var, p_psm);
|
||||
} else {
|
||||
p_psm->unknown_variable_error("DExprSeqState::on_symbol_token",
|
||||
p_psm->unknown_variable_error("DToplevelSeqSsm::on_symbol_token",
|
||||
tk,
|
||||
this->get_expect_str(),
|
||||
p_psm);
|
||||
|
|
@ -234,7 +234,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_def_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_def_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
(void)tk;
|
||||
|
|
@ -250,7 +250,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_lambda_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_lambda_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
(void)tk;
|
||||
|
|
@ -271,7 +271,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_if_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_if_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -291,7 +291,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_string_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_string_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -318,7 +318,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_f64_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_f64_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -344,7 +344,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_i64_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_i64_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -370,7 +370,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_bool_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_bool_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -396,7 +396,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_leftparen_token(const Token & tk,
|
||||
DToplevelSeqSsm::on_leftparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
|
|
@ -423,21 +423,21 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_parsed_expression(obj<AExpression> expr,
|
||||
DToplevelSeqSsm::on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
// toplevel expr sequence accepts an arbitrary number of expressions.
|
||||
|
||||
p_psm->capture_result("DExprSeqState::on_parsed_expression", expr);
|
||||
p_psm->capture_result("DToplevelSeqSsm::on_parsed_expression", expr);
|
||||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_parsed_expression_with_token(obj<AExpression> expr,
|
||||
DToplevelSeqSsm::on_parsed_expression_with_token(obj<AExpression> expr,
|
||||
const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (tk.tk_type() == tokentype::tk_semicolon) {
|
||||
p_psm->capture_result("DExprSeqState::on_parsed_expression_with_token", expr);
|
||||
p_psm->capture_result("DToplevelSeqSsm::on_parsed_expression_with_token", expr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -445,14 +445,14 @@ namespace xo {
|
|||
}
|
||||
|
||||
bool
|
||||
DExprSeqState::pretty(const ppindentinfo & ppii) const
|
||||
DToplevelSeqSsm::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DExprSeqState",
|
||||
"DToplevelSeqSsm",
|
||||
refrtag("seqtype", seqtype_));
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DExprSeqState.cpp */
|
||||
/* end DToplevelSeqSsm.cpp */
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
/** @file IPrintable_DExprSeqState.cpp
|
||||
/** @file IPrintable_DToplevelSeqSsm.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DExprSeqState.json5]
|
||||
* --input [idl/IPrintable_DToplevelSeqSsm.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DExprSeqState.json5]
|
||||
* [idl/IPrintable_DToplevelSeqSsm.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/IPrintable_DExprSeqState.hpp"
|
||||
#include "ssm/IPrintable_DToplevelSeqSsm.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DExprSeqState::pretty(const DExprSeqState & self, const ppindentinfo & ppii) -> bool
|
||||
IPrintable_DToplevelSeqSsm::pretty(const DToplevelSeqSsm & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
|
@ -25,4 +25,4 @@ namespace xo {
|
|||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DExprSeqState.cpp */
|
||||
/* end IPrintable_DToplevelSeqSsm.cpp */
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/** @file ISyntaxStateMachine_DExprSeqState.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISyntaxStateMachine_DExprSeqState.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISyntaxStateMachine_DExprSeqState.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/ISyntaxStateMachine_DExprSeqState.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::ssm_type(const DExprSeqState & self) noexcept -> syntaxstatetype
|
||||
{
|
||||
return self.ssm_type();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::get_expect_str(const DExprSeqState & self) noexcept -> std::string_view
|
||||
{
|
||||
return self.get_expect_str();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_token(DExprSeqState & self, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_token(tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_parsed_symbol(DExprSeqState & self, std::string_view sym, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_symbol(sym, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_parsed_typedescr(DExprSeqState & self, TypeDescr td, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_typedescr(td, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_parsed_formal(DExprSeqState & self, const DUniqueString * param_name, TypeDescr param_type, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal(param_name, param_type, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_parsed_formal_arglist(DExprSeqState & self, DArray * arglist, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal_arglist(arglist, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_parsed_expression(DExprSeqState & self, obj<AExpression> expr, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression(expr, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DExprSeqState::on_parsed_expression_with_token(DExprSeqState & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression_with_token(expr, tk, p_psm);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ISyntaxStateMachine_DExprSeqState.cpp */
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/** @file ISyntaxStateMachine_DToplevelSeqSsm.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISyntaxStateMachine_DToplevelSeqSsm.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISyntaxStateMachine_DToplevelSeqSsm.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::ssm_type(const DToplevelSeqSsm & self) noexcept -> syntaxstatetype
|
||||
{
|
||||
return self.ssm_type();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::get_expect_str(const DToplevelSeqSsm & self) noexcept -> std::string_view
|
||||
{
|
||||
return self.get_expect_str();
|
||||
}
|
||||
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_token(DToplevelSeqSsm & self, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_token(tk, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_parsed_symbol(DToplevelSeqSsm & self, std::string_view sym, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_symbol(sym, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_parsed_typedescr(DToplevelSeqSsm & self, TypeDescr td, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_typedescr(td, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_parsed_formal(DToplevelSeqSsm & self, const DUniqueString * param_name, TypeDescr param_type, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal(param_name, param_type, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_parsed_formal_arglist(DToplevelSeqSsm & self, DArray * arglist, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_formal_arglist(arglist, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_parsed_expression(DToplevelSeqSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression(expr, p_psm);
|
||||
}
|
||||
auto
|
||||
ISyntaxStateMachine_DToplevelSeqSsm::on_parsed_expression_with_token(DToplevelSeqSsm & self, obj<AExpression> expr, const Token & tk, ParserStateMachine * p_psm) -> void
|
||||
{
|
||||
self.on_parsed_expression_with_token(expr, tk, p_psm);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ISyntaxStateMachine_DToplevelSeqSsm.cpp */
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include "SchematikaParser.hpp"
|
||||
#include "ParserStateMachine.hpp"
|
||||
#include "ParserStack.hpp"
|
||||
#include "DExprSeqState.hpp"
|
||||
#include "DToplevelSeqSsm.hpp"
|
||||
#include <cstddef>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
#include <stdexcept>
|
||||
|
|
@ -65,14 +65,14 @@ namespace xo {
|
|||
void
|
||||
SchematikaParser::begin_interactive_session()
|
||||
{
|
||||
DExprSeqState::establish_interactive(psm_.parser_alloc(), &psm_);
|
||||
DToplevelSeqSsm::establish_interactive(psm_.parser_alloc(), &psm_);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
SchematikaParser::begin_batch_session()
|
||||
{
|
||||
DExprSeqState::establish_batch(psm_.parser_alloc(), &psm_);
|
||||
DToplevelSeqSsm::establish_batch(psm_.parser_alloc(), &psm_);
|
||||
}
|
||||
|
||||
const ParserResult &
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "reader2_register_facets.hpp"
|
||||
|
||||
#include "SchematikaParser.hpp"
|
||||
#include "ExprSeqState.hpp"
|
||||
#include "ToplevelSeqSsm.hpp"
|
||||
#include "DefineSsm.hpp"
|
||||
#include "LambdaSsm.hpp"
|
||||
#include "IfElseSsm.hpp"
|
||||
|
|
@ -37,8 +37,8 @@ namespace xo {
|
|||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
FacetRegistry::register_impl<ASyntaxStateMachine, DExprSeqState>();
|
||||
FacetRegistry::register_impl<APrintable, DExprSeqState>();
|
||||
FacetRegistry::register_impl<ASyntaxStateMachine, DToplevelSeqSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DToplevelSeqSsm>();
|
||||
|
||||
FacetRegistry::register_impl<ASyntaxStateMachine, DDefineSsm>();
|
||||
FacetRegistry::register_impl<APrintable, DDefineSsm>();
|
||||
|
|
@ -80,7 +80,7 @@ namespace xo {
|
|||
// misc types showing up in parser stack arena
|
||||
TypeRegistry::register_type<ParserStack>();
|
||||
|
||||
log && log(xtag("DExprSeqState.tseq", typeseq::id<DExprSeqState>()));
|
||||
log && log(xtag("DToplevelSeqSsm.tseq", typeseq::id<DToplevelSeqSsm>()));
|
||||
log && log(xtag("DDefineSsm.tseq", typeseq::id<DDefineSsm>()));
|
||||
log && log(xtag("DLambdaSsm.tseq", typeseq::id<DLambdaSsm>()));
|
||||
log && log(xtag("DIfElseSsm.tseq", typeseq::id<DIfElseSsm>()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue