xo-reader2: DefineSsm: respond to = token

This commit is contained in:
Roland Conybeare 2026-01-21 17:35:01 -05:00
commit c60aeda12a
8 changed files with 105 additions and 4 deletions

View file

@ -9,6 +9,7 @@ set(SELF_SRCS
ParserStack.cpp
ParserResult.cpp
syntaxstatetype.cpp
ISyntaxStateMachine_Any.cpp
DExprSeqState.cpp

View file

@ -42,6 +42,12 @@ namespace xo {
return !(this->is_at_toplevel());
}
obj<ASyntaxStateMachine>
ParserStateMachine::top_ssm() const
{
return this->stack_->top();
}
void
ParserStateMachine::establish_toplevel_ssm(obj<ASyntaxStateMachine> ssm)
{

View file

@ -28,23 +28,33 @@ namespace xo {
}
bool
SchematikaParser::is_at_toplevel() const {
SchematikaParser::is_at_toplevel() const
{
return psm_.is_at_toplevel();
}
bool
SchematikaParser::has_incomplete_expr() const {
SchematikaParser::has_incomplete_expr() const
{
return !(this->is_at_toplevel());
}
obj<ASyntaxStateMachine>
SchematikaParser::top_ssm() const
{
return psm_.top_ssm();
}
void
SchematikaParser::begin_interactive_session() {
SchematikaParser::begin_interactive_session()
{
DExprSeqState::establish_interactive(psm_.expr_alloc(), &psm_);
}
void
SchematikaParser::begin_batch_session() {
SchematikaParser::begin_batch_session()
{
DExprSeqState::establish_batch(psm_.expr_alloc(), &psm_);
}

View file

@ -0,0 +1,34 @@
/** @file syntaxstatetype.cpp
*
* @author Roland Conybeare, Jan 2026
**/
#include "syntaxstatetype.hpp"
namespace xo {
namespace scm {
const char *
syntaxstatetype_descr(syntaxstatetype x) {
switch (x) {
case syntaxstatetype::invalid:
break;
case syntaxstatetype::expect_toplevel_expression_sequence:
return "expect-toplevel-expression-sequence";
case syntaxstatetype::expect_symbol:
return "expect-symbol";
case syntaxstatetype::expect_type:
return "expect-type";
case syntaxstatetype::defexpr:
return "defexpr";
case syntaxstatetype::N:
break;
}
return "syntaxstatetype?";
}
} /*namespace scm*/
} /*namespace xo*/
/* end syntaxstatetype.cpp */