xo-reader2: + DExpectFormalArgSsm [WIP]

This commit is contained in:
Roland Conybeare 2026-01-28 17:40:57 -05:00
commit 02e83594c4
14 changed files with 684 additions and 17 deletions

View file

@ -128,6 +128,8 @@ namespace xo {
return false;
}
pps->write(">");
return true;
} else {
pps->write("<ApplyExpr");
@ -146,6 +148,8 @@ namespace xo {
pps->pretty(refrtag(concat("arg", 1+i_arg), arg_i));
}
pps->write(">");
return false;
}
}

View file

@ -138,6 +138,20 @@ xo_add_genfacetimpl(
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-reader2-facetimpl-syntaxstatemachine-expectformalargssm
FACET_PKG xo_reader2
FACET SyntaxStateMachine
REPR ExpectFormalArgSsm
INPUT idl/ISyntaxStateMachine_DExpectFormalArgSsm.json5
OUTPUT_HPP_DIR include/xo/reader2
OUTPUT_IMPL_SUBDIR ssm
OUTPUT_CPP_DIR src/reader2
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-reader2-facetimpl-syntaxstatemachine-ifelsessm

View file

@ -0,0 +1,13 @@
{
mode: "implementation",
includes: [ "\"SyntaxStateMachine.hpp\"",
"\"ssm/ISyntaxStateMachine_Xfer.hpp\"" ],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/SyntaxStateMachine.json5",
brief: "provide ASyntaxStateMachine interface for DExpectFormalArgSsm",
using_doxygen: true,
repr: "DExpectFormalArgSsm",
doc: [ "implement ASyntaxStateMachine for DExpectFormalArgSsm" ],
}

View file

@ -0,0 +1,139 @@
/** @file DExpectFormalSsm.hpp
*
* @author Roland Conybeare, Aug 2024
**/
#pragma once
#include "SyntaxStateMachine.hpp"
//#include <xo/arena/DArena.hpp>
//#include "exprstate.hpp"
namespace xo {
namespace scm {
/**
* name : type
* ^ ^ ^
* | | formal_2
* | formal_1
* formal_0
*
* formal_0 --on_symbol()--> formal_1
* formal_1 --on_colon_token()--> formal_2
* formal_2 --on_typedescr()--> (done)
**/
enum class formalstatetype {
invalid = -1,
formal_0,
formal_1,
formal_2,
n_formalstatetype,
};
extern const char *
formalstatetype_descr(formalstatetype x);
inline std::ostream &
operator<< (std::ostream & os, formalstatetype x) {
os << formalstatetype_descr(x);
return os;
}
/** @class expect_formal_xs
* @brief parser state-machine for a typed formal parameter
**/
class DExpectFormalArgSsm {
public:
using TypeDescr = xo::reflect::TypeDescr;
using DArena = xo::mm::DArena;
public:
DExpectFormalArgSsm();
/** create empty instance using memory from @p mm **/
DExpectFormalArgSsm * _make(DArena & mm);
static void start(ParserStateMachine * p_psm);
/** @defgroup scm-expectformalargssm-ssm-facet syntaxstatemachine facet methods **/
///@{
/** identifies the ssm implemented here **/
syntaxstatetype ssm_type() const noexcept;
/** mnemonic for expected input (for this ssm) in current state **/
std::string_view get_expect_str() const noexcept;
/** update state on incoming token @p tk,
* with overall parser state in @p p_psm
**/
void on_token(const Token & tk,
ParserStateMachine * p_psm);
/** update state on parsed symbol @p sym emitted by nested ssm,
* with overall parser state in @p p_psm
**/
void on_parsed_symbol(std::string_view sym,
ParserStateMachine * p_psm);
/** update state on parsed typedescr @p td emitted by nested ssm,
* with overall parser state in @p p_psm
**/
void on_parsed_typedescr(TypeDescr td,
ParserStateMachine * p_psm);
/** update state on parsed expression emitted by nested ssm
* with overall parser state in @p p_psm
**/
void on_parsed_expression(obj<AExpression> expr,
ParserStateMachine * p_psm);
/** update state on parsed expression, along with following semicolon,
* emitted by nested ssm with overall parser state in @p p_psm
**/
void on_parsed_expression_with_semicolon(obj<AExpression> expr,
ParserStateMachine * p_psm);
///@}
#ifdef NOT_YET
virtual void on_symbol(const std::string & symbol_name,
parserstatemachine * p_psm) override;
virtual void on_colon_token(const token_type & tk,
parserstatemachine * p_psm) override;
// virtual void on_comma_token(...) override;
#ifdef PROBABLY_NOT
virtual void on_rightparen_token(const token_type & tk,
exprstatestack * p_stack,
rp<Expression> * p_emit_expr) override;
#endif
virtual void on_typedescr(TypeDescr td,
parserstatemachine * p_psm) override;
virtual void print(std::ostream & os) const override;
private:
static std::unique_ptr<expect_formal_xs> make();
#endif
private:
/** parsing state-machine state **/
formalstatetype fstate_ = formalstatetype::formal_0;
/** formal parameter name **/
const DUniqueString * name_ = nullptr;
/** formal parameter type (if specified) **/
TypeDescr td_ = nullptr;
};
} /*namespace scm*/
} /*namespace xo*/
/* end DExpectFormalArgSsm.hpp */

View file

@ -68,12 +68,21 @@ namespace xo {
static void start(ParserStateMachine * p_psm);
/** @defgroup scm-expectformalarglistssm-methods general methods **/
///@{
/** update state on incoming token @p tk, with overall parser state in @p psm **/
void on_leftparen_token(const Token & tk,
ParserStateMachine * p_psm);
///@}
/** @defgroup scm-expectformalarglistssm-ssm-facet syntaxstatemachine facet methods **/
///@{
/** identifies the ssm implemented here **/
syntaxstatetype ssm_type() const noexcept;
/** mnemonic for expected input (for this ssm) in current state **/
std::string_view get_expect_str() const;
/** update state on incoming token @p tk,
@ -108,8 +117,6 @@ namespace xo {
#ifdef NOT_YET
virtual void on_leftparen_token(const token_type & tk,
parserstatemachine * p_psm) override;
virtual void on_formal(const rp<Variable> & formal,
parserstatemachine * p_psm) override;
virtual void on_comma_token(const token_type & tk,

View file

@ -0,0 +1,73 @@
/** @file ISyntaxStateMachine_DExpectFormalArgSsm.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/ISyntaxStateMachine_DExpectFormalArgSsm.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/ISyntaxStateMachine_DExpectFormalArgSsm.json5]
**/
#pragma once
#include "SyntaxStateMachine.hpp"
#include "SyntaxStateMachine.hpp"
#include "ssm/ISyntaxStateMachine_Xfer.hpp"
#include "DExpectFormalArgSsm.hpp"
namespace xo { namespace scm { class ISyntaxStateMachine_DExpectFormalArgSsm; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::ASyntaxStateMachine,
xo::scm::DExpectFormalArgSsm>
{
using ImplType = xo::scm::ISyntaxStateMachine_Xfer
<xo::scm::DExpectFormalArgSsm,
xo::scm::ISyntaxStateMachine_DExpectFormalArgSsm>;
};
}
}
namespace xo {
namespace scm {
/** @class ISyntaxStateMachine_DExpectFormalArgSsm
**/
class ISyntaxStateMachine_DExpectFormalArgSsm {
public:
/** @defgroup scm-syntaxstatemachine-dexpectformalargssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
///@}
/** @defgroup scm-syntaxstatemachine-dexpectformalargssm-methods **/
///@{
// const methods
/** identify a type of syntax state machine **/
static syntaxstatetype ssm_type(const DExpectFormalArgSsm & self) noexcept;
/** text describing expected/allowed input to this ssm in current state **/
static std::string_view get_expect_str(const DExpectFormalArgSsm & self) noexcept;
// non-const methods
/** operate state machine for incoming token @p tk **/
static void on_token(DExpectFormalArgSsm & self, const Token & tk, ParserStateMachine * p_psm);
/** update stat machine for incoming parsed symbol @p sym **/
static void on_parsed_symbol(DExpectFormalArgSsm & self, std::string_view sym, ParserStateMachine * p_psm);
/** operate state machine for incoming type description @p td **/
static void on_parsed_typedescr(DExpectFormalArgSsm & self, TypeDescr td, ParserStateMachine * p_psm);
/** update state machine for incoming parsed expression @p expr **/
static void on_parsed_expression(DExpectFormalArgSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm);
/** update state machine for incoming parsed expression @p expr followed by semicolon **/
static void on_parsed_expression_with_semicolon(DExpectFormalArgSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm);
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -24,6 +24,9 @@ namespace xo {
/** expecting a formal argument list (sub-syntax within lambda-expression) **/
expect_formal_arglist,
/** expecting a formal argument (sub-syntax within formal-arglist) **/
expect_formal_arg,
/** expecting a s symbol. See @ref DExpectSymbolSsm **/
expect_symbol,

View file

@ -37,6 +37,10 @@ set(SELF_SRCS
ISyntaxStateMachine_DExpectFormalArglistSsm.cpp
IPrintable_DExpectFormalArglistSsm.cpp
DExpectFormalArgSsm.cpp
ISyntaxStateMachine_DExpectFormalArgSsm.cpp
# IPrintable_DExpectFormalArgSsm.cpp
DExpectSymbolSsm.cpp
ISyntaxStateMachine_DExpectSymbolSsm.cpp
IPrintable_DExpectSymbolSsm.cpp

View file

@ -0,0 +1,235 @@
/** @file DExpectFormalArgSsm.cpp
*
* @author Roland Conybeare, Jan 2026
**/
#include "DExpectFormalArgSsm.hpp"
#ifdef NOT_YET
#include "expect_symbol_xs.hpp"
#include "expect_type_xs.hpp"
#include "parserstatemachine.hpp"
#include "exprstatestack.hpp"
#include "xo/expression/Variable.hpp"
#endif
namespace xo {
using xo::scm::DVariable;
using xo::reflect::TypeDescr;
using xo::facet::typeseq;
namespace scm {
const char *
formalstatetype_descr(formalstatetype x) {
switch (x) {
case formalstatetype::invalid:
case formalstatetype::n_formalstatetype:
return "?formalstatetype";
case formalstatetype::formal_0:
return "formal_0";
case formalstatetype::formal_1:
return "formal_1";
case formalstatetype::formal_2:
return "formal_2";
}
return "???formalstatetype";
}
DExpectFormalArgSsm::DExpectFormalArgSsm() = default;
DExpectFormalArgSsm *
DExpectFormalArgSsm::_make(DArena & mm)
{
void * mem = mm.alloc(typeseq::id<DExpectFormalArgSsm>(), sizeof(DExpectFormalArgSsm));
return new (mem) DExpectFormalArgSsm();
}
syntaxstatetype
DExpectFormalArgSsm::ssm_type() const noexcept {
return syntaxstatetype::expect_formal_arg;
}
std::string_view
DExpectFormalArgSsm::get_expect_str() const noexcept
{
switch(fstate_) {
case formalstatetype::invalid:
case formalstatetype::n_formalstatetype:
break;
case formalstatetype::formal_0:
return "formal-name";
case formalstatetype::formal_1:
return "colon|typename";
case formalstatetype::formal_2:
return "typename";
}
return "?expect";
}
/** update state on incoming token @p tk,
* with overall parser state in @p p_psm
**/
void
DExpectFormalArgSsm::on_token(const Token & tk,
ParserStateMachine * p_psm)
{
switch (tk.tk_type()) {
// all the not-yet-handled cases
case tokentype::tk_leftparen:
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_rightparen:
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_comma:
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;
}
p_psm->illegal_input_on_token("DExpectFormalArgSsm::on_token",
tk,
this->get_expect_str());
}
void
DExpectFormalArgSsm::on_parsed_symbol(std::string_view sym,
ParserStateMachine * p_psm)
{
p_psm->illegal_input_on_symbol("DExpectFormalArgSsm::on_parsed_symbol",
sym,
this->get_expect_str());
}
void
DExpectFormalArgSsm::on_parsed_typedescr(TypeDescr td,
ParserStateMachine * p_psm)
{
p_psm->illegal_input_on_typedescr("DExpectFormalArgSsm::on_parsed_typedescr",
td,
this->get_expect_str());
}
void
DExpectFormalArgSsm::on_parsed_expression(obj<AExpression> expr,
ParserStateMachine * p_psm)
{
p_psm->illegal_parsed_expression("DExpectFormalArgSsm::on_parsed_expression",
expr,
this->get_expect_str());
}
void
DExpectFormalArgSsm::on_parsed_expression_with_semicolon(obj<AExpression> expr,
ParserStateMachine * p_psm)
{
p_psm->illegal_parsed_expression("DExpectFormalArgSsm::on_parsed_expression_with_semicolon",
expr,
this->get_expect_str());
}
#ifdef NOT_YET
void
DExpectFormalSsm::start(ParserStateMachine * p_psm) {
p_psm->push_exprstate(expect_formal_xs::make());
expect_symbol_xs::start(p_psm);
}
expect_formal_xs::expect_formal_xs()
: exprstate(exprstatetype::expect_formal)
{}
void
expect_formal_xs::on_symbol(const std::string & symbol_name,
parserstatemachine * p_psm)
{
if (this->formalxs_type_ == formalstatetype::formal_0) {
this->formalxs_type_ = formalstatetype::formal_1;
this->result_.assign_name(symbol_name);
} else {
exprstate::on_symbol(symbol_name, p_psm);
}
}
void
expect_formal_xs::on_colon_token(const token_type & tk,
parserstatemachine * p_psm)
{
if (this->formalxs_type_ == formalstatetype::formal_1) {
this->formalxs_type_ = formalstatetype::formal_2;
expect_type_xs::start(p_psm);
/* control reenters via expect_formal_xs::on_typedescr() */
} else {
exprstate::on_colon_token(tk,
p_psm);
}
}
void
expect_formal_xs::on_typedescr(TypeDescr td,
parserstatemachine * p_psm)
{
if (this->formalxs_type_ == formalstatetype::formal_2) {
this->result_.assign_td(td);
std::unique_ptr<exprstate> self = p_psm->pop_exprstate();
rp<Variable> var = Variable::make(result_.name(),
result_.td());
p_psm->top_exprstate().on_formal(var, p_psm);
} else {
exprstate::on_typedescr(td, p_psm);
}
}
void
expect_formal_xs::print(std::ostream & os) const {
os << "<expect_formal_xs"
<< xtag("type", formalxs_type_);
if (!result_.name().empty())
os << xtag("result.name", result_.name());
if (result_.td())
os << xtag("result.td", result_.td());
os << ">";
}
#endif
} /*namespace scm*/
} /*namespace xo*/
/* end DExpectFormalArgSsm.cpp */

View file

@ -5,7 +5,10 @@
#include "DExpectFormalArglistSsm.hpp"
#include "ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp"
#include <xo/printable2/Printable.hpp>
#include <xo/alloc2/arena/IAllocator_DArena.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp>
#ifdef NOT_YET
#include "parserstatemachine.hpp"
@ -17,8 +20,12 @@
#endif
namespace xo {
using xo::mm::AAllocator;
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 {
@ -106,6 +113,54 @@ namespace xo {
DExpectFormalArglistSsm::on_token(const Token & tk,
ParserStateMachine * p_psm)
{
switch (tk.tk_type()) {
case tokentype::tk_leftparen:
this->on_leftparen_token(tk, p_psm);
return;
// all the not-yet-handled cases
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_rightparen:
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_comma:
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;
}
p_psm->illegal_input_on_token("DExpectFormalArglistSsm::on_token",
tk,
this->get_expect_str());
@ -152,20 +207,29 @@ namespace xo {
: exprstate(exprstatetype::expect_formal_arglist),
farglxs_type_{formalarglstatetype::argl_0}
{}
#endif
void
expect_formal_arglist_xs::on_leftparen_token(const token_type & tk,
parserstatemachine * p_psm)
DExpectFormalArglistSsm::on_leftparen_token(const Token & tk,
ParserStateMachine * p_psm)
{
if (farglxs_type_ == formalarglstatetype::argl_0) {
this->farglxs_type_ = formalarglstatetype::argl_1a;
/* TODO: refactor to have setup method on each exprstate */
expect_formal_xs::start(p_psm);
} else {
exprstate::on_leftparen_token(tk, p_psm);
scope log(XO_DEBUG(true));
if (fastate_ == formalarglstatetype::argl_0) {
this->fastate_ = formalarglstatetype::argl_1a;
log && log("STUB: DExpectFormalArglistSsm::on_leftparen_token -> DExpectFormalSsm::start()");
//DExpectFormalSsm::start(p_psm);
return;
}
p_psm->illegal_input_on_token("DExpectFormalArglistSsm::on_token",
tk,
this->get_expect_str());
}
#ifdef NOT_YET
void
expect_formal_arglist_xs::on_formal(const rp<Variable> & formal,
parserstatemachine * p_psm)
@ -216,8 +280,58 @@ namespace xo {
bool
DExpectFormalArglistSsm::pretty(const ppindentinfo & ppii) const
{
return ppii.pps()->pretty_struct(ppii,
"DExpectFormalArglistSsm");
ppstate * pps = ppii.pps();
if (ppii.upto()) {
if (!pps->print_upto("<DExpectFormalArglistSsm"))
return false;
if (!pps->print_upto(xrefrtag("fastate", fastate_)))
return false;
if (!pps->print_upto(xrefrtag("n_args", n_args_)))
return false;
for (size_type i_arg = 0; i_arg < n_args_; ++i_arg) {
char buf[80];
snprintf(buf, sizeof(buf), "arg[%ud]", i_arg);
auto arg_gco = argl_->at(i_arg);
obj<APrintable> arg_pr
= FacetRegistry::instance().try_variant<APrintable,AGCObject>(arg_gco);
if (!pps->print_upto(xrefrtag(buf, arg_pr)))
return false;
}
pps->write(">");
return true;
} else {
pps->write("<DExpectFormalArglistSsm");
pps->newline_indent(ppii.ci1());
pps->pretty(refrtag("fastate", fastate_));
pps->newline_indent(ppii.ci1());
pps->pretty(refrtag("n_args", n_args_));
for (size_type i_arg = 0; i_arg < n_args_; ++i_arg) {
char buf[80];
snprintf(buf, sizeof(buf), "arg[%ud]", i_arg);
auto arg_gco = argl_->at(i_arg);
obj<APrintable> arg_pr
= FacetRegistry::instance().try_variant<APrintable,AGCObject>(arg_gco);
pps->newline_indent(ppii.ci1());
pps->pretty(refrtag(buf, arg_pr));
}
pps->write(">");
return false;
}
}
} /*namespace scm*/

View file

@ -0,0 +1,59 @@
/** @file ISyntaxStateMachine_DExpectFormalArgSsm.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/ISyntaxStateMachine_DExpectFormalArgSsm.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/ISyntaxStateMachine_DExpectFormalArgSsm.json5]
**/
#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp"
namespace xo {
namespace scm {
auto
ISyntaxStateMachine_DExpectFormalArgSsm::ssm_type(const DExpectFormalArgSsm & self) noexcept -> syntaxstatetype
{
return self.ssm_type();
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::get_expect_str(const DExpectFormalArgSsm & self) noexcept -> std::string_view
{
return self.get_expect_str();
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::on_token(DExpectFormalArgSsm & self, const Token & tk, ParserStateMachine * p_psm) -> void
{
self.on_token(tk, p_psm);
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::on_parsed_symbol(DExpectFormalArgSsm & self, std::string_view sym, ParserStateMachine * p_psm) -> void
{
self.on_parsed_symbol(sym, p_psm);
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::on_parsed_typedescr(DExpectFormalArgSsm & self, TypeDescr td, ParserStateMachine * p_psm) -> void
{
self.on_parsed_typedescr(td, p_psm);
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::on_parsed_expression(DExpectFormalArgSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm) -> void
{
self.on_parsed_expression(expr, p_psm);
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::on_parsed_expression_with_semicolon(DExpectFormalArgSsm & self, obj<AExpression> expr, ParserStateMachine * p_psm) -> void
{
self.on_parsed_expression_with_semicolon(expr, p_psm);
}
} /*namespace scm*/
} /*namespace xo*/
/* end ISyntaxStateMachine_DExpectFormalArgSsm.cpp */

View file

@ -17,6 +17,8 @@ namespace xo {
return "expect-toplevel-expression-sequence";
case syntaxstatetype::expect_formal_arglist:
return "expect-formal-arglist";
case syntaxstatetype::expect_formal_arg:
return "expect-formal-arg";
case syntaxstatetype::expect_symbol:
return "expect-symbol";
case syntaxstatetype::expect_type:

View file

@ -231,11 +231,10 @@ namespace xo {
REQUIRE(result.is_incomplete());
}
#ifdef NOT_YET
{
auto & result = parser.on_token(Token::bool_token("true"));
auto & result = parser.on_token(Token::leftparen_token());
log && log("after true token:");
log && log("after lparen token:");
log && log(xtag("parser", &parser));
log && log(xtag("result", result));
@ -244,6 +243,7 @@ namespace xo {
REQUIRE(result.is_incomplete());
}
#ifdef NOT_YET
{
auto & result = parser.on_token(Token::then_token());

View file

@ -92,7 +92,7 @@ namespace xo {
/** token representing right angle bracket @c ">" **/
static Token rightangle() { return Token(tokentype::tk_rightangle); }
/** token representing left parenthesis @c "(" **/
static Token leftparen() { return Token(tokentype::tk_leftparen); }
static Token leftparen_token() { return Token(tokentype::tk_leftparen); }
/** Token representing right parenthesis @c ")" **/
static Token rightparen() { return Token(tokentype::tk_rightparen); }
/** token representing left bracket @c "[" **/