parser: make println consume parens
This commit is contained in:
parent
1651a99faf
commit
02c2055601
2 changed files with 11 additions and 6 deletions
|
@ -1,12 +1,13 @@
|
|||
//const (
|
||||
// Cock = 1
|
||||
// Ball = 2
|
||||
// Deals = 3
|
||||
// Businesses = 4
|
||||
//)
|
||||
const (
|
||||
Cock = 1
|
||||
Ball = 2 + 3
|
||||
Deals = 3
|
||||
Businesses = 4
|
||||
)
|
||||
|
||||
fn main(a int) int {
|
||||
1 + 2 + 3 + 4
|
||||
1 + 1 * 1
|
||||
3 / (51 + 2)
|
||||
println(2 * 1956)
|
||||
}
|
||||
|
|
|
@ -405,7 +405,11 @@ pub const Parser = struct {
|
|||
|
||||
fn parsePrintln(self: *@This()) !*Stmt {
|
||||
_ = try self.consumeSingle(.Println);
|
||||
|
||||
_ = try self.consumeSingle(.LeftParen);
|
||||
var expr = try self.parseExpr();
|
||||
_ = try self.consumeSingle(.RightParen);
|
||||
|
||||
return try Stmt.mkPrintln(self.allocator, expr.Expr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue