pega-texto
A Parsing Expression Grammars (PEG) runtime engine in C
|
Single-file Parsing Expression Grammars (PEG) runtime engine for C.
To use it, copy pega-texto.h
file to your project and #define PEGA_TEXTO_IMPLEMENTATION
before including it in one C or C++ source file to create the implementation.
PT_DATA
type configurable, add Action Expressions to simplify implementation and make code more readable, reimplement match algorithm with a recursive approach, make Expressions be layed out contiguously in memory and remove heap based creation and destruction of them, make grammar literal definable at compile-time.ctype.h
, change Range Expressions to use 2 bytes instead of a NULL terminated string; use Grammars without malloc'ing them.pt_match_result.data.i
with the first syntactic error code when syntactic errors occur.extern "C"
declarations in inner headers.pt_match_options
, included Case Insensitive and Character Class Expressions (the old Custom Matcher), changed Custom Matcher Expressions to allow operating on strings, also receiving userdata.SEQ
and OR
expression macros on C++, turns out they behave differently about temporary lifetime of arrays.SEQ
and OR
expression macros to compile on both C and C++ using preprocessor macros and initializer_list
directly on macro-on.h
.extern "C"
declaration on pega-texto.h
for using in C++.pt_is_nullable
returned true, as it may find an error other than PT_VALIDATE_LOOP_EMPTY_STRING
.NULL
string check on match.SEQ
and OR
Expressions, which are valid with a NULL
pointer.SEQ
and OR
Expressions don't allocate a 0-byte buffer anymore, fixed validation error on Non-terminal cycles.