virtual keyword parsing and ast

This commit is contained in:
2026-07-09 06:23:04 +02:00
parent 442d1e66a8
commit 0d2199ee3a
4 changed files with 12 additions and 5 deletions
+4 -1
View File
@@ -36,6 +36,7 @@ keyword = {
| "override"
| "const"
| "type"
| "virtual"
}
identifier = @{
@@ -373,10 +374,12 @@ trait_decl = {
// FUNCTIONS
// ======================================================
virtual_kw = { "virtual" }
override_kw = { "override" ~ ("(" ~ expr_path ~ ")")? }
function_decl = {
visibility? ~ ("void" | type_expr) ~ identifier ~ generics_decl? ~ "(" ~ method_args ~ ")" ~ override_kw? ~ (block | semicolon)
visibility? ~ virtual_kw? ~ ("void" | type_expr) ~ identifier ~ generics_decl? ~ "(" ~ method_args ~ ")" ~ override_kw? ~ (block | semicolon)
}
// ======================================================