diff --git a/corpus/from.txt b/corpus/from.txt index 3449a46..766d89e 100644 --- a/corpus/from.txt +++ b/corpus/from.txt @@ -71,3 +71,18 @@ FROM sourcegraph/alpine:3.12@sha256:ce099fbcd3cf70b338fc4cb2a4e1fa9ae847de21afdb digest: (image_digest)) as: (image_alias))) +================== +From with param +================== + +FROM --platform=linux/arm64 alpine-${VERSION}-z + +--- + +(source_file + (from_instruction + (param) + (image_spec + (image_name + (expansion + (variable)))))) diff --git a/grammar.js b/grammar.js index 3327496..b17bcae 100644 --- a/grammar.js +++ b/grammar.js @@ -211,7 +211,10 @@ module.exports = grammar({ ) ), - image_name: ($) => repeat1(choice(/[^@:\s\$]+/, $.expansion)), + image_name: ($) => seq( + choice(/[^@:\s\$-][^@:\s\$]*/, $.expansion), + repeat(choice(/[^@:\s\$]+/, $.expansion)) + ), image_tag: ($) => seq(