Add 'property' field name where relevant

This commit is contained in:
Bruno BELANYI 2024-04-08 01:44:57 +01:00
parent 8bd249fc90
commit d232c089df
4 changed files with 176 additions and 49 deletions

View file

@ -41,14 +41,14 @@ module.exports = grammar({
_old_module: ($) => seq( _old_module: ($) => seq(
field("type", $.identifier), field("type", $.identifier),
"{", "{",
optional(commaSeparated($._colon_property)), optional(commaSeparated(field("property", $._colon_property))),
"}", "}",
), ),
_new_module: ($) => seq( _new_module: ($) => seq(
$.identifier, $.identifier,
"(", "(",
optional(commaSeparated($._equal_property)), optional(commaSeparated(field("property", $._equal_property))),
")", ")",
), ),
@ -175,7 +175,7 @@ module.exports = grammar({
map_expression: ($) => seq( map_expression: ($) => seq(
"{", "{",
optional(commaSeparated($._colon_property)), optional(commaSeparated(field("property", $._colon_property))),
"}", "}",
), ),

48
src/grammar.json generated
View file

@ -107,8 +107,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "_colon_property" "name": "property",
"content": {
"type": "SYMBOL",
"name": "_colon_property"
}
}, },
{ {
"type": "REPEAT", "type": "REPEAT",
@ -120,8 +124,12 @@
"value": "," "value": ","
}, },
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "_colon_property" "name": "property",
"content": {
"type": "SYMBOL",
"name": "_colon_property"
}
} }
] ]
} }
@ -169,8 +177,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "_equal_property" "name": "property",
"content": {
"type": "SYMBOL",
"name": "_equal_property"
}
}, },
{ {
"type": "REPEAT", "type": "REPEAT",
@ -182,8 +194,12 @@
"value": "," "value": ","
}, },
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "_equal_property" "name": "property",
"content": {
"type": "SYMBOL",
"name": "_equal_property"
}
} }
] ]
} }
@ -724,8 +740,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "_colon_property" "name": "property",
"content": {
"type": "SYMBOL",
"name": "_colon_property"
}
}, },
{ {
"type": "REPEAT", "type": "REPEAT",
@ -737,8 +757,12 @@
"value": "," "value": ","
}, },
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "_colon_property" "name": "property",
"content": {
"type": "SYMBOL",
"name": "_colon_property"
}
} }
] ]
} }

88
src/node-types.json generated
View file

@ -212,6 +212,48 @@
} }
] ]
}, },
"property": {
"multiple": true,
"required": false,
"types": [
{
"type": ":",
"named": false
},
{
"type": "boolean_literal",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "integer_literal",
"named": true
},
{
"type": "interpreted_string_literal",
"named": true
},
{
"type": "list_expression",
"named": true
},
{
"type": "map_expression",
"named": true
},
{
"type": "raw_string_literal",
"named": true
},
{
"type": "select_expression",
"named": true
}
]
},
"value": { "value": {
"multiple": true, "multiple": true,
"required": false, "required": false,
@ -266,6 +308,52 @@
} }
] ]
}, },
"property": {
"multiple": true,
"required": false,
"types": [
{
"type": ":",
"named": false
},
{
"type": "=",
"named": false
},
{
"type": "boolean_literal",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "integer_literal",
"named": true
},
{
"type": "interpreted_string_literal",
"named": true
},
{
"type": "list_expression",
"named": true
},
{
"type": "map_expression",
"named": true
},
{
"type": "raw_string_literal",
"named": true
},
{
"type": "select_expression",
"named": true
}
]
},
"type": { "type": {
"multiple": false, "multiple": false,
"required": false, "required": false,

83
src/parser.c generated
View file

@ -12,7 +12,7 @@
#define ALIAS_COUNT 0 #define ALIAS_COUNT 0
#define TOKEN_COUNT 30 #define TOKEN_COUNT 30
#define EXTERNAL_TOKEN_COUNT 0 #define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 10 #define FIELD_COUNT 11
#define MAX_ALIAS_SEQUENCE_LENGTH 6 #define MAX_ALIAS_SEQUENCE_LENGTH 6
#define PRODUCTION_ID_COUNT 16 #define PRODUCTION_ID_COUNT 16
@ -447,10 +447,11 @@ enum ts_field_identifiers {
field_namespace = 4, field_namespace = 4,
field_operator = 5, field_operator = 5,
field_pattern = 6, field_pattern = 6,
field_right = 7, field_property = 7,
field_type = 8, field_right = 8,
field_value = 9, field_type = 9,
field_variable = 10, field_value = 10,
field_variable = 11,
}; };
static const char * const ts_field_names[] = { static const char * const ts_field_names[] = {
@ -461,6 +462,7 @@ static const char * const ts_field_names[] = {
[field_namespace] = "namespace", [field_namespace] = "namespace",
[field_operator] = "operator", [field_operator] = "operator",
[field_pattern] = "pattern", [field_pattern] = "pattern",
[field_property] = "property",
[field_right] = "right", [field_right] = "right",
[field_type] = "type", [field_type] = "type",
[field_value] = "value", [field_value] = "value",
@ -468,80 +470,93 @@ static const char * const ts_field_names[] = {
}; };
static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
[1] = {.index = 0, .length = 3}, [1] = {.index = 0, .length = 4},
[2] = {.index = 3, .length = 2}, [2] = {.index = 4, .length = 3},
[3] = {.index = 5, .length = 3}, [3] = {.index = 7, .length = 3},
[4] = {.index = 8, .length = 1}, [4] = {.index = 10, .length = 1},
[5] = {.index = 9, .length = 3}, [5] = {.index = 11, .length = 4},
[6] = {.index = 12, .length = 2}, [6] = {.index = 15, .length = 3},
[7] = {.index = 14, .length = 2}, [7] = {.index = 18, .length = 3},
[8] = {.index = 16, .length = 2}, [8] = {.index = 21, .length = 2},
[9] = {.index = 18, .length = 5}, [9] = {.index = 23, .length = 7},
[10] = {.index = 23, .length = 4}, [10] = {.index = 30, .length = 6},
[11] = {.index = 27, .length = 4}, [11] = {.index = 36, .length = 6},
[12] = {.index = 31, .length = 4}, [12] = {.index = 42, .length = 6},
[13] = {.index = 35, .length = 2}, [13] = {.index = 48, .length = 2},
[14] = {.index = 37, .length = 4}, [14] = {.index = 50, .length = 4},
[15] = {.index = 41, .length = 2}, [15] = {.index = 54, .length = 2},
}; };
static const TSFieldMapEntry ts_field_map_entries[] = { static const TSFieldMapEntry ts_field_map_entries[] = {
[0] = [0] =
{field_field, 0, .inherited = true}, {field_field, 0, .inherited = true},
{field_property, 0, .inherited = true},
{field_type, 0, .inherited = true}, {field_type, 0, .inherited = true},
{field_value, 0, .inherited = true}, {field_value, 0, .inherited = true},
[3] = [4] =
{field_field, 0, .inherited = true}, {field_field, 0, .inherited = true},
{field_property, 0, .inherited = true},
{field_value, 0, .inherited = true}, {field_value, 0, .inherited = true},
[5] = [7] =
{field_left, 0}, {field_left, 0},
{field_operator, 1}, {field_operator, 1},
{field_right, 2}, {field_right, 2},
[8] = [10] =
{field_type, 0}, {field_type, 0},
[9] = [11] =
{field_field, 2, .inherited = true}, {field_field, 2, .inherited = true},
{field_property, 2},
{field_type, 0}, {field_type, 0},
{field_value, 2, .inherited = true}, {field_value, 2, .inherited = true},
[12] = [15] =
{field_field, 2, .inherited = true}, {field_field, 2, .inherited = true},
{field_property, 2},
{field_value, 2, .inherited = true}, {field_value, 2, .inherited = true},
[14] = [18] =
{field_field, 1, .inherited = true}, {field_field, 1, .inherited = true},
{field_property, 1},
{field_value, 1, .inherited = true}, {field_value, 1, .inherited = true},
[16] = [21] =
{field_field, 0}, {field_field, 0},
{field_value, 2}, {field_value, 2},
[18] = [23] =
{field_field, 2, .inherited = true}, {field_field, 2, .inherited = true},
{field_field, 3, .inherited = true}, {field_field, 3, .inherited = true},
{field_property, 2},
{field_property, 3, .inherited = true},
{field_type, 0}, {field_type, 0},
{field_value, 2, .inherited = true}, {field_value, 2, .inherited = true},
{field_value, 3, .inherited = true}, {field_value, 3, .inherited = true},
[23] = [30] =
{field_field, 0, .inherited = true}, {field_field, 0, .inherited = true},
{field_field, 1, .inherited = true}, {field_field, 1, .inherited = true},
{field_property, 0, .inherited = true},
{field_property, 1, .inherited = true},
{field_value, 0, .inherited = true}, {field_value, 0, .inherited = true},
{field_value, 1, .inherited = true}, {field_value, 1, .inherited = true},
[27] = [36] =
{field_field, 2, .inherited = true}, {field_field, 2, .inherited = true},
{field_field, 3, .inherited = true}, {field_field, 3, .inherited = true},
{field_property, 2},
{field_property, 3, .inherited = true},
{field_value, 2, .inherited = true}, {field_value, 2, .inherited = true},
{field_value, 3, .inherited = true}, {field_value, 3, .inherited = true},
[31] = [42] =
{field_field, 1, .inherited = true}, {field_field, 1, .inherited = true},
{field_field, 2, .inherited = true}, {field_field, 2, .inherited = true},
{field_property, 1},
{field_property, 2, .inherited = true},
{field_value, 1, .inherited = true}, {field_value, 1, .inherited = true},
{field_value, 2, .inherited = true}, {field_value, 2, .inherited = true},
[35] = [48] =
{field_condition, 2}, {field_condition, 2},
{field_type, 0}, {field_type, 0},
[37] = [50] =
{field_condition, 3}, {field_condition, 3},
{field_namespace, 2}, {field_namespace, 2},
{field_type, 0}, {field_type, 0},
{field_variable, 4}, {field_variable, 4},
[41] = [54] =
{field_pattern, 0}, {field_pattern, 0},
{field_value, 2}, {field_value, 2},
}; };