This is a major feature release, greatly expanding the capabilities of case statements, as well as adding more ways to communicate from the parser to the calling code.
NOTE: snaps are no longer packaged for `nmfu` (due to CI issues), if you install `nmfu` via `snap`, please migrate either to installing from PyPI (perhaps via `pipx`) or use the AppImages.
New Features
- The "greedy" case modifier, which loosens the ambiguity requirements on case blocks: (52e5418)
- Ambiguity between a completed match and checking for a longer match of another branch are resolved to consume the least characters in the conditional matches.
- Ambiguity between multiple branches can be explicitly clarified with priorities.
- Finish codes: explicit finish statements can now return custom status codes, instead of just always giving `_DONE` (1ffe4d4)
- Yield: parsers can now interrupt execution with a return code and be restarted; for example to build a lexer (1ffe4d4, 41b2c23)
The existing examples have been updated to take advantage of these features, as well as a new example demonstrating greedy case statements and yielding in the context of a simple lexer.
Bugs Fixed
- Loops that have (possibly conditional) breaks before any matching statements no longer think they're infinite (a687b3b)
- Fix over-eager fallthrough shortcircuit optimizations involving condition points (55a38d8)
- Fix over-sensitive detection for infinite fallthrough loops (a5c65df)
- `append_after` no longer diverts error handling transitions on its own when dealing with proxy states; now instead just replicates the error/nonerror status and lets the normal handling take place (2, 3f3f524, 03c23e6)
- Try-except blocks now use a simpler representation for exception handlers that consume no characters, which fixes various cases of missed actions with `outofspace` handlers (6bad7c1, 74f3e9a)
Infrastructure Changes
- Tests now use finish codes to better check correctness (9f1c20e, 9d0b812)
- Various examples/docs have been updated to use finish codes instead of result enumerations (976fc60, a777a5e)
- New lexer example demonstrating yield functionality (a9a96a8)
- Various documentation improvements:
- Better syntax highlighting (2527e74, 4d52e5c, ee68d8f, dd6223f, d779af1)
- New tutorial describing the lexer example (b693a8a)
- Documentation for the new greedy case and yield/finish codes (b9e96a8, 4e47875)
- Updated to lark 1.0 (f3dd61e)
- Appimages now build against Ubuntu 20.04 as their base (9dc256c)
- Disable auto-building of snaps due to CI problems (the snapcraft.yml file is still present in case you still need them) (d7b771d)
- Debug dumper improvements:
- Now highlights error-handling transitions in orange (4cf606d)
- Now properly visualizes transitions with actions defined as diverting to "undefined" instead of just hiding them (7cf4a5a)