fpeg 0.1.0

A PEG parsing library: grammars loaded at runtime, a bytecode parsing machine and a lossless parse tree
Documentation
// SPDX-FileCopyrightText: 2026 Dominik Schwimmbeck
// SPDX-License-Identifier: MIT OR Apache-2.0

// Terminals that many grammars need, to be taken with %import common (CNAME, ...). It is no
// grammar of its own and has no start rule.

DIGIT "digit": [0-9]
HEXDIGIT "hexadecimal digit": [0-9a-fA-F]
INT "integer": DIGIT+
SIGNED_INT "signed integer": [+\-]? INT
DECIMAL "decimal number": INT "." INT? | "." INT
_EXPONENT "exponent": [eE] SIGNED_INT
FLOAT "float": INT _EXPONENT | DECIMAL _EXPONENT?
SIGNED_FLOAT "signed float": [+\-]? FLOAT
NUMBER "number": FLOAT | INT
SIGNED_NUMBER "signed number": [+\-]? NUMBER
// A string on one line, with a backslash escaping the character after it.
ESCAPED_STRING "string": "\"" ("\\" [^\n\r] | [^"\\\n\r])* "\""
LCASE_LETTER "lowercase letter": [a-z]
UCASE_LETTER "uppercase letter": [A-Z]
LETTER "letter": UCASE_LETTER | LCASE_LETTER
WORD "word": LETTER+
CNAME "name": ("_" | LETTER) ("_" | LETTER | DIGIT)*
WS_INLINE "whitespace": [ \t]+
WS "whitespace": [ \t\x0C\r\n]+
CR "carriage return": "\r"
LF "line feed": "\n"
NEWLINE "newline": (CR? LF)+
SH_COMMENT "comment": "#" [^\r\n]*
CPP_COMMENT "comment": "//" [^\r\n]*
C_COMMENT "comment": "/*" (!"*/" .)* "*/"
SQL_COMMENT "comment": "--" [^\r\n]*