Skip to content

Commit 25d080e

Browse files
committed
optional semicolon between toplevel statements
1 parent dda18c5 commit 25d080e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

abra_core/src/parse.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub(crate) fn parse_file(ctx: &mut StaticsContext, file_id: FileId) -> Rc<FileAs
2424
match parser.parse_item() {
2525
Ok(item) => {
2626
items.push(item);
27+
// optional semicolon between toplevel statements (and items in general)
28+
if parser.current_token().tag() == TokenTag::Semicolon {
29+
parser.consume_token();
30+
}
2731
}
2832
Err(e) => {
2933
// flush errors

abra_core/tests/integration/e2e_bytecode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ fn arithmetic() {
1616
fn sub(x, y) {
1717
x - y
1818
}
19-
let x = 3
20-
let y = 4
19+
let x = 3; let y = 4
2120
let z = sub(x, y)
2221
let h = sub(z, 1)
2322
h

0 commit comments

Comments
 (0)