diff options
author | Nadrieril | 2019-05-02 22:15:47 +0200 |
---|---|---|
committer | Nadrieril | 2019-05-02 22:15:47 +0200 |
commit | 3268e1fb66e2c9eab22572da034a0ac9b3087867 (patch) | |
tree | 0f8dd6097f7e4e11ba69934dbedba4e6de320ce2 /dhall_core/src/parser.rs | |
parent | 69d310da1e4c4563ce41424f776879102b62d9a0 (diff) |
Update dhall-lang submodule
Diffstat (limited to 'dhall_core/src/parser.rs')
-rw-r--r-- | dhall_core/src/parser.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index fcf85bd..12383d4 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -2,6 +2,7 @@ use itertools::Itertools; use pest::iterators::Pair; use pest::Parser; pub use pest::Span; +use std::borrow::Cow; use std::collections::BTreeMap; use std::path::PathBuf; @@ -567,7 +568,27 @@ make_parser! { [posix_environment_variable(s)] => s, )); rule!(bash_environment_variable<String>; captured_str!(s) => s.to_owned()); - rule!(posix_environment_variable<String>; captured_str!(s) => s.to_owned()); + rule!(posix_environment_variable<String>; children!( + [posix_environment_variable_character(chars)..] => { + chars.collect() + }, + )); + rule!(posix_environment_variable_character<Cow<'a, str>>; + captured_str!(s) => { + match s { + "\\\"" => Cow::Owned("\"".to_owned()), + "\\\\" => Cow::Owned("\\".to_owned()), + "\\a" => Cow::Owned("\u{0007}".to_owned()), + "\\b" => Cow::Owned("\u{0008}".to_owned()), + "\\f" => Cow::Owned("\u{000C}".to_owned()), + "\\n" => Cow::Owned("\n".to_owned()), + "\\r" => Cow::Owned("\r".to_owned()), + "\\t" => Cow::Owned("\t".to_owned()), + "\\v" => Cow::Owned("\u{000B}".to_owned()), + _ => Cow::Borrowed(s) + } + } + ); token_rule!(missing<()>); |