diff --git a/crates/deno_task_shell/src/grammar.pest b/crates/deno_task_shell/src/grammar.pest index dc82856..f00ecd5 100644 --- a/crates/deno_task_shell/src/grammar.pest +++ b/crates/deno_task_shell/src/grammar.pest @@ -177,10 +177,10 @@ Stdout = ${ "|" ~ !"|" ~ !"&"} StdoutStderr = { "|&" } RESERVED_WORD = _{ - If | Then | Else | Elif | Fi | Do | Done | + (If | Then | Else | Elif | Fi | Done | Do | Case | Esac | While | Until | For | Lbrace | Rbrace | Bang | In | - StdoutStderr | Stdout + StdoutStderr | Stdout) ~ &(WHITESPACE | NEWLINE | EOI) } // Main grammar rules diff --git a/crates/tests/src/lib.rs b/crates/tests/src/lib.rs index 19f2560..c472fbb 100644 --- a/crates/tests/src/lib.rs +++ b/crates/tests/src/lib.rs @@ -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) {