xo-reader: wip: add environment-frame stack to psm [not used]

This commit is contained in:
Roland Conybeare 2024-08-19 17:34:20 -04:00
commit 3b57a1f142
2 changed files with 13 additions and 2 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include "exprstate.hpp"
#include "envframestack.hpp"
namespace xo {
namespace scm {
@ -22,15 +23,24 @@ namespace xo {
public:
parserstatemachine(exprstatestack * p_stack,
envframestack * p_env_stack,
rp<Expression> * p_emit_expr)
: p_stack_{p_stack}, p_emit_expr_{p_emit_expr} {}
: p_stack_{p_stack},
p_env_stack_{p_env_stack},
p_emit_expr_{p_emit_expr} {}
std::unique_ptr<exprstate> pop_exprstate();
exprstate & top_exprstate();
void push_exprstate(std::unique_ptr<exprstate> x);
public:
/** stack of incomplete parser work.
* generally speaking, push when to start new work for nested content;
* pop when work complete
**/
exprstatestack * p_stack_;
/** stack of environment frames, one for each enclosing lambda **/
envframestack * p_env_stack_;
rp<Expression> * p_emit_expr_;
};
} /*namespace scm*/

View file

@ -33,6 +33,7 @@ namespace xo {
parser::begin_translation_unit() {
/* note: not using emit expr here */
parserstatemachine psm(&xs_stack_,
&env_stack_,
nullptr /*p_emit_expr*/);
exprseq_xs::start(&psm);
@ -55,7 +56,7 @@ namespace xo {
rp<Expression> retval;
parserstatemachine psm(&xs_stack_, &retval);
parserstatemachine psm(&xs_stack_, &env_stack_, &retval);
xs_stack_.top_exprstate().on_input(tk, &psm);