v2: enum fields separated by commas
parent
5b990078f9
commit
9bb1b5d1bb
|
@ -52,7 +52,6 @@ pub fn parse_stmt(text string, table &table.Table, scope &ast.Scope) ast.Stmt {
|
|||
pref: &pref.Preferences{}
|
||||
scope: scope
|
||||
// scope: &ast.Scope{start_pos: 0, parent: 0}
|
||||
|
||||
}
|
||||
p.init_parse_fns()
|
||||
p.read_first_token()
|
||||
|
@ -781,7 +780,6 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
|
|||
node = ast.SizeOf{
|
||||
typ: sizeof_type
|
||||
// type_name: type_name
|
||||
|
||||
}
|
||||
}
|
||||
.key_typeof {
|
||||
|
@ -1052,7 +1050,6 @@ fn (p mut Parser) infix_expr(left ast.Expr) ast.Expr {
|
|||
left: left
|
||||
right: right
|
||||
// right_type: typ
|
||||
|
||||
op: op
|
||||
pos: pos
|
||||
}
|
||||
|
@ -1457,7 +1454,6 @@ fn (p mut Parser) const_decl() ast.ConstDecl {
|
|||
fields << ast.Field{
|
||||
name: name
|
||||
// typ: typ
|
||||
|
||||
}
|
||||
exprs << expr
|
||||
// TODO: once consts are fixed reg here & update in checker
|
||||
|
@ -1851,6 +1847,13 @@ fn (p mut Parser) enum_decl() ast.EnumDecl {
|
|||
p.next()
|
||||
default_exprs << p.expr(0)
|
||||
}
|
||||
// Allow commas after enum, helpful for
|
||||
// enum Color {
|
||||
// r,g,b
|
||||
// }
|
||||
if p.tok.kind == .comma {
|
||||
p.next()
|
||||
}
|
||||
}
|
||||
p.check(.rcbr)
|
||||
p.table.register_type_symbol(table.TypeSymbol{
|
||||
|
|
|
@ -25,7 +25,7 @@ fn test_match_integers() {
|
|||
assert match 0 {
|
||||
1 { 2 }
|
||||
2 { 3 }
|
||||
else 5
|
||||
else { 5 }
|
||||
} == 5
|
||||
|
||||
assert match 1 {
|
||||
|
|
Loading…
Reference in New Issue