[fine] Classes!

It's kinda amazing this works actually
This commit is contained in:
John Doty 2024-01-20 11:03:33 -08:00
parent 0ee89bf26b
commit 4505996710
5 changed files with 319 additions and 40 deletions

View file

@ -150,6 +150,7 @@ pub enum TreeKind {
FieldList,
NewObjectExpression,
FieldValue,
MemberAccess,
}
pub struct Tree<'a> {
@ -794,6 +795,16 @@ fn expression_with_power(p: &mut CParser, minimum_power: u8) {
expression_with_power(p, power);
expr = p.end(m, TreeKind::BinaryExpression);
}
while p.at(TokenKind::Dot) {
let m = p.start_before(expr);
p.advance(); // Consume the dot
p.expect(
TokenKind::Identifier,
"expected an identifier for member access",
);
expr = p.end(m, TreeKind::MemberAccess);
}
}
fn argument_list(p: &mut CParser) {