-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract the parser
and validator
from the pest_derive
crate into pest_meta
#159
Changes from 11 commits
c1e30aa
5525216
1319bde
02d445d
47cfdbd
927ac86
d718e67
f0337c3
b934c5a
4b1101d
7387dde
49e39e0
7c44ad9
076898c
8729712
1f471b2
a390796
f87b084
4a07821
dae7e88
4d7fe48
4d0448b
33195d7
03515ab
55f0098
2057588
95c5e5f
333c9d8
9b044a5
c5e533a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
members = [ | ||
"pest", | ||
"pest_derive", | ||
"pest_grammars" | ||
"pest_grammars", | ||
"pest_meta" | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,13 +139,11 @@ pub fn optimize(rules: Vec<Rule>) -> Vec<Rule> { | |
mod tests { | ||
use super::*; | ||
|
||
use quote::Ident; | ||
|
||
#[test] | ||
fn concat_strings() { | ||
let rules = vec![ | ||
Rule { | ||
name: Ident::new("rule"), | ||
name: "rule".to_owned(), | ||
ty: RuleType::Atomic, | ||
expr: Expr::Seq( | ||
Box::new(Expr::Seq( | ||
|
@@ -161,7 +159,7 @@ mod tests { | |
]; | ||
let concatenated = vec![ | ||
Rule { | ||
name: Ident::new("rule"), | ||
name: "rule".to_owned(), | ||
ty: RuleType::Atomic, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
expr: Expr::Str("abcd".to_owned()) | ||
} | ||
|
@@ -174,7 +172,7 @@ mod tests { | |
fn concat_insensitive_strings() { | ||
let rules = vec![ | ||
Rule { | ||
name: Ident::new("rule"), | ||
name: "rule".to_owned(), | ||
ty: RuleType::Atomic, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space. |
||
expr: Expr::Seq( | ||
Box::new(Expr::Seq( | ||
|
@@ -190,7 +188,7 @@ mod tests { | |
]; | ||
let concatenated = vec![ | ||
Rule { | ||
name: Ident::new("rule"), | ||
name: "rule".to_owned(), | ||
ty: RuleType::Atomic, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space. |
||
expr: Expr::Insens("abcd".to_owned()) | ||
} | ||
|
@@ -203,37 +201,37 @@ mod tests { | |
fn long_common_sequence() { | ||
let rules = vec![ | ||
Rule { | ||
name: Ident::new("rule"), | ||
name: "rule".to_owned(), | ||
ty: RuleType::Silent, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space. |
||
expr: Expr::Choice( | ||
Box::new(Expr::Seq( | ||
Box::new(Expr::Ident(Ident::new("a"))), | ||
Box::new(Expr::Ident("a".to_owned())), | ||
Box::new(Expr::Seq( | ||
Box::new(Expr::Ident(Ident::new("b"))), | ||
Box::new(Expr::Ident(Ident::new("c"))) | ||
Box::new(Expr::Ident("b".to_owned())), | ||
Box::new(Expr::Ident("c".to_owned())) | ||
)) | ||
)), | ||
Box::new(Expr::Seq( | ||
Box::new(Expr::Seq( | ||
Box::new(Expr::Ident(Ident::new("a"))), | ||
Box::new(Expr::Ident(Ident::new("b"))) | ||
Box::new(Expr::Ident("a".to_owned())), | ||
Box::new(Expr::Ident("b".to_owned())) | ||
)), | ||
Box::new(Expr::Ident(Ident::new("d"))) | ||
Box::new(Expr::Ident("d".to_owned())) | ||
)) | ||
) | ||
} | ||
]; | ||
let optimized = vec![ | ||
Rule { | ||
name: Ident::new("rule"), | ||
name: "rule".to_owned(), | ||
ty: RuleType::Silent, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space. |
||
expr: Expr::Seq( | ||
Box::new(Expr::Ident(Ident::new("a"))), | ||
Box::new(Expr::Ident("a".to_owned())), | ||
Box::new(Expr::Seq( | ||
Box::new(Expr::Ident(Ident::new("b"))), | ||
Box::new(Expr::Ident("b".to_owned())), | ||
Box::new(Expr::Choice( | ||
Box::new(Expr::Ident(Ident::new("c"))), | ||
Box::new(Expr::Ident(Ident::new("d"))) | ||
Box::new(Expr::Ident("c".to_owned())), | ||
Box::new(Expr::Ident("d".to_owned())) | ||
)) | ||
)) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space here is not needed per rustfmt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I run rustfmt on this file, I get a bunch of changes (many not related to the changes I made) Should I just go ahead and use rustfmt, or should I just remove these spaces? I am using rustfmt 0.8.0