From 4630704540478835d293ab4219a14672fcfaa093 Mon Sep 17 00:00:00 2001
From: prsabahrami
Date: Tue, 10 Sep 2024 23:03:31 -0400
Subject: [PATCH] Added support for tilde in file_name
---
crates/deno_task_shell/src/grammar.pest | 16 +++++++++++++++-
crates/deno_task_shell/src/parser.rs | 4 ++++
scripts/source.sh | 1 +
3 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 scripts/source.sh
diff --git a/crates/deno_task_shell/src/grammar.pest b/crates/deno_task_shell/src/grammar.pest
index f9ed255..d2a992a 100644
--- a/crates/deno_task_shell/src/grammar.pest
+++ b/crates/deno_task_shell/src/grammar.pest
@@ -39,7 +39,21 @@ ASSIGNMENT_TILDE_PREFIX = ${
)*
}
-FILE_NAME_PENDING_WORD = ${ (!(WHITESPACE | OPERATOR | NEWLINE) ~ (UNQUOTED_ESCAPE_CHAR | ("$" ~ VARIABLE) | UNQUOTED_CHAR | QUOTED_WORD))+ }
+FILE_NAME_PENDING_WORD = ${
+ (TILDE_PREFIX ~ (!(WHITESPACE | OPERATOR | NEWLINE) ~ (
+ UNQUOTED_ESCAPE_CHAR |
+ ("$" ~ VARIABLE) |
+ UNQUOTED_CHAR |
+ QUOTED_WORD
+ ))*)
+ |
+ (!(WHITESPACE | OPERATOR | NEWLINE) ~ (
+ UNQUOTED_ESCAPE_CHAR |
+ ("$" ~ VARIABLE) |
+ UNQUOTED_CHAR |
+ QUOTED_WORD
+ ))+
+}
QUOTED_PENDING_WORD = ${ (
EXIT_STATUS |
diff --git a/crates/deno_task_shell/src/parser.rs b/crates/deno_task_shell/src/parser.rs
index 87c778f..c3eb3da 100644
--- a/crates/deno_task_shell/src/parser.rs
+++ b/crates/deno_task_shell/src/parser.rs
@@ -796,6 +796,10 @@ fn parse_word(pair: Pair) -> Result {
let quoted = parse_quoted_word(part)?;
parts.push(quoted);
}
+ Rule::TILDE_PREFIX => {
+ let tilde_prefix = parse_tilde_prefix(part)?;
+ parts.push(tilde_prefix);
+ }
_ => {
return Err(anyhow::anyhow!(
"Unexpected rule in FILE_NAME_PENDING_WORD: {:?}",
diff --git a/scripts/source.sh b/scripts/source.sh
new file mode 100644
index 0000000..6dcd2e0
--- /dev/null
+++ b/scripts/source.sh
@@ -0,0 +1 @@
+echo $PATH > ~/output.txt