Cockatrice 2026-04-21-Development-2.11.0-beta.61
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  LRMemo
struct  PackratStats
struct  Snapshot

Public Member Functions

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)
 ~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)
void pop_args ()
const std::vector< std::shared_ptr< Ope > > & top_args () const
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::shared_ptr< SemanticValues > > value_stack
size_t value_stack_size = 0
std::vector< Definition * > rule_stack
std::vector< std::vector< std::shared_ptr< Ope > > > args_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
std::vector< bool > cache_registered
std::vector< bool > cache_success
std::map< std::pair< size_t, size_t >, std::tuple< size_t, std::any > > cache_values
std::map< std::pair< const Definition *, const char * >, LRMemolr_memo
std::set< const Definition * > lr_refs_hit
std::set< std::pair< const Definition *, const char * > > lr_active_seeds
TracerEnter tracer_enter
TracerLeave tracer_leave
std::any trace_data
const bool verbose_trace
Log log
std::vector< PackratStats > * packrat_stats = nullptr
const std::vector< bool > * packrat_rule_filter = 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

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 )
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

◆ clear_packrat_cache()

void peg::Context::clear_packrat_cache ( const char * pos,
size_t def_id )
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)
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:

◆ 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 caller graph for this function:

Member Data Documentation

◆ args_stack

std::vector<std::vector<std::shared_ptr<Ope> > > peg::Context::args_stack

◆ cache_registered

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

◆ cache_success

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

◆ cache_values

std::map<std::pair<size_t, size_t>, std::tuple<size_t, std::any> > 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

◆ 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<std::pair<const Definition *, const char *> > peg::Context::lr_active_seeds

◆ lr_memo

std::map<std::pair<const Definition *, const char *>, LRMemo> peg::Context::lr_memo

◆ lr_refs_hit

std::set<const Definition *> peg::Context::lr_refs_hit

◆ next_trace_id

size_t peg::Context::next_trace_id = 0

◆ packrat_rule_filter

const std::vector<bool>* peg::Context::packrat_rule_filter = nullptr

◆ 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

◆ 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::shared_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