Just realized point { x = 1 } was ambiguous, could be record update or function application. changed record update syntax to: point.{ x = 1 }. And starting on ui components

This commit is contained in:
Dustin Swan 2026-02-03 12:17:41 -07:00
parent 645de97db2
commit d55ae33848
No known key found for this signature in database
GPG key ID: 30D46587E2100467
4 changed files with 32 additions and 14 deletions

View file

@ -319,17 +319,9 @@ export class Parser {
while (true) {
if (this.current().kind === 'dot') {
// Record access
this.advance();
const fieldToken = this.expect('ident');
const field = (fieldToken as { value: string }).value;
expr = { kind: 'record-access', record: expr, field };
} else if (this.current().kind === 'open-brace') {
if (expr.kind === 'constructor') {
// Constructor application
const record = this.parsePrimary();
expr = { kind: 'apply', func: expr, args: [record] };
} else {
if (this.current().kind === 'open-brace') {
// Record update
this.advance();
const updates: { [key: string]: AST } = {};
@ -349,7 +341,21 @@ export class Parser {
this.expect('close-brace');
expr = { kind: 'record-update', record: expr, updates }
} else {
// Record access
const fieldToken = this.expect('ident');
const field = (fieldToken as { value: string }).value;
expr = { kind: 'record-access', record: expr, field };
}
} else if (this.current().kind === 'open-brace') {
// if (expr.kind === 'constructor') {
// Function / constructor application
const record = this.parsePrimary();
expr = { kind: 'apply', func: expr, args: [record] };
// } else {
// break;
// }
} else {
break;
}