diff --git a/grammar.js b/grammar.js index 2107c99..17d3374 100644 --- a/grammar.js +++ b/grammar.js @@ -237,7 +237,14 @@ module.exports = grammar({ seq(alias($._style_attr_key, $.attr_key), $._colon, $.attr_value) ), - _grid_attr_key: ($) => choice("grid-gap", "grid-columns", "grid-rows"), + _grid_attr_key: ($) => + choice( + "vertical-gap", + "horizontal-gap", + "grid-gap", + "grid-columns", + "grid-rows" + ), _style_attr_key: ($) => choice($._common_style_attr_key, "3d"), _common_style_attr_key: ($) => diff --git a/src/grammar.json b/src/grammar.json index b108d85..ff4dd7a 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -981,6 +981,14 @@ "_grid_attr_key": { "type": "CHOICE", "members": [ + { + "type": "STRING", + "value": "vertical-gap" + }, + { + "type": "STRING", + "value": "horizontal-gap" + }, { "type": "STRING", "value": "grid-gap" diff --git a/src/node-types.json b/src/node-types.json index c78856b..823463c 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -444,6 +444,10 @@ "type": "height", "named": false }, + { + "type": "horizontal-gap", + "named": false + }, { "type": "icon", "named": false @@ -528,6 +532,10 @@ "type": "underline", "named": false }, + { + "type": "vertical-gap", + "named": false + }, { "type": "width", "named": false diff --git a/src/parser.c b/src/parser.c index 39c1580..6d3394e 100644 Binary files a/src/parser.c and b/src/parser.c differ diff --git a/test/corpus/attributes.txt b/test/corpus/attributes.txt index 54cf289..5b6ca14 100644 --- a/test/corpus/attributes.txt +++ b/test/corpus/attributes.txt @@ -450,7 +450,8 @@ grid-columns: 1 header body: "" { - grid-gap: 0 + vertical-gap: 0 + horizontal-gap: 0 grid-columns: 2 content @@ -469,6 +470,7 @@ footer (container_key) (label (string)) (block + (attribute (attr_key) (attr_value (integer))) (attribute (attr_key) (attr_value (integer))) (attribute (attr_key) (attr_value (integer))) (shape (shape_key)) diff --git a/test/highlight/grid.d2 b/test/highlight/grid.d2 index e4c37d1..7daaa7a 100644 --- a/test/highlight/grid.d2 +++ b/test/highlight/grid.d2 @@ -8,6 +8,18 @@ grid-columns: 1 # <- property # ^ punctuation.delimiter # ^ number +vertical-gap: 0 +# <- property +# ^ property +# ^ property +# ^ punctuation.delimiter +# ^ number +horizontal-gap: 0 +# <- property +# ^ property +# ^ property +# ^ punctuation.delimiter +# ^ number header # <- variable