Skip to content

v2.6.0: node tags

Compare
Choose a tag to compare
@tomtau tomtau released this 26 Apr 13:40
· 60 commits to master since this release
6355eae

What's Changed

  • Add basic support for node_tag, iterator, and meta grammar by @tomtau in #832
  • Fix #838 grammar error when only have //!, /// or //, allow writing empty pest grammar. by @huacnlee in #839
  • Implement ExactSizeIterator for Pair iterators by @MucTepDayH16 in #833
  • fuzz: decrease the call limit in the json fuzzer by @tomtau in #841

New Contributors

Full Changelog: v2.5.7...v2.6.0

Introducing node tags

pest v2.6.0's grammar includes a new (optional) feature for labelling parts of rules (based on this idea posted by @oovm : #550 ), e.g.:

add = {#lhs = expr ~ "+" ~ #rhs = epxr}

This feature can help to distinguish tokens by labels instead of positions (which can help to reduce boilerplate code). You can read more about it here: https://pest.rs/book/grammars/syntax.html#tags

Warning: Semantic Versioning

Note that the node tag feature in 2.6.0 is a technically semver-breaking change even though it is a backwards-compatible / non-breaking change in the meta-grammar. There may be similar non-breaking changes to the meta-grammar between minor versions in the future. These non-breaking changes, however, may translate into semver-breaking changes due to the additional variants propagated from the generated Rule enum. This is a known issue and will be fixed in the future (e.g. by increasing MSRV and non_exhaustive annotations).