wip
This commit is contained in:
@@ -27,13 +27,13 @@ module.exports = grammar({
|
|||||||
)),
|
)),
|
||||||
|
|
||||||
attribute: $ => seq(
|
attribute: $ => seq(
|
||||||
$.identifier,
|
field('name', $.identifier),
|
||||||
'=',
|
'=',
|
||||||
$.expression
|
$.expression
|
||||||
),
|
),
|
||||||
|
|
||||||
block: $ => seq(
|
block: $ => seq(
|
||||||
field('type', $.identifier),
|
field('name', $.identifier),
|
||||||
repeat(choice($.string_lit, $.identifier)),
|
repeat(choice($.string_lit, $.identifier)),
|
||||||
'{',
|
'{',
|
||||||
optional($.body),
|
optional($.body),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
; highlights.scm
|
; highlights.scm
|
||||||
|
|
||||||
(block type: (identifier) @keyword)
|
(block name: (identifier) @hcl_block_name)
|
||||||
|
(attribute name: (identifier) @hcl_attribute_name)
|
||||||
(identifier) @string.special
|
(identifier) @string.special
|
||||||
(string_lit) @string
|
(string_lit) @string
|
||||||
(numeric_lit) @number
|
(numeric_lit) @number
|
||||||
|
|||||||
@@ -30,8 +30,12 @@
|
|||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "FIELD",
|
||||||
"name": "identifier"
|
"name": "name",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
@@ -48,7 +52,7 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "type",
|
"name": "name",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
|
|||||||
@@ -2,18 +2,25 @@
|
|||||||
{
|
{
|
||||||
"type": "attribute",
|
"type": "attribute",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {},
|
"fields": {
|
||||||
|
"name": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "expression",
|
"type": "expression",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -22,7 +29,7 @@
|
|||||||
"type": "block",
|
"type": "block",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"type": {
|
"name": {
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
|||||||
@@ -294,12 +294,12 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
field_type = 1,
|
field_name = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const ts_field_names[] = {
|
static const char * const ts_field_names[] = {
|
||||||
[0] = NULL,
|
[0] = NULL,
|
||||||
[field_type] = "type",
|
[field_name] = "name",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
|
static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
|
||||||
@@ -308,7 +308,7 @@ static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
|
|||||||
|
|
||||||
static const TSFieldMapEntry ts_field_map_entries[] = {
|
static const TSFieldMapEntry ts_field_map_entries[] = {
|
||||||
[0] =
|
[0] =
|
||||||
{field_type, 0},
|
{field_name, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
|
static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
|
||||||
@@ -2942,7 +2942,7 @@ static const TSParseActionEntry ts_parse_actions[] = {
|
|||||||
[109] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5),
|
[109] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5),
|
||||||
[111] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
|
[111] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
|
||||||
[113] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 4, .production_id = 1),
|
[113] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 4, .production_id = 1),
|
||||||
[115] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute, 3),
|
[115] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute, 3, .production_id = 1),
|
||||||
[117] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
|
[117] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
|
||||||
[119] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
|
[119] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
|
||||||
[121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 5, .production_id = 1),
|
[121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 5, .production_id = 1),
|
||||||
|
|||||||
Reference in New Issue
Block a user