Commit 9f83930
feat(parser): builtin-type & lowercase-module qualified paths + TOTAL field name (Refs gitbot-fleet#148)
Three closely-related expr_primary/field_name extensions, all driven by
sustainabot hand-port shapes (gitbot-fleet#148):
1. Builtin-type-qualified value path: `Int::to_string(n)`,
`String::len(s)`, etc. The built-in type names are reserved keyword
tokens (NAT/INT_T/BOOL/FLOAT_T/STRING_T/CHAR_T), not UPPER_IDENT, so
the existing `upper_ident COLONCOLON lower_ident` production never
fired for them. Six new productions, one per builtin keyword,
producing the canonical `ExprField (ExprVar TypeName, fname)` shape
that [Resolve] already expects from upper-ident paths.
2. Lowercase-module-qualified value path: `json::encode_string(s)`,
`string::join(xs, sep)`, etc. The stdlib already defines lowercase
modules (`module json;`, `module string;`) and `use json::{...}`
parses, but the expression-position qualified path only covered
uppercase modules. The new `lower_ident COLONCOLON lower_ident`
rule mirrors the upper-ident form.
3. `total` as a record-field name. Added to `field_name` alongside the
existing `handle` contextual-keyword exception. Safe by the same
reasoning HANDLE is safe: as a function-decl modifier TOTAL appears
between `visibility?` and `FN`, never after DOT/before COLON in a
record body; as a field name it appears between COLON / DOT and the
field value. The surrounding token disambiguates. Used by
sustainabot's `HealthIndex.total`, `Recommendation.total`, etc.
Conflict-cost: zero. Parser builds with 21 S/R + 1 R/R, identical to
the pre-patch baseline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 44b5341 commit 9f83930
1 file changed
Lines changed: 54 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
874 | 920 | | |
875 | 921 | | |
876 | 922 | | |
| |||
1182 | 1228 | | |
1183 | 1229 | | |
1184 | 1230 | | |
1185 | | - | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
1186 | 1238 | | |
1187 | 1239 | | |
1188 | 1240 | | |
| 1241 | + | |
1189 | 1242 | | |
1190 | 1243 | | |
1191 | 1244 | | |
| |||
0 commit comments