Changelog History
Page 1
-
v0.6.3 Changes
July 22, 2020- ๐ Fix multiline doc-comments (#232)
- ๐ Documentation improvements
Contributors: @dario23 @kevinmehall
-
v0.6.2 Changes
February 15, 2020- Derive
PartialEq, PartialOrd, Eq, Ord, Debug, Hash
for RuleResult (#217) - ๐ Documentation improvements
Contributors: @dario23 @kevinmehall
- Derive
-
v0.6.1 Changes
January 18, 2020- ๐ Use fully qualified
Result
path to avoid problems ifResult
is shadowed (#214) - โก๏ธ Update to 2018 edition for more consistent behavior when the
peg
name is shadowed - ๐ Allow crate-relative imports in grammars (#213)
- ๐ Documentation improvements
- ๐ Fix rule arguments on
pub rule
- Forbid
#[cache]
on rules with arguments
Contributors: @dario23 @kevinmehall
- ๐ Use fully qualified
-
v0.6.0 Changes
October 06, 2019Major improvements
- ๐ Replaced build script integration and nightly-only syntax extension with a procedural macro that works on stable Rust. This means that errors both in the PEG grammar and the Rust code embedded from it are reported with source position by rustc. It even works with RLS!
- โ Add the ability to parse non-
str
input by implementing traits. It comes with an implementation for[T]
(including[u8]
), but you can define the traits for your own types. In fact, the rust-peg grammar is parsed with rust-peg via an implementation for token trees fromproc-macro2
. - โ Add
precedence!{}
block for adding a precedence-climbing expression parser integrated with the surrounding PEG source. - Report errors in left-recursive rules that would cause infinte loops.
- ๐ Allow rules to accept value and type parameters, including passing closures to replace the
template
syntax. - ๐ Significant performance improvement for input that parses successfully by deferring error handling until parsing has failed.
โฌ๏ธ Upgrade from 0.5.x
๐ 1. Remove
peg = "0.5"
from[build_dependencies]
inCargo.toml
, and addpeg = "0.6"
under[dependencies]
. ๐ 2. If nothing else is inbuild.rs
, delete it and removebuild = "build.rs"
fromCargo.toml
If using the 2015 edition of Rust, add
extern crate peg;
to your crate root. ๐ 4. Move your grammar from a separate.rustpeg
file into a Rust source file. Remove the
mod somename { include!(...) }
and replace it with:peg::parser!{grammar somename() for str { // grammar goes here }}
Add the
rule
keyword and parentheses to rule declarations.foo = ...
becomesrule foo() = ...
pub bar -> X = ...
becomespub rule bar() -> X = ...
.
Add parentheses to expressions that invoke another rule.
name:ident
becomesname:ident()
.
Replace the character set syntax with the pattern matching syntax.
[a-zA-Z]
becomes['a'..='z' | 'A'..='Z']
.[^X]
becomes(!['X'][_])
-- the inverted character set syntax was removed, but can be substituted with a negative lookahead followed by[_]
to match and consume the character. โ 4. If your grammar used templates, replace them with rule arguments.
Replace
.
with[_]
.#position
withposition!()
#quiet<e>
withquiet!{e}
#expected("foo")
withexpected!("foo")
.
-
v0.5.7 Changes
October 06, 2018- ๐ Use
?
instead oftry!()
for compatibility with Rust 2018. - โ Add support for
dyn
andimpl
in rule return types - ๐ Fix peg-syntax-ext for changes in Rust nightly (0.6 will replace peg-syntax-ext with a proc-macro for stable Rust)
- ๐ Use
-
v0.5.6 Changes
August 21, 2018๐ Fix for libsyntax
OneVector
rename -
v0.5.5 Changes
December 16, 2017๐ Fix for FileName change in libsyntax API
-
v0.5.4 Changes
June 24, 2017๐ Fixes
- ๐ Fix operator capture in #infix parser (#165)
-
v0.5.3 Changes
May 09, 2017๐ Fixes
- ๐ Fix infix parsers in grammars using context arguments (#162)
-
v0.5.2 Changes
April 29, 2017๐ New Features
- Context arguments for passing variables to all rules
๐ Fixes
- โก๏ธ [peg-syntax-ext] Update for rust-nightly-2017-04-28