xo-interpreter2 stack: define-expr's work at top-level
This commit is contained in:
parent
10db8493f7
commit
121fb2dfad
6 changed files with 30 additions and 9 deletions
|
|
@ -71,6 +71,7 @@ namespace xo {
|
|||
bool debug_flag() const noexcept { return debug_flag_; }
|
||||
ParserStack * stack() const noexcept { return stack_; }
|
||||
obj<AAllocator> expr_alloc() const noexcept { return expr_alloc_; }
|
||||
DGlobalSymtab * global_symtab() const noexcept { return global_symtab_.data(); }
|
||||
DLocalSymtab * local_symtab() const noexcept { return local_symtab_; }
|
||||
const ParserResult & result() const noexcept { return result_; }
|
||||
|
||||
|
|
@ -315,6 +316,17 @@ namespace xo {
|
|||
**/
|
||||
obj<AAllocator> aux_alloc_;
|
||||
|
||||
/** global symbol table.
|
||||
* Toplevel definitions go here.
|
||||
*
|
||||
* Uses mmap -> non-trivial destructor.
|
||||
*
|
||||
* TODO: may want to move ownership upstairs.
|
||||
* if so, along with stringtable_.
|
||||
* maybe new struct ParserState?
|
||||
**/
|
||||
dp<DGlobalSymtab> global_symtab_;
|
||||
|
||||
/** symbol table with local bindings.
|
||||
* non-null during parsing of lambda expressions.
|
||||
* Always allocated from @p expr_alloc_.
|
||||
|
|
@ -323,15 +335,6 @@ namespace xo {
|
|||
**/
|
||||
DLocalSymtab * local_symtab_ = nullptr;
|
||||
|
||||
/** global symbol table.
|
||||
* Toplevel definitions go here.
|
||||
*
|
||||
* Uses mmap -> non-trivial destructor.
|
||||
*
|
||||
* TODO: may want to move ownership upstairs
|
||||
**/
|
||||
dp<DGlobalSymtab> global_symtab_;
|
||||
|
||||
/** current output from parser **/
|
||||
ParserResult result_;
|
||||
|
||||
|
|
|
|||
|
|
@ -183,6 +183,8 @@ namespace xo {
|
|||
/** scm-schematikaparser-access-methods **/
|
||||
///@{
|
||||
|
||||
DGlobalSymtab * global_symtab() const noexcept;
|
||||
|
||||
bool debug_flag() const { return debug_flag_; }
|
||||
|
||||
/** true if parser is at top-level,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ namespace xo {
|
|||
/** non-trivial dtor because of @p parser **/
|
||||
~SchematikaReader() = default;
|
||||
|
||||
/** top-level symbol table **/
|
||||
DGlobalSymtab * global_symtab() const noexcept;
|
||||
|
||||
/** visit reader-owned memory pools; call visitor(info) for each.
|
||||
* Specifically exclude expr_alloc, since we don't consider
|
||||
* that reader-owned
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ namespace xo {
|
|||
{
|
||||
}
|
||||
|
||||
DGlobalSymtab *
|
||||
SchematikaParser::global_symtab() const noexcept
|
||||
{
|
||||
return psm_.global_symtab();
|
||||
}
|
||||
|
||||
bool
|
||||
SchematikaParser::is_at_toplevel() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ namespace xo {
|
|||
{
|
||||
}
|
||||
|
||||
DGlobalSymtab *
|
||||
SchematikaReader::global_symtab() const noexcept
|
||||
{
|
||||
return parser_.global_symtab();
|
||||
}
|
||||
|
||||
void
|
||||
SchematikaReader::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ namespace xo {
|
|||
|
||||
aux_arena_.visit_pools(visitor);
|
||||
FacetRegistry::instance().visit_pools(visitor);
|
||||
TypeRegistry::instance().visit_pools(visitor);
|
||||
expr_arena_->visit_pools(visitor);
|
||||
parser_->visit_pools(visitor);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue