feat(parser): reserved keyword as member name after .

After a leading `.` (enum literal `.enum`, field access `x.enum` /
`E.struct`, match arm `case .enum:`) a reserved keyword is unambiguously
the member/variant NAME — the dot rules out the keyword reading — so no
backtick escape is needed. A declaration of such a variant still needs
the backtick (enum { `enum: i64 }), since the decl site has no dot.

Adds Parser.dotMemberName() (identifier OR identifier-shaped keyword)
and routes the leading-dot enum-literal and postfix field-access sites
through it. readme updated. The reify example 0614 now uses the cleaner
reify(.enum(...)) spelling (still xfail — reify lands next commit).
This commit is contained in:
agra
2026-06-16 18:22:21 +03:00
parent 1bec54d0c4
commit b25a2f60d6
3 changed files with 44 additions and 12 deletions

View File

@@ -8,7 +8,7 @@
#import "modules/std.sx";
#import "modules/std/meta.sx";
E :: reify(.`enum(.{ variants = .[
E :: reify(.enum(.{ variants = .[
EnumVariant.{ name = "value", payload = i64 },
EnumVariant.{ name = "closed", payload = void },
] }));