Change some name visibilities

This commit is contained in:
Fabian Stamm 2024-10-02 18:52:48 +02:00
parent 54191a699b
commit 9ee4a7c843
4 changed files with 684 additions and 691 deletions

View File

@ -72,7 +72,7 @@ module.exports = grammar({
field("name", $.identifier), field("name", $.identifier),
field("parameters", $.function_arguments), field("parameters", $.function_arguments),
":", ":",
field("return_type", $._type), field("return_type", $.type),
";", ";",
), ),
function_arguments: ($) => function_arguments: ($) =>
@ -87,7 +87,7 @@ module.exports = grammar({
seq( seq(
field("argument_identifier", $.identifier), field("argument_identifier", $.identifier),
":", ":",
field("argument_type", $._type), field("argument_type", $.type),
), ),
pair: ($) => pair: ($) =>
@ -95,14 +95,14 @@ module.exports = grammar({
field("key", $.identifier), field("key", $.identifier),
optional("?"), optional("?"),
":", ":",
field("value", $._type), field("value", $.type),
), ),
_type: ($) => type: ($) =>
choice($.map_type, $.array_type, $.primitive_type, $.identifier), choice($.map_type, $.array_type, $.primitive_type, $.identifier),
primitive_type: ($) => choice("int", "string", "float", "boolean", "void"), primitive_type: ($) => choice("int", "string", "float", "boolean", "void"),
array_type: ($) => seq(choice($.primitive_type, $.identifier), "[]"), array_type: ($) => seq(choice($.primitive_type, $.identifier), "[]"),
map_type: ($) => seq("{", $.map_key_type, ",", $._type, "}"), map_type: ($) => seq("{", $.map_key_type, ",", $.type, "}"),
map_key_type: ($) => choice("int", "string"), map_key_type: ($) => choice("int", "string"),
identifier: ($) => /[a-zA-Z_][a-zA-Z_0-9]*/, identifier: ($) => /[a-zA-Z_][a-zA-Z_0-9]*/,

10
src/grammar.json generated
View File

@ -451,7 +451,7 @@
"name": "return_type", "name": "return_type",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_type" "name": "type"
} }
}, },
{ {
@ -526,7 +526,7 @@
"name": "argument_type", "name": "argument_type",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_type" "name": "type"
} }
} }
] ]
@ -563,12 +563,12 @@
"name": "value", "name": "value",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_type" "name": "type"
} }
} }
] ]
}, },
"_type": { "type": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@ -653,7 +653,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_type" "name": "type"
}, },
{ {
"type": "STRING", "type": "STRING",

83
src/node-types.json generated
View File

@ -204,19 +204,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "array_type", "type": "type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"named": true "named": true
} }
] ]
@ -285,24 +273,12 @@
"multiple": true, "multiple": true,
"required": true, "required": true,
"types": [ "types": [
{
"type": "array_type",
"named": true
},
{
"type": "identifier",
"named": true
},
{ {
"type": "map_key_type", "type": "map_key_type",
"named": true "named": true
}, },
{ {
"type": "map_type", "type": "type",
"named": true
},
{
"type": "primitive_type",
"named": true "named": true
} }
] ]
@ -327,19 +303,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "array_type", "type": "type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"named": true "named": true
} }
] ]
@ -399,19 +363,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "array_type", "type": "type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"named": true "named": true
} }
] ]
@ -486,6 +438,33 @@
] ]
} }
}, },
{
"type": "type",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "array_type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"named": true
}
]
}
},
{ {
"type": "type_declaration", "type": "type_declaration",
"named": true, "named": true,

1272
src/parser.c generated

File diff suppressed because it is too large Load Diff