diff -r 05de34f712fe -r 219b49bf4a03 src/compiler/Parser.cpp --- a/src/compiler/Parser.cpp Sat Jan 12 16:35:26 2013 -0800 +++ b/src/compiler/Parser.cpp Sun Jan 27 17:34:30 2013 -0800 @@ -1106,7 +1106,7 @@ break; case TOK_ENUM: - if ((statement = enum_()) == NULL) + if ((statement = enum_(TOK_NONE)) == NULL) return NULL; break; @@ -1189,7 +1189,7 @@ } Statement * -Parser::enum_() +Parser::enum_(TokenKind kind) { // enum ::= "enum" name? { enum_members? } // enum_members ::= enum_member ","? | @@ -1229,7 +1229,7 @@ if (!expect(TOK_RBRACE)) return NULL; - return new (pool_) EnumStatement(pos, name, entries); + return new (pool_) EnumStatement(pos, kind, name, entries); } template @@ -1460,6 +1460,11 @@ return NULL; if (!matchSemicolon()) return NULL; + } else if (kind == TOK_PUBLIC && peek(TOK_ENUM)) { + if ((statement = enum_(kind)) == NULL) + return NULL; + if (!matchSemicolon()) + return NULL; } else { if ((statement = function(kind)) == NULL) return NULL; @@ -1485,7 +1490,7 @@ } case TOK_ENUM: - if ((statement = enum_()) == NULL) + if ((statement = enum_(TOK_NONE)) == NULL) return NULL; if (!matchSemicolon()) return NULL;