tree-sitter-dockerfile
tree-sitter-dockerfile copied to clipboard
Trouble with \e sequences in shell strings
I checked that echo "\e[91m" is syntactically valid in both Bash and Bourne shell (although it has a different meaning, see my comment at https://github.com/semgrep/semgrep/issues/10068#issuecomment-2057821081).
It causes a parsing error with tree-sitter-dockerfile:
$ cat escape.dockerfile
RUN echo "\e[91m"
$ tree-sitter parse escape.dockerfile
(source_file [0, 0] - [1, 0]
(ERROR [0, 0] - [0, 17]
(run_instruction [0, 0] - [0, 12]
(shell_command [0, 4] - [0, 12]
(shell_fragment [0, 4] - [0, 12])))))
escape.dockerfile 0 ms (ERROR [0, 0] - [0, 17])