Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
peg::Context Class Reference

#include <peglib.h>

Collaboration diagram for peg::Context:
[legend]

Classes

struct  ArgsFrame
struct  LRMemo
struct  PackratStats
struct  Snapshot

Public Types

using LRRule = std::pair<const Definition *, size_t>
using LRKey = std::pair<LRRule, const char *>

Public Member Functions

int32_t cache_slot (size_t def_id) const
void clear_packrat_cache (const char *pos, size_t def_id)
void write_packrat_cache (const char *pos, size_t def_id, size_t len, const std::any &val)
 Context (const char *path, const char *s, size_t l, size_t def_count, std::shared_ptr< Ope > whitespaceOpe, std::shared_ptr< Ope > wordOpe, bool enablePackratParsing, TracerEnter tracer_enter, TracerLeave tracer_leave, std::any trace_data, bool verbose_trace, Log log, ErrorReporter error_reporter=nullptr, const std::vector< int32_t > *packrat_index=nullptr, size_t packrat_cached_count=0)
 ~Context ()
 Context (const Context &)=delete
 Context (Context &&)=delete
Context operator= (const Context &)=delete
template<typename T>
void packrat (const char *a_s, size_t def_id, size_t &len, std::any &val, T fn)
SemanticValuespush_semantic_values_scope ()
void pop_semantic_values_scope ()
void push_args (std::vector< std::shared_ptr< Ope > > &&args, size_t macro_inst=0)
void pop_args ()
const std::vector< std::shared_ptr< Ope > > & top_args () const
size_t top_macro_inst () const
size_t intern_macro_inst (std::vector< const void * > &&key)
Snapshot snapshot (const SemanticValues &vs) const
void rollback (SemanticValues &vs, const Snapshot &snap)
size_t skip_whitespace (const char *a_s, size_t n, SemanticValues &vs, std::any &dt)
void set_error_pos (const char *a_s, const char *literal=nullptr)
void trace_enter (const Ope &ope, const char *a_s, size_t n, const SemanticValues &vs, std::any &dt)
void trace_leave (const Ope &ope, const char *a_s, size_t n, const SemanticValues &vs, std::any &dt, size_t len)
bool is_traceable (const Ope &ope) const
std::pair< size_t, size_t > line_info (const char *cur) const

Public Attributes

const char * path
const char * s
const size_t l
ErrorInfo error_info
bool recovered = false
std::vector< std::unique_ptr< SemanticValues > > value_stack
size_t value_stack_size = 0
std::vector< Definition * > rule_stack
std::vector< ArgsFrameargs_stack
size_t in_token_boundary_count = 0
std::shared_ptr< OpewhitespaceOpe
bool in_whitespace = false
std::shared_ptr< OpewordOpe
std::vector< std::pair< std::string_view, std::string > > capture_entries
std::vector< bool > cut_stack
const size_t def_count
const bool enablePackratParsing
const std::vector< int32_t > * packrat_index
size_t packrat_cached_count
std::vector< bool > cache_registered
std::vector< bool > cache_success
std::vector< const char * > active_pos
PackratCache cache_values
std::map< LRKey, LRMemolr_memo
std::set< LRRulelr_refs_hit
std::set< LRKeylr_active_seeds
std::map< std::vector< const void * >, size_t > macro_inst_ids
size_t next_macro_inst_ = 1
TracerEnter tracer_enter
TracerLeave tracer_leave
const bool has_tracer
std::any trace_data
const bool verbose_trace
unsigned char tolower_table [256]
Log log
ErrorReporter error_reporter
std::vector< PackratStats > * packrat_stats = nullptr
size_t next_trace_id = 0
std::vector< size_t > trace_ids
bool ignore_trace_state = false
std::once_flag source_line_index_init_
std::vector< size_t > source_line_index

Member Typedef Documentation

◆ LRKey

using peg::Context::LRKey = std::pair<LRRule, const char *>

◆ LRRule

using peg::Context::LRRule = std::pair<const Definition *, size_t>

Constructor & Destructor Documentation

◆ Context() [1/3]

peg::Context::Context ( const char * path,
const char * s,
size_t l,
size_t def_count,
std::shared_ptr< Ope > whitespaceOpe,
std::shared_ptr< Ope > wordOpe,
bool enablePackratParsing,
TracerEnter tracer_enter,
TracerLeave tracer_leave,
std::any trace_data,
bool verbose_trace,
Log log,
ErrorReporter error_reporter = nullptr,
const std::vector< int32_t > * packrat_index = nullptr,
size_t packrat_cached_count = 0 )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Context()

peg::Context::~Context ( )
inline

◆ Context() [2/3]

peg::Context::Context ( const Context & )
delete
Here is the call graph for this function:

◆ Context() [3/3]

peg::Context::Context ( Context && )
delete
Here is the call graph for this function:

Member Function Documentation

◆ cache_slot()

int32_t peg::Context::cache_slot ( size_t def_id) const
inline
Here is the caller graph for this function:

◆ clear_packrat_cache()

void peg::Context::clear_packrat_cache ( const char * pos,
size_t def_id )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intern_macro_inst()

size_t peg::Context::intern_macro_inst ( std::vector< const void * > && key)
inline
Here is the caller graph for this function:

◆ is_traceable()

bool peg::Context::is_traceable ( const Ope & ope) const
inline
Here is the caller graph for this function:

◆ line_info()

std::pair< size_t, size_t > peg::Context::line_info ( const char * cur) const
inline

◆ operator=()

Context peg::Context::operator= ( const Context & )
delete
Here is the call graph for this function:

◆ packrat()

template<typename T>
void peg::Context::packrat ( const char * a_s,
size_t def_id,
size_t & len,
std::any & val,
T fn )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pop_args()

void peg::Context::pop_args ( )
inline
Here is the caller graph for this function:

◆ pop_semantic_values_scope()

void peg::Context::pop_semantic_values_scope ( )
inline
Here is the caller graph for this function:

◆ push_args()

void peg::Context::push_args ( std::vector< std::shared_ptr< Ope > > && args,
size_t macro_inst = 0 )
inline
Here is the caller graph for this function:

◆ push_semantic_values_scope()

SemanticValues & peg::Context::push_semantic_values_scope ( )
inline
Here is the caller graph for this function:

◆ rollback()

void peg::Context::rollback ( SemanticValues & vs,
const Snapshot & snap )
inline
Here is the caller graph for this function:

◆ set_error_pos()

void peg::Context::set_error_pos ( const char * a_s,
const char * literal = nullptr )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ skip_whitespace()

size_t peg::Context::skip_whitespace ( const char * a_s,
size_t n,
SemanticValues & vs,
std::any & dt )
inline
Here is the caller graph for this function:

◆ snapshot()

Snapshot peg::Context::snapshot ( const SemanticValues & vs) const
inline
Here is the caller graph for this function:

◆ top_args()

const std::vector< std::shared_ptr< Ope > > & peg::Context::top_args ( ) const
inline
Here is the caller graph for this function:

◆ top_macro_inst()

size_t peg::Context::top_macro_inst ( ) const
inline
Here is the caller graph for this function:

◆ trace_enter()

void peg::Context::trace_enter ( const Ope & ope,
const char * a_s,
size_t n,
const SemanticValues & vs,
std::any & dt )
inline
Here is the caller graph for this function:

◆ trace_leave()

void peg::Context::trace_leave ( const Ope & ope,
const char * a_s,
size_t n,
const SemanticValues & vs,
std::any & dt,
size_t len )
inline
Here is the caller graph for this function:

◆ write_packrat_cache()

void peg::Context::write_packrat_cache ( const char * pos,
size_t def_id,
size_t len,
const std::any & val )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ active_pos

std::vector<const char *> peg::Context::active_pos

◆ args_stack

std::vector<ArgsFrame> peg::Context::args_stack

◆ cache_registered

std::vector<bool> peg::Context::cache_registered

◆ cache_success

std::vector<bool> peg::Context::cache_success

◆ cache_values

PackratCache peg::Context::cache_values

◆ capture_entries

std::vector<std::pair<std::string_view, std::string> > peg::Context::capture_entries

◆ cut_stack

std::vector<bool> peg::Context::cut_stack

◆ def_count

const size_t peg::Context::def_count

◆ enablePackratParsing

const bool peg::Context::enablePackratParsing

◆ error_info

ErrorInfo peg::Context::error_info

◆ error_reporter

ErrorReporter peg::Context::error_reporter

◆ has_tracer

const bool peg::Context::has_tracer

◆ ignore_trace_state

bool peg::Context::ignore_trace_state = false

◆ in_token_boundary_count

size_t peg::Context::in_token_boundary_count = 0

◆ in_whitespace

bool peg::Context::in_whitespace = false

◆ l

const size_t peg::Context::l

◆ log

Log peg::Context::log

◆ lr_active_seeds

std::set<LRKey> peg::Context::lr_active_seeds

◆ lr_memo

std::map<LRKey, LRMemo> peg::Context::lr_memo

◆ lr_refs_hit

std::set<LRRule> peg::Context::lr_refs_hit

◆ macro_inst_ids

std::map<std::vector<const void *>, size_t> peg::Context::macro_inst_ids

◆ next_macro_inst_

size_t peg::Context::next_macro_inst_ = 1

◆ next_trace_id

size_t peg::Context::next_trace_id = 0

◆ packrat_cached_count

size_t peg::Context::packrat_cached_count

◆ packrat_index

const std::vector<int32_t>* peg::Context::packrat_index

◆ packrat_stats

std::vector<PackratStats>* peg::Context::packrat_stats = nullptr

◆ path

const char* peg::Context::path

◆ recovered

bool peg::Context::recovered = false

◆ rule_stack

std::vector<Definition *> peg::Context::rule_stack

◆ s

const char* peg::Context::s

◆ source_line_index

std::vector<size_t> peg::Context::source_line_index
mutable

◆ source_line_index_init_

std::once_flag peg::Context::source_line_index_init_
mutable

◆ tolower_table

unsigned char peg::Context::tolower_table[256]

◆ trace_data

std::any peg::Context::trace_data

◆ trace_ids

std::vector<size_t> peg::Context::trace_ids

◆ tracer_enter

TracerEnter peg::Context::tracer_enter

◆ tracer_leave

TracerLeave peg::Context::tracer_leave

◆ value_stack

std::vector<std::unique_ptr<SemanticValues> > peg::Context::value_stack

◆ value_stack_size

size_t peg::Context::value_stack_size = 0

◆ verbose_trace

const bool peg::Context::verbose_trace

◆ whitespaceOpe

std::shared_ptr<Ope> peg::Context::whitespaceOpe

◆ wordOpe

std::shared_ptr<Ope> peg::Context::wordOpe

The documentation for this class was generated from the following file:
  • libcockatrice_utility/libcockatrice/utility/peglib.h