Skip to content

Commit

Permalink
Added support for tilde in file_name (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami authored Sep 11, 2024
1 parent b2c752b commit 832168e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crates/deno_task_shell/src/grammar.pest
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 4 additions & 0 deletions crates/deno_task_shell/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,10 @@ fn parse_word(pair: Pair<Rule>) -> Result<Word> {
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: {:?}",
Expand Down
1 change: 1 addition & 0 deletions scripts/source.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo $PATH > ~/output.txt

0 comments on commit 832168e

Please sign in to comment.