Generate parser

pull/844/head
Gears 2025-05-17 12:51:15 +07:00
parent bf545869aa
commit 6ece453acf
3 changed files with 59 additions and 21 deletions

40
src/grammar.json generated

@ -476,24 +476,54 @@
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "type"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "type_identifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "type"
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "as"
},
{
"type": "FIELD",
"name": "alias",
"content": {
"type": "SYMBOL",
"name": "type_identifier"
}
}
]
},
{
"type": "BLANK"
}
]
},
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "type_identifier"
"name": "constructor_name"
}
},
{
@ -511,7 +541,7 @@
"name": "alias",
"content": {
"type": "SYMBOL",
"name": "type_identifier"
"name": "constructor_name"
}
}
]

@ -4693,6 +4693,10 @@
"multiple": false,
"required": false,
"types": [
{
"type": "constructor_name",
"named": true
},
{
"type": "identifier",
"named": true
@ -4707,6 +4711,10 @@
"multiple": false,
"required": true,
"types": [
{
"type": "constructor_name",
"named": true
},
{
"type": "identifier",
"named": true

32
src/parser.c generated

@ -73321,7 +73321,7 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2936), 1,
anon_sym_RBRACE,
@ -73330,7 +73330,7 @@ static const uint16_t ts_small_parse_table[] = {
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
STATE(1631), 1,
sym_unqualified_import,
ACTIONS(5), 2,
@ -73380,7 +73380,7 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2938), 1,
anon_sym_type,
@ -73389,7 +73389,7 @@ static const uint16_t ts_small_parse_table[] = {
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
STATE(1631), 1,
sym_unqualified_import,
ACTIONS(5), 2,
@ -73438,7 +73438,7 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2938), 1,
anon_sym_type,
@ -73447,7 +73447,7 @@ static const uint16_t ts_small_parse_table[] = {
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
STATE(1631), 1,
sym_unqualified_import,
ACTIONS(5), 2,
@ -73510,7 +73510,7 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2938), 1,
anon_sym_type,
@ -73519,7 +73519,7 @@ static const uint16_t ts_small_parse_table[] = {
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
STATE(1631), 1,
sym_unqualified_import,
ACTIONS(5), 2,
@ -73568,7 +73568,7 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2938), 1,
anon_sym_type,
@ -73579,7 +73579,7 @@ static const uint16_t ts_small_parse_table[] = {
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
ACTIONS(5), 2,
sym_statement_comment,
sym_comment,
@ -73588,7 +73588,7 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2938), 1,
anon_sym_type,
@ -73599,7 +73599,7 @@ static const uint16_t ts_small_parse_table[] = {
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
ACTIONS(5), 2,
sym_statement_comment,
sym_comment,
@ -73608,14 +73608,14 @@ static const uint16_t ts_small_parse_table[] = {
sym_module_comment,
ACTIONS(99), 1,
sym__name,
ACTIONS(2723), 1,
ACTIONS(101), 1,
sym__upname,
ACTIONS(2938), 1,
anon_sym_type,
STATE(1588), 1,
sym_identifier,
STATE(1589), 1,
sym_type_identifier,
sym_constructor_name,
STATE(1631), 1,
sym_unqualified_import,
ACTIONS(5), 2,
@ -78302,10 +78302,10 @@ static const uint16_t ts_small_parse_table[] = {
[87462] = 4,
ACTIONS(3), 1,
sym_module_comment,
ACTIONS(2723), 1,
ACTIONS(451), 1,
sym__upname,
STATE(1740), 1,
sym_type_identifier,
sym_constructor_name,
ACTIONS(5), 2,
sym_statement_comment,
sym_comment,