Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/deno_task_shell/src/grammar.pest
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ Stdout = ${ "|" ~ !"|" ~ !"&"}
StdoutStderr = { "|&" }

RESERVED_WORD = _{
If | Then | Else | Elif | Fi | Do | Done |
(If | Then | Else | Elif | Fi | Done | Do |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still a little fragile—"done" needs to be checked for match before "do"

Case | Esac | While | Until | For |
Lbrace | Rbrace | Bang | In |
StdoutStderr | Stdout
StdoutStderr | Stdout) ~ &(WHITESPACE | NEWLINE | EOI)
}

// Main grammar rules
Expand Down
16 changes: 16 additions & 0 deletions crates/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,22 @@ async fn test_set() {
.await;
}

#[tokio::test]
async fn test_reserved_substring() {
// Test that there is no panic (prefix-dev/shell#256)
TestBuilder::new()
.command(r#"fiqwertymnbvc bla"#)
.assert_exit_code(127)
.run()
.await;

TestBuilder::new()
.command(r#"forplmoknib bla"#)
.assert_exit_code(127)
.run()
.await;
}

#[cfg(test)]
fn no_such_file_error_text() -> &'static str {
if cfg!(windows) {
Expand Down
Loading