summaryrefslogtreecommitdiff
path: root/dhall_syntax/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_syntax/src/parser.rs')
-rw-r--r--dhall_syntax/src/parser.rs22
1 files changed, 7 insertions, 15 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index c2ba19a..40784ec 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -564,17 +564,15 @@ impl Parsers {
},
))
}
- fn path(input: ParseInput<Rule>) -> ParseResult<Vec<String>> {
+ fn path(input: ParseInput<Rule>) -> ParseResult<File> {
Ok(parse_children!(input;
[path_component(components)..] => {
- components.collect()
+ File { file_path: components.collect() }
}
))
}
- fn local(
- input: ParseInput<Rule>,
- ) -> ParseResult<(FilePrefix, Vec<String>)> {
+ fn local(input: ParseInput<Rule>) -> ParseResult<(FilePrefix, File)> {
Ok(parse_children!(input;
[parent_path(l)] => l,
[here_path(l)] => l,
@@ -583,30 +581,24 @@ impl Parsers {
))
}
- fn parent_path(
- input: ParseInput<Rule>,
- ) -> ParseResult<(FilePrefix, Vec<String>)> {
+ fn parent_path(input: ParseInput<Rule>) -> ParseResult<(FilePrefix, File)> {
Ok(parse_children!(input;
[path(p)] => (FilePrefix::Parent, p)
))
}
- fn here_path(
- input: ParseInput<Rule>,
- ) -> ParseResult<(FilePrefix, Vec<String>)> {
+ fn here_path(input: ParseInput<Rule>) -> ParseResult<(FilePrefix, File)> {
Ok(parse_children!(input;
[path(p)] => (FilePrefix::Here, p)
))
}
- fn home_path(
- input: ParseInput<Rule>,
- ) -> ParseResult<(FilePrefix, Vec<String>)> {
+ fn home_path(input: ParseInput<Rule>) -> ParseResult<(FilePrefix, File)> {
Ok(parse_children!(input;
[path(p)] => (FilePrefix::Home, p)
))
}
fn absolute_path(
input: ParseInput<Rule>,
- ) -> ParseResult<(FilePrefix, Vec<String>)> {
+ ) -> ParseResult<(FilePrefix, File)> {
Ok(parse_children!(input;
[path(p)] => (FilePrefix::Absolute, p)
))