summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse/src/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel-parse/src/grammar')
-rw-r--r--crates/rebel-parse/src/grammar/recipe.rs8
-rw-r--r--crates/rebel-parse/src/grammar/tokenize.rs4
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/rebel-parse/src/grammar/recipe.rs b/crates/rebel-parse/src/grammar/recipe.rs
index 2888374..633b021 100644
--- a/crates/rebel-parse/src/grammar/recipe.rs
+++ b/crates/rebel-parse/src/grammar/recipe.rs
@@ -4,7 +4,7 @@ use crate::token::*;
pub use rules::*;
peg::parser! {
- pub grammar rules<'a>() for [Token<'a>] {
+ pub grammar rules<'a>() for TokenStream<'a> {
use ast::OpBinary::*;
use ast::OpUnary::*;
@@ -126,10 +126,10 @@ peg::parser! {
}
rule p_(ch: char)
- = [Token::Punct(Punct(c, Spacing::Joint)) if c == ch] {}
+ = [Token::Punct(Punct(c, Spacing::Joint)) if *c == ch] {}
rule p(ch: char) -> ()
- = [Token::Punct(Punct(c, _)) if c == ch] {}
+ = [Token::Punct(Punct(c, _)) if *c == ch] {}
rule p2(ch1: char, ch2: char)
= p_(ch1) p(ch2)
@@ -153,7 +153,7 @@ peg::parser! {
= const_ident("task")
rule const_ident(keyword: &str)
- = [Token::Ident(name) if keyword == name]
+ = [Token::Ident(name) if *name == keyword]
rule delimited<T>(expr: rule<T>, delim: rule<()>) -> Vec<T>
= values:(expr() ++ delim()) delim()? { values }
diff --git a/crates/rebel-parse/src/grammar/tokenize.rs b/crates/rebel-parse/src/grammar/tokenize.rs
index 826f4ce..5f21461 100644
--- a/crates/rebel-parse/src/grammar/tokenize.rs
+++ b/crates/rebel-parse/src/grammar/tokenize.rs
@@ -4,8 +4,8 @@ pub use rules::*;
peg::parser! {
pub grammar rules() for str {
- pub rule token_stream() -> Vec<Token<'input>>
- = _ tokens:(token() ** _) _ { tokens }
+ pub rule token_stream() -> TokenStream<'input>
+ = _ tokens:(token() ** _) _ { TokenStream(tokens) }
pub rule token() -> Token<'input>
= number:number() { Token::Number(number) }