tree-sitter-dockerfile
tree-sitter-dockerfile copied to clipboard
Problem parsing trailing comment after line continuation
Here's some input that causes the parsing error:
$ cat trailing-comment.dockerfile
FROM busybox
RUN ls \
# comment with nothing after
It is accepted by docker but not by tree-sitter-dockerfile:
$ tree-sitter parse trailing-comment.dockerfile
(source_file [0, 0] - [3, 0]
(from_instruction [0, 0] - [0, 12]
(image_spec [0, 5] - [0, 12]
name: (image_name [0, 5] - [0, 12])))
(ERROR [1, 0] - [2, 0]
(shell_fragment [1, 4] - [1, 7])
(line_continuation [1, 7] - [2, 0]))
(comment [2, 0] - [2, 28]))
trailing-comment.dockerfile 0 ms (ERROR [1, 0] - [2, 0])
btw, I'm going over our backlog of dockerfile-related issues in semgrep. Don't get alarmed if I open a bunch of tickets.