Fix tokenizer crash

This would crash from the highlighter for something like

`PATH={$PATH[echo " "`

The underlying cause is that we use "char_at" which panics on
overread.

So instead this implements try_char_at and then just returns None.
This commit is contained in:
Fabian Boehm
2024-01-09 19:12:16 +01:00
parent f7c9538fb0
commit b82dad0160
3 changed files with 16 additions and 8 deletions

View File

@@ -432,3 +432,6 @@ echo 'begin
echo 'multiline-\\
-word' | $fish_indent --check
echo $status #CHECK: 0
echo 'PATH={$PATH[echo " "' | $fish_indent --ansi
# CHECK: PATH={$PATH[echo " "