xo-reader2: ParserStateMachine w/ separate allocator
This commit is contained in:
parent
a8eb35bd1a
commit
e38b61ce76
4 changed files with 24 additions and 11 deletions
|
|
@ -31,15 +31,16 @@ namespace xo {
|
|||
using DArena = xo::mm::DArena;
|
||||
|
||||
public:
|
||||
ParserStateMachine(const ArenaConfig & config);
|
||||
ParserStateMachine(const ArenaConfig & config,
|
||||
obj<AAllocator> * expr_alloc);
|
||||
|
||||
/** @defgroup scm-parserstatemachine-accessors accessor methods **/
|
||||
///@{
|
||||
|
||||
bool debug_flag() const noexcept { return debug_flag_; }
|
||||
ParserStack * stack() const noexcept { return stack_; }
|
||||
obj<AAllocator> * expr_alloc() const noexcept { return expr_alloc_; }
|
||||
const ParserResult & result() const noexcept { return result_; }
|
||||
obj<AAllocator> expr_alloc() const noexcept { return expr_alloc_; }
|
||||
|
||||
/** true iff state machine is currently idle (at top-level) **/
|
||||
bool is_at_toplevel() const noexcept;
|
||||
|
|
@ -133,7 +134,7 @@ namespace xo {
|
|||
* scenario, where top-level Expressions can be discarded
|
||||
* once compiled.
|
||||
**/
|
||||
obj<AAllocator> expr_alloc_;
|
||||
obj<AAllocator> * expr_alloc_ = nullptr;
|
||||
|
||||
/** current output from parser **/
|
||||
ParserResult result_;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "ParserStateMachine.hpp"
|
||||
#include "ParserResult.hpp"
|
||||
#include <xo/tokenizer2/Token.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
|
@ -153,6 +154,7 @@ namespace xo {
|
|||
class SchematikaParser {
|
||||
public:
|
||||
using ArenaConfig = xo::mm::ArenaConfig;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using token_type = Token;
|
||||
|
||||
public:
|
||||
|
|
@ -160,9 +162,13 @@ namespace xo {
|
|||
* parser is ready to receive tokens via @ref include_token
|
||||
*
|
||||
* @p config arena configuration for parser memory
|
||||
* @p expr_alloc allocator for schematika expressions.
|
||||
* Probably shared with execution.
|
||||
* @p debug_flag true to enable debug logging
|
||||
**/
|
||||
SchematikaParser(const ArenaConfig & config, bool debug_flag);
|
||||
SchematikaParser(const ArenaConfig & config,
|
||||
obj<AAllocator> * expr_alloc,
|
||||
bool debug_flag);
|
||||
|
||||
bool debug_flag() const { return debug_flag_; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue