mirror of
https://github.com/nushell/nushell.git
synced 2025-03-14 15:38:29 +01:00
Fixes #15243 # Description As noted in #15243, a record with more characters after it (e.g., `{a:b}/`) will cause an OOM due to an infinite loop, introduced by #15023. This happens because the entire string `{a:b}/` is lexed as one token and passed to `parse_record`, where it repeatedly lexes until it hits the closing `}`. This PR detects such extra characters and reports an error. # User-Facing Changes `{a:b}/` and other such constructions will no longer cause infinite loops. Before #15023, you would've seen an "Unclosed delimiter" error message, but this PR changes that to "Invalid characters." ``` Error: nu::parser::extra_token_after_closing_delimiter × Invalid characters after closing delimiter ╭─[entry #5:1:7] 1 │ {a:b}/ · ┬ · ╰── invalid characters ╰──── help: Try removing them. ``` # Tests + Formatting # After Submitting |
||
---|---|---|
.. | ||
test_lex.rs | ||
test_parser_unicode_escapes.rs | ||
test_parser.rs |