Skip to content

Commit 4789150

Browse files
committed
fix(repl): Dot commands not working.
This commit fixes the parsing error that shows when using `dot` commands in the REPL. It fixes this by preventing the passing of the `dot` commands to the JS parser.
1 parent 0592ecc commit 4789150

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/src/helper.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ impl Validator for RLHelper {
6060
&self,
6161
context: &mut ValidationContext<'_>,
6262
) -> Result<ValidationResult, ReadlineError> {
63+
// Dot commands are handled by the REPL loop, not the JS parser.
64+
let input = context.input().trim();
65+
if input == ".help" || input == ".exit" || input.starts_with(".load") || input == ".clear" {
66+
return Ok(ValidationResult::Valid(None));
67+
}
68+
6369
let mut parser = boa_parser::Parser::new(Source::from_bytes(context.input()));
6470
if self.strict {
6571
parser.set_strict();

0 commit comments

Comments
 (0)