This commit is contained in:
Greg Shuflin 2021-10-31 02:44:33 -07:00
parent 803a836887
commit 87024b79ba
2 changed files with 6 additions and 11 deletions

View File

@ -394,14 +394,14 @@ impl Parser {
let tok = self.token_handler.peek();
let kind = match tok.get_kind() {
AtSign => self.annotation().map(StatementKind::Declaration),
Keyword(Type) => self.type_declaration().map(|decl| StatementKind::Declaration(decl)),
Keyword(Func) => self.func_declaration().map(|func| StatementKind::Declaration(func)),
Keyword(Type) => self.type_declaration().map(StatementKind::Declaration),
Keyword(Func) => self.func_declaration().map(StatementKind::Declaration),
Keyword(Let) => self.binding_declaration().map(StatementKind::Declaration),
Keyword(Interface) => self.interface_declaration().map(StatementKind::Declaration),
Keyword(Impl) => self.impl_declaration().map(StatementKind::Declaration),
Keyword(Import) => self.import_declaration().map(StatementKind::Import),
Keyword(Module) => self.module_declaration().map(StatementKind::Module),
_ => self.expression().map(|expr| StatementKind::Expression(expr)),
_ => self.expression().map(StatementKind::Expression),
}?;
let id = self.id_store.fresh();
Ok(Statement { kind, id, location: tok.location })
@ -693,13 +693,8 @@ impl Parser {
#[recursive_descent_method]
fn prefix_expr(&mut self) -> ParseResult<Expression> {
loop {
match self.token_handler.peek_kind() {
Semicolon | Newline => {
self.token_handler.next();
}
_ => break,
}
while let Semicolon | Newline = self.token_handler.peek_kind() {
self.token_handler.next();
}
match self.token_handler.peek_kind() {

View File

@ -142,7 +142,7 @@ impl<'a, 'b> Reducer<'a, 'b> {
e => return Expression::ReductionError(format!("Bad symbol for NamedStruct: {:?}", e)),
};
let field_order = compute_field_orderings(&self.type_context, &type_id, tag).unwrap();
let field_order = compute_field_orderings(self.type_context, &type_id, tag).unwrap();
let mut field_map = HashMap::new();
for (name, expr) in fields.iter() {