Simplify Syntax
This release brings fairly major changes to the rec syntax. The overarching goal of these changes was to make rec simpler in 3 ways:
- Composing a rec generally requires less characters.
- Reading a rec is easier.
- The code implementing rec is simpler due to removing some structures and utilizing some internal macros to reduce code repetition in the library.
Breaking changes:
Atomhas been removed. Now rec includes theElementtrait which serves a similar function of converting multiple types intoRecs with the exception thatRecalso implementsElement. AlsoPatternmethodsdefineandloadnow take anElement.Recno longer has arptmethod and theQuantifiertrait andConstantQuantifiersVAR,SOMEandOPThave been removed. Instead, quantifiers are generated directly from functions.var(Element),some(Element)andopt(Element)replace theConstantQuantifiers whileexact(reps, Element),min(min_reps, Element)andbtwn(min_reps, max_reps, Element)replace the valueQuantifiers.- all functions except
exactprovide a lazy version by prependinglazy_to the function name. Ex:lazy_var(Element).
Recno longer has anamemethod. Instead, capture groups are generated using atkn!macro (tknis an abbreviation oftoken). The syntax is:tkn!(Element => name), which definesElementas a capture group with the given name. Ex:tkn!(some(ChCls::Digit) => "number").ChClsvariantsNoneandWhSpchave been renamed toNotandWhitespacerespectively.
New features:
ChClsincludes a new variantSignwhich matches either a+or a-.