Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
peg Namespace Reference

Namespaces

namespace  udl

Classes

class  Action
class  AndPredicate
class  AnyCharacter
struct  argument_count
struct  argument_count< R(*)(Args...)>
struct  argument_count< R(C::*)(Args...) const >
struct  argument_count< R(C::*)(Args...)>
struct  AssignIDToDefinition
struct  AstBase
struct  AstOptimizer
class  BackReference
class  Capture
class  CaptureScope
class  Character
class  CharacterClass
class  Context
class  Cut
class  Definition
struct  DetectInfiniteLoop
struct  DetectLeftRecursion
class  Dictionary
struct  EmptyType
struct  ErrorInfo
struct  FindLiteralToken
struct  FindReference
struct  HasEmptyElement
class  Holder
class  Ignore
struct  IsLiteralToken
struct  LinkReferences
class  LiteralString
class  NotPredicate
class  Ope
class  parser
class  ParserGenerator
class  PrecedenceClimbing
class  PrioritizedChoice
class  Recovery
class  Reference
struct  ReferenceChecker
class  Repetition
struct  scope_exit
struct  SemanticValues
class  Sequence
class  TokenBoundary
struct  TokenChecker
struct  TraceOpeName
class  Trie
class  User
class  WeakHolder
class  Whitespace

Typedefs

using Ast = AstBase<EmptyType>
using Log
using TracerEnter
using TracerLeave
using TracerStartOrEnd = std::function<void(std::any &trace_data)>
using Parser
using Grammar = std::unordered_map<std::string, Definition>
using Rules = std::unordered_map<std::string, std::shared_ptr<Ope>>

Functions

size_t codepoint_length (const char *s8, size_t l)
size_t codepoint_count (const char *s8, size_t l)
size_t encode_codepoint (char32_t cp, char *buff)
std::string encode_codepoint (char32_t cp)
bool decode_codepoint (const char *s8, size_t l, size_t &bytes, char32_t &cp)
size_t decode_codepoint (const char *s8, size_t l, char32_t &cp)
char32_t decode_codepoint (const char *s8, size_t l)
std::u32string decode (const char *s8, size_t l)
template<typename T>
const char * u8 (const T *s)
std::string escape_characters (const char *s, size_t n)
std::string escape_characters (std::string_view sv)
bool is_hex (char c, int &v)
bool is_digit (char c, int &v)
std::pair< int, size_t > parse_hex_number (const char *s, size_t n, size_t i)
std::pair< int, size_t > parse_octal_number (const char *s, size_t n, size_t i)
std::string resolve_escape_sequence (const char *s, size_t n)
template<typename T>
token_to_number_ (std::string_view sv)
std::pair< size_t, size_t > line_info (const char *start, const char *cur)
constexpr unsigned int str2tag_core (const char *s, size_t l, unsigned int h)
constexpr unsigned int str2tag (std::string_view sv)
template<typename F, typename... Args>
std::any call (F fn, Args &&...args)
bool success (size_t len)
bool fail (size_t len)
template<typename... Args>
std::shared_ptr< Opeseq (Args &&...args)
template<typename... Args>
std::shared_ptr< Opecho (Args &&...args)
template<typename... Args>
std::shared_ptr< Opecho4label_ (Args &&...args)
std::shared_ptr< Opezom (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opeoom (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opeopt (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Operep (const std::shared_ptr< Ope > &ope, size_t min, size_t max)
std::shared_ptr< Opeapd (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Openpd (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opedic (const std::vector< std::string > &v, bool ignore_case)
std::shared_ptr< Opelit (std::string &&s)
std::shared_ptr< Opeliti (std::string &&s)
std::shared_ptr< Opecls (const std::string &s)
std::shared_ptr< Opecls (const std::vector< std::pair< char32_t, char32_t > > &ranges, bool ignore_case=false)
std::shared_ptr< Opencls (const std::string &s)
std::shared_ptr< Opencls (const std::vector< std::pair< char32_t, char32_t > > &ranges, bool ignore_case=false)
std::shared_ptr< Opechr (char dt)
std::shared_ptr< Opedot ()
std::shared_ptr< Opecsc (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opecap (const std::shared_ptr< Ope > &ope, Capture::MatchAction ma)
std::shared_ptr< Opetok (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opeign (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opeusr (std::function< size_t(const char *s, size_t n, SemanticValues &vs, std::any &dt)> fn)
std::shared_ptr< Operef (const Grammar &grammar, const std::string &name, const char *s, bool is_macro, const std::vector< std::shared_ptr< Ope > > &args)
std::shared_ptr< Opewsp (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opebkr (std::string &&name)
std::shared_ptr< Opepre (const std::shared_ptr< Ope > &atom, const std::shared_ptr< Ope > &binop, const PrecedenceClimbing::BinOpeInfo &info, const Definition &rule)
std::shared_ptr< Operec (const std::shared_ptr< Ope > &ope)
std::shared_ptr< Opecut ()
size_t parse_literal (const char *s, size_t n, SemanticValues &vs, Context &c, std::any &dt, const std::string &lit, std::once_flag &init_is_word, bool &is_word, bool ignore_case)
template<typename T>
void ast_to_s_core (const std::shared_ptr< T > &ptr, std::string &s, int level, std::function< std::string(const T &ast, int level)> fn)
template<typename T>
std::string ast_to_s (const std::shared_ptr< T > &ptr, std::function< std::string(const T &ast, int level)> fn=nullptr)
template<typename T = Ast>
void add_ast_action (Definition &rule)
void enable_tracing (parser &parser, std::ostream &os)
void enable_profiling (parser &parser, std::ostream &os)

Variables

static const char * WHITESPACE_DEFINITION_NAME = "%whitespace"
static const char * WORD_DEFINITION_NAME = "%word"
static const char * RECOVER_DEFINITION_NAME = "%recover"

Typedef Documentation

◆ Ast

◆ Grammar

using peg::Grammar = std::unordered_map<std::string, Definition>

◆ Log

using peg::Log
Initial value:
std::function<void(size_t line, size_t col, const std::string &msg,
const std::string &rule)>

◆ Parser

using peg::Parser
Initial value:
std::function<size_t(const char *s, size_t n, SemanticValues &vs,
std::any &dt)>
Definition peglib.h:503

◆ Rules

using peg::Rules = std::unordered_map<std::string, std::shared_ptr<Ope>>

◆ TracerEnter

Initial value:
std::function<void(
const Ope &name, const char *s, size_t n, const SemanticValues &vs,
const Context &c, const std::any &dt, std::any &trace_data)>
Definition peglib.h:763
Definition peglib.h:975

◆ TracerLeave

Initial value:
std::function<void(
const Ope &ope, const char *s, size_t n, const SemanticValues &vs,
const Context &c, const std::any &dt, size_t, std::any &trace_data)>

◆ TracerStartOrEnd

using peg::TracerStartOrEnd = std::function<void(std::any &trace_data)>

Function Documentation

◆ add_ast_action()

template<typename T = Ast>
void peg::add_ast_action ( Definition & rule)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ apd()

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

◆ ast_to_s()

template<typename T>
std::string peg::ast_to_s ( const std::shared_ptr< T > & ptr,
std::function< std::string(const T &ast, int level)> fn = nullptr )
Here is the call graph for this function:

◆ ast_to_s_core()

template<typename T>
void peg::ast_to_s_core ( const std::shared_ptr< T > & ptr,
std::string & s,
int level,
std::function< std::string(const T &ast, int level)> fn )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bkr()

std::shared_ptr< Ope > peg::bkr ( std::string && name)
inline
Here is the caller graph for this function:

◆ call()

template<typename F, typename... Args>
std::any peg::call ( F fn,
Args &&... args )
Here is the caller graph for this function:

◆ cap()

std::shared_ptr< Ope > peg::cap ( const std::shared_ptr< Ope > & ope,
Capture::MatchAction ma )
inline
Here is the caller graph for this function:

◆ cho()

template<typename... Args>
std::shared_ptr< Ope > peg::cho ( Args &&... args)
Here is the caller graph for this function:

◆ cho4label_()

template<typename... Args>
std::shared_ptr< Ope > peg::cho4label_ ( Args &&... args)
Here is the caller graph for this function:

◆ chr()

std::shared_ptr< Ope > peg::chr ( char dt)
inline
Here is the caller graph for this function:

◆ cls() [1/2]

std::shared_ptr< Ope > peg::cls ( const std::string & s)
inline
Here is the caller graph for this function:

◆ cls() [2/2]

std::shared_ptr< Ope > peg::cls ( const std::vector< std::pair< char32_t, char32_t > > & ranges,
bool ignore_case = false )
inline

◆ codepoint_count()

size_t peg::codepoint_count ( const char * s8,
size_t l )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codepoint_length()

size_t peg::codepoint_length ( const char * s8,
size_t l )
inline
Here is the caller graph for this function:

◆ csc()

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

◆ cut()

std::shared_ptr< Ope > peg::cut ( )
inline
Here is the caller graph for this function:

◆ decode()

std::u32string peg::decode ( const char * s8,
size_t l )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_codepoint() [1/3]

char32_t peg::decode_codepoint ( const char * s8,
size_t l )
inline
Here is the call graph for this function:

◆ decode_codepoint() [2/3]

size_t peg::decode_codepoint ( const char * s8,
size_t l,
char32_t & cp )
inline
Here is the call graph for this function:

◆ decode_codepoint() [3/3]

bool peg::decode_codepoint ( const char * s8,
size_t l,
size_t & bytes,
char32_t & cp )
inline
Here is the caller graph for this function:

◆ dic()

std::shared_ptr< Ope > peg::dic ( const std::vector< std::string > & v,
bool ignore_case )
inline
Here is the caller graph for this function:

◆ dot()

std::shared_ptr< Ope > peg::dot ( )
inline
Here is the caller graph for this function:

◆ enable_profiling()

void peg::enable_profiling ( parser & parser,
std::ostream & os )
inline
Here is the call graph for this function:

◆ enable_tracing()

void peg::enable_tracing ( parser & parser,
std::ostream & os )
inline
Here is the call graph for this function:

◆ encode_codepoint() [1/2]

std::string peg::encode_codepoint ( char32_t cp)
inline
Here is the call graph for this function:

◆ encode_codepoint() [2/2]

size_t peg::encode_codepoint ( char32_t cp,
char * buff )
inline
Here is the caller graph for this function:

◆ escape_characters() [1/2]

std::string peg::escape_characters ( const char * s,
size_t n )
inline
Here is the caller graph for this function:

◆ escape_characters() [2/2]

std::string peg::escape_characters ( std::string_view sv)
inline
Here is the call graph for this function:

◆ fail()

bool peg::fail ( size_t len)
inline
Here is the caller graph for this function:

◆ ign()

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

◆ is_digit()

bool peg::is_digit ( char c,
int & v )
inline
Here is the caller graph for this function:

◆ is_hex()

bool peg::is_hex ( char c,
int & v )
inline
Here is the caller graph for this function:

◆ line_info()

std::pair< size_t, size_t > peg::line_info ( const char * start,
const char * cur )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lit()

std::shared_ptr< Ope > peg::lit ( std::string && s)
inline
Here is the caller graph for this function:

◆ liti()

std::shared_ptr< Ope > peg::liti ( std::string && s)
inline
Here is the caller graph for this function:

◆ ncls() [1/2]

std::shared_ptr< Ope > peg::ncls ( const std::string & s)
inline
Here is the caller graph for this function:

◆ ncls() [2/2]

std::shared_ptr< Ope > peg::ncls ( const std::vector< std::pair< char32_t, char32_t > > & ranges,
bool ignore_case = false )
inline

◆ npd()

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

◆ oom()

std::shared_ptr< Ope > peg::oom ( const std::shared_ptr< Ope > & ope)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt()

std::shared_ptr< Ope > peg::opt ( const std::shared_ptr< Ope > & ope)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_hex_number()

std::pair< int, size_t > peg::parse_hex_number ( const char * s,
size_t n,
size_t i )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_literal()

size_t peg::parse_literal ( const char * s,
size_t n,
SemanticValues & vs,
Context & c,
std::any & dt,
const std::string & lit,
std::once_flag & init_is_word,
bool & is_word,
bool ignore_case )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_octal_number()

std::pair< int, size_t > peg::parse_octal_number ( const char * s,
size_t n,
size_t i )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre()

std::shared_ptr< Ope > peg::pre ( const std::shared_ptr< Ope > & atom,
const std::shared_ptr< Ope > & binop,
const PrecedenceClimbing::BinOpeInfo & info,
const Definition & rule )
inline
Here is the caller graph for this function:

◆ rec()

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

◆ ref()

std::shared_ptr< Ope > peg::ref ( const Grammar & grammar,
const std::string & name,
const char * s,
bool is_macro,
const std::vector< std::shared_ptr< Ope > > & args )
inline
Here is the caller graph for this function:

◆ rep()

std::shared_ptr< Ope > peg::rep ( const std::shared_ptr< Ope > & ope,
size_t min,
size_t max )
inline
Here is the caller graph for this function:

◆ resolve_escape_sequence()

std::string peg::resolve_escape_sequence ( const char * s,
size_t n )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ seq()

template<typename... Args>
std::shared_ptr< Ope > peg::seq ( Args &&... args)
Here is the caller graph for this function:

◆ str2tag()

unsigned int peg::str2tag ( std::string_view sv)
inlineconstexpr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ str2tag_core()

unsigned int peg::str2tag_core ( const char * s,
size_t l,
unsigned int h )
inlineconstexpr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ success()

bool peg::success ( size_t len)
inline
Here is the caller graph for this function:

◆ tok()

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

◆ token_to_number_()

template<typename T>
T peg::token_to_number_ ( std::string_view sv)
Here is the caller graph for this function:

◆ u8()

template<typename T>
const char * peg::u8 ( const T * s)
Here is the caller graph for this function:

◆ usr()

std::shared_ptr< Ope > peg::usr ( std::function< size_t(const char *s, size_t n, SemanticValues &vs, std::any &dt)> fn)
inline

◆ wsp()

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

◆ zom()

std::shared_ptr< Ope > peg::zom ( const std::shared_ptr< Ope > & ope)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ RECOVER_DEFINITION_NAME

const char* peg::RECOVER_DEFINITION_NAME = "%recover"
static

◆ WHITESPACE_DEFINITION_NAME

const char* peg::WHITESPACE_DEFINITION_NAME = "%whitespace"
static

◆ WORD_DEFINITION_NAME

const char* peg::WORD_DEFINITION_NAME = "%word"
static