0.3.0
This is a feature release which adds a bunch of miscellaneous features, in addition to changing the public-facing API.
New Features
- New API: (cbd45c4)
- Instead of taking in single characters, the
_feed
function now takes in blocks of characters at once. The function can also
optionally report how many characters it read in case of early finishes, to aid in chaining parsers. - Instead of having a parameter for
is_end
, there is now an optional separate_end
function for handling EOF detection, enabled
by the-feof-support
flag. - These changes are designed to improve generated parser efficiency.
- Instead of taking in single characters, the
- Fallthrough semantics: (cce57c4, af6728f)
- Instead of
else
matches in case nodes and catch blocks consuming characters, they now forward the error/else to the first match
in their block. - This makes error handling more robust, as well as removing a lot of the uses for
some_var += [$last]
, simplifying parsers.
- Instead of
- Revamped regexes: (50f219c, 5603d44)
- Operator precedence is now more consistent with typical regexes, so
(option1|option2)
now works correctly. - Repetition syntax (
\d{4-6}
) is now supported.
- Operator precedence is now more consistent with typical regexes, so
- Foreach statement: (9cda4ac)
- Parsers can now execute statements on each character matched by some region.
- This greatly simplifies things like reading numbers:
foreach { \d+\; } do { num = [num * 10 + ($last - '0')]; }
- Macros can now take arguments. (07e4a04)
- Character constants can now be used in math expressions. (fc93c91)
Bugs Fixed
- Fixed problem where having a wait match after a try except could break due to incomplete error-handling redirection. (87de753)
- Fixed internal error with
allow_replace
inDFState.transition
which could hide ambiguous transitions. (0e1ad3b) - Fixed problems with incomplete
else
handling on case nodes with regex-matches with inverted character sets/wildcards. (417fb41, 3fa4d93)