xo-reader: wip: add environment-frame stack to psm [not used]
This commit is contained in:
parent
94109c93b7
commit
3b57a1f142
2 changed files with 13 additions and 2 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "exprstate.hpp"
|
#include "exprstate.hpp"
|
||||||
|
#include "envframestack.hpp"
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace scm {
|
namespace scm {
|
||||||
|
|
@ -22,15 +23,24 @@ namespace xo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
parserstatemachine(exprstatestack * p_stack,
|
parserstatemachine(exprstatestack * p_stack,
|
||||||
|
envframestack * p_env_stack,
|
||||||
rp<Expression> * p_emit_expr)
|
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();
|
std::unique_ptr<exprstate> pop_exprstate();
|
||||||
exprstate & top_exprstate();
|
exprstate & top_exprstate();
|
||||||
void push_exprstate(std::unique_ptr<exprstate> x);
|
void push_exprstate(std::unique_ptr<exprstate> x);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/** stack of incomplete parser work.
|
||||||
|
* generally speaking, push when to start new work for nested content;
|
||||||
|
* pop when work complete
|
||||||
|
**/
|
||||||
exprstatestack * p_stack_;
|
exprstatestack * p_stack_;
|
||||||
|
/** stack of environment frames, one for each enclosing lambda **/
|
||||||
|
envframestack * p_env_stack_;
|
||||||
rp<Expression> * p_emit_expr_;
|
rp<Expression> * p_emit_expr_;
|
||||||
};
|
};
|
||||||
} /*namespace scm*/
|
} /*namespace scm*/
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ namespace xo {
|
||||||
parser::begin_translation_unit() {
|
parser::begin_translation_unit() {
|
||||||
/* note: not using emit expr here */
|
/* note: not using emit expr here */
|
||||||
parserstatemachine psm(&xs_stack_,
|
parserstatemachine psm(&xs_stack_,
|
||||||
|
&env_stack_,
|
||||||
nullptr /*p_emit_expr*/);
|
nullptr /*p_emit_expr*/);
|
||||||
|
|
||||||
exprseq_xs::start(&psm);
|
exprseq_xs::start(&psm);
|
||||||
|
|
@ -55,7 +56,7 @@ namespace xo {
|
||||||
|
|
||||||
rp<Expression> retval;
|
rp<Expression> retval;
|
||||||
|
|
||||||
parserstatemachine psm(&xs_stack_, &retval);
|
parserstatemachine psm(&xs_stack_, &env_stack_, &retval);
|
||||||
|
|
||||||
xs_stack_.top_exprstate().on_input(tk, &psm);
|
xs_stack_.top_exprstate().on_input(tk, &psm);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue