Releases: jsim2010/rec
rec as a macro
This release is a large rewrite of the rec crate that causes major breaking changes. Although some of the previous functionality is lost, it is intended that much of it will be replaced and the benefit of getting more control over the allowed syntax and implementations outweighed the cost.
Convert Ch to enum
0.10.0 Bump to 0.10.0 (#56)
Improving single character classes
0.9.0 bump to 0.9.0 (#48)
Simplify API
- Add functions that simplify interaction with
Patterns andTokens.
Small ease of use improvements
Small improvements that improve the ease of use
Expand Ch
Replace ChCls with Ch
Changes ChCls emum to be Ch struct; replaces variants with functions.
Adds Ch::start().
Implement Not for Ch.
Large refactoring - splitting out files and updating documentation.
Adding CI support for testing
Better Conventions
This release makes some changes so that rec better matches Rust conventions.
Breaking Changes
- Updates some function calls of
Patternto better match Rust convention:define->new,load->from_strofstd::str::FromStrtrait. Location now providesend- the index at which the match ends, in place oflength`.
New features
TokensIterandLocationsimplement Debug (although the current implementation is rather unhelpful).
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-.
Location
This release adds the functionality to search for only the start and length of a match.
New
- Added
Pattern.load()to attempt creating Patterns from data unknown prior to runtime. - Added
LocationandLocationsto store data about location of one and multiple matches respectively. - Added
Pattern.locate()andPattern.locate_iter()to returnLocation(s)
Improved
- Updated Rust edition to 2018.
- Added to
&str.to_rec()ability to escape"*".