replace leading _ for private symbols with keyword hide

This commit is contained in:
2026-07-14 20:19:01 +02:00
parent 5157cf3bcc
commit 267947e79d
31 changed files with 125220 additions and 122709 deletions
+4
View File
@@ -51,6 +51,7 @@ module.exports = grammar({
),
function_declaration: $ => seq(
optional('hide'),
field('name', $.identifier),
field('kind', choice('func', 'c_func')),
field('parameters', $.parameter_list),
@@ -64,6 +65,7 @@ module.exports = grammar({
),
type_declaration: $ => prec(1, seq(
optional('hide'),
field('name', $.identifier),
'::',
repeat($._newline),
@@ -79,6 +81,7 @@ module.exports = grammar({
)),
global_constant_declaration: $ => seq(
optional('hide'),
field('name', $.identifier),
optional(field('type', $.type)),
'::',
@@ -87,6 +90,7 @@ module.exports = grammar({
),
global_variable_declaration: $ => seq(
optional('hide'),
field('name', $.identifier),
optional(field('type', $.type)),
'=',
@@ -60,6 +60,7 @@
"distinct"
"alias"
"import"
"hide"
"return"
"try"
"catch"
+48
View File
@@ -103,6 +103,18 @@
"function_declaration": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "hide"
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "name",
@@ -225,6 +237,18 @@
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "hide"
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "name",
@@ -287,6 +311,18 @@
"global_constant_declaration": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "hide"
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "name",
@@ -335,6 +371,18 @@
"global_variable_declaration": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "hide"
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "name",
+4
View File
@@ -2576,6 +2576,10 @@
"type": "func",
"named": false
},
{
"type": "hide",
"named": false
},
{
"type": "i16",
"named": false
+124751 -122484
View File
File diff suppressed because it is too large Load Diff
@@ -4,6 +4,16 @@ Core syntax
io :: import "@std/io"
hide private_value :: 1
hide private_counter i32 = 0
hide Private :: opaque
hide private_sum func(a, b i32) i32 {
return a + b
}
Status :: enum {
ok
bad
@@ -30,6 +40,38 @@ sum func(a, b i32) i32 ! Status {
(identifier)
(string
(string_content)))
(global_constant_declaration
(identifier)
(expression
(integer)))
(global_variable_declaration
(identifier)
(type
(builtin_type))
(expression
(integer)))
(type_declaration
(identifier)
(opaque_type))
(function_declaration
(identifier)
(parameter_list
(parameter
(identifier)
(identifier)
(type
(builtin_type))))
(type
(builtin_type))
(block
(statement
(return_statement
(expression
(binary_expression
(expression
(identifier))
(expression
(identifier))))))))
(type_declaration
(identifier)
(enum_type
@@ -1,7 +1,10 @@
hide helper func() void {}
# <- keyword
main func() void {
_ = sizeof!(i32)
# ^^^^^^ function.builtin
# ^ operator
# ^ operator
_ = sizeof(i32)
# ^^^^^^ function
}