Support multiple files in ADD/COPY instructions

Fixes https://github.com/camdencheek/tree-sitter-dockerfile/issues/12
This commit is contained in:
Martin Jambon 2022-01-26 14:41:32 -08:00
parent 28ac8596ba
commit 47a922db41
3 changed files with 32 additions and 4 deletions

View file

@ -25,3 +25,16 @@ ADD --chown=a:b /src ./dst
(path)
(path)))
==================
Multiple files
==================
ADD src1 src2 dst
---
(source_file
(add_instruction
(path)
(path)
(path)))

View file

@ -25,3 +25,16 @@ COPY --chown=a:b /src ./dst
(path)
(path)))
==================
Multiple files
==================
COPY src1 src2 dst
---
(source_file
(copy_instruction
(path)
(path)
(path)))

View file

@ -68,8 +68,9 @@ module.exports = grammar({
seq(
alias(/[aA][dD][dD]/, "ADD"),
optional($.param),
$.path,
$._non_newline_whitespace,
repeat1(
seq($.path, $._non_newline_whitespace)
),
$.path
),
@ -77,8 +78,9 @@ module.exports = grammar({
seq(
alias(/[cC][oO][pP][yY]/, "COPY"),
optional($.param),
$.path,
$._non_newline_whitespace,
repeat1(
seq($.path, $._non_newline_whitespace)
),
$.path
),