Skip to content

Commit

Permalink
Merge pull request #44 from EricCrosson/43-support-multiple-parameter…
Browse files Browse the repository at this point in the history
…s-to-add-and-copy

support multiple parameters to ADD and COPY
  • Loading branch information
camdencheek authored Oct 10, 2023
2 parents 1800d5a + c9351d9 commit 33e22c3
Show file tree
Hide file tree
Showing 5 changed files with 3,602 additions and 3,532 deletions.
15 changes: 15 additions & 0 deletions corpus/add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ ADD src1 src2 dst
(path)
(path)
(path)))

==================
Multiple params
==================

ADD --chown=a:b --chmod=644 src dst

---

(source_file
(add_instruction
(param)
(param)
(path)
(path)))
15 changes: 15 additions & 0 deletions corpus/copy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ COPY src1 src2 dst
(path)
(path)
(path)))

==================
Multiple params
==================

COPY --chown=a:b --chmod=644 src dst

---

(source_file
(copy_instruction
(param)
(param)
(path)
(path)))
4 changes: 2 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = grammar({
add_instruction: ($) =>
seq(
alias(/[aA][dD][dD]/, "ADD"),
optional($.param),
repeat($.param),
repeat1(
seq($.path, $._non_newline_whitespace)
),
Expand All @@ -83,7 +83,7 @@ module.exports = grammar({
copy_instruction: ($) =>
seq(
alias(/[cC][oO][pP][yY]/, "COPY"),
optional($.param),
repeat($.param),
repeat1(
seq($.path, $._non_newline_whitespace)
),
Expand Down
30 changes: 10 additions & 20 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,11 @@
"value": "ADD"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "param"
},
{
"type": "BLANK"
}
]
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "param"
}
},
{
"type": "REPEAT1",
Expand Down Expand Up @@ -382,16 +377,11 @@
"value": "COPY"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "param"
},
{
"type": "BLANK"
}
]
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "param"
}
},
{
"type": "REPEAT1",
Expand Down
Loading

0 comments on commit 33e22c3

Please sign in to comment.