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

10
src/grammar.json generated
View File

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

83
src/node-types.json generated
View File

@ -204,19 +204,7 @@
"required": true,
"types": [
{
"type": "array_type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"type": "type",
"named": true
}
]
@ -285,24 +273,12 @@
"multiple": true,
"required": true,
"types": [
{
"type": "array_type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_key_type",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"type": "type",
"named": true
}
]
@ -327,19 +303,7 @@
"required": true,
"types": [
{
"type": "array_type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"type": "type",
"named": true
}
]
@ -399,19 +363,7 @@
"required": true,
"types": [
{
"type": "array_type",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "map_type",
"named": true
},
{
"type": "primitive_type",
"type": "type",
"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",
"named": true,

1272
src/parser.c generated

File diff suppressed because it is too large Load Diff