constants and static #102

This commit is contained in:
2026-07-02 06:51:04 +02:00
parent 493c668495
commit 5346cd05be
5 changed files with 55 additions and 1 deletions
+8 -1
View File
@@ -34,6 +34,7 @@ keyword = {
| "loop"
| "unsafe"
| "override"
| "const"
}
identifier = @{
@@ -362,13 +363,19 @@ function_decl = {
visibility? ~ ("void" | type_expr) ~ identifier ~ generics_decl? ~ "(" ~ method_args ~ ")" ~ override_kw? ~ (block | semicolon)
}
// ======================================================
// CONSTANTS / STATIC
// ======================================================
const_decl = { "const" ~ var_decl_statement ~ ";" }
static_decl = { "static" ~ var_decl_statement ~ ";" }
// ======================================================
// TOP LEVEL
// ======================================================
top_level = {
mod_attribute
| (attributes ~ (import | impl_for_decl | impl_decl | trait_decl | struct_decl | enum_decl | class_decl | declare_module | function_decl))
| (attributes ~ (import | impl_for_decl | impl_decl | trait_decl | struct_decl | enum_decl | class_decl | declare_module | function_decl | const_decl | static_decl))
}
// ======================================================