xo-reader2 stack: parenthesized expressions [WIP]
This commit is contained in:
parent
0170b8dacf
commit
add1b018ac
24 changed files with 1095 additions and 35 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/** @file DExprSeqState.cpp
|
||||
*
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
#include "DLambdaSsm.hpp"
|
||||
#include "DProgressSsm.hpp"
|
||||
#include "DIfElseSsm.hpp"
|
||||
#include "ParenSsm.hpp"
|
||||
#include "ExpectExprSsm.hpp"
|
||||
|
||||
#include <xo/expression2/DConstant.hpp>
|
||||
#include <xo/expression2/detail/IExpression_DConstant.hpp>
|
||||
|
|
@ -152,9 +154,12 @@ namespace xo {
|
|||
this->on_bool_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
case tokentype::tk_leftparen:
|
||||
this->on_leftparen_token(tk, p_psm);
|
||||
return;
|
||||
|
||||
// all the not-yet handled cases
|
||||
case tokentype::tk_invalid:
|
||||
case tokentype::tk_leftparen:
|
||||
case tokentype::tk_rightparen:
|
||||
case tokentype::tk_leftbracket:
|
||||
case tokentype::tk_rightbracket:
|
||||
|
|
@ -389,6 +394,27 @@ namespace xo {
|
|||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_leftparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
switch (seqtype_) {
|
||||
case exprseqtype::toplevel_interactive: {
|
||||
DParenSsm::start(p_psm);
|
||||
p_psm->on_token(Token::leftparen_token());
|
||||
|
||||
return;
|
||||
}
|
||||
case exprseqtype::toplevel_batch:
|
||||
break;
|
||||
case exprseqtype::N:
|
||||
assert(false); // unreachable
|
||||
break;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
DExprSeqState::on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue