summaryrefslogtreecommitdiff
path: root/pest_consume
diff options
context:
space:
mode:
authorNadrieril2019-09-11 21:11:39 +0200
committerNadrieril2019-09-11 21:11:39 +0200
commitf4f83af7831c309923feaf453069a6a75e181084 (patch)
tree86d770b9ccb0e17b75ae5c4a999286d39c59232d /pest_consume
parent810a3d8066c2efed3f7c74cfb171d17988168080 (diff)
Rename match_inputs to match_nodes to reflect new terminology
Diffstat (limited to 'pest_consume')
-rw-r--r--pest_consume/examples/csv/main.rs10
-rw-r--r--pest_consume/src/lib.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/pest_consume/examples/csv/main.rs b/pest_consume/examples/csv/main.rs
index 037948b..bb9f8fc 100644
--- a/pest_consume/examples/csv/main.rs
+++ b/pest_consume/examples/csv/main.rs
@@ -1,5 +1,5 @@
#![feature(slice_patterns)]
-use pest_consume::{match_inputs, Parser};
+use pest_consume::{match_nodes, Parser};
#[derive(pest_derive::Parser)]
#[grammar = "../examples/csv/csv.pest"]
@@ -32,20 +32,20 @@ impl CSVParser {
}
fn field(input: Node) -> ParseResult<CSVField> {
- Ok(match_inputs!(input.children();
+ Ok(match_nodes!(input.children();
[number(n)] => CSVField::Number(n),
[string(s)] => CSVField::String(s),
))
}
fn record(input: Node) -> ParseResult<CSVRecord> {
- Ok(match_inputs!(input.children();
+ Ok(match_nodes!(input.children();
[field(fields)..] => fields.collect(),
))
}
fn file(input: Node) -> ParseResult<CSVFile> {
- Ok(match_inputs!(input.children();
+ Ok(match_nodes!(input.children();
[record(records).., EOI(_)] => records.collect(),
))
}
@@ -53,7 +53,7 @@ impl CSVParser {
fn parse_csv(input_str: &str) -> ParseResult<CSVFile> {
let inputs = CSVParser::parse(Rule::file, input_str)?;
- Ok(match_inputs!(<CSVParser>; inputs;
+ Ok(match_nodes!(<CSVParser>; inputs;
[file(e)] => e,
))
}
diff --git a/pest_consume/src/lib.rs b/pest_consume/src/lib.rs
index f14f6f5..319810a 100644
--- a/pest_consume/src/lib.rs
+++ b/pest_consume/src/lib.rs
@@ -7,7 +7,7 @@ use pest::Parser as PestParser;
use pest::RuleType;
#[proc_macro_hack::proc_macro_hack]
-pub use pest_consume_macros::match_inputs;
+pub use pest_consume_macros::match_nodes;
pub use pest_consume_macros::parser;
mod node {