From 5b91c50b8f9b6057990bda1267aefcf5a23152ab Mon Sep 17 00:00:00 2001 From: YuriUfimtsev Date: Sat, 28 Oct 2023 18:41:50 +0300 Subject: [PATCH] Add support for parsing enum class declarations --- generator/parser/parser.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/generator/parser/parser.cpp b/generator/parser/parser.cpp index 429a02d19..fc362f25f 100644 --- a/generator/parser/parser.cpp +++ b/generator/parser/parser.cpp @@ -1389,9 +1389,25 @@ bool Parser::parseEnumSpecifier(TypeSpecifierAST *&node) CHECK(Token_enum); + if (token_stream.lookAhead() == Token_class) + { + token_stream.nextToken(); + } + NameAST *name = 0; parseName(name); + if(token_stream.lookAhead() == ':') + { + token_stream.nextToken(); + TypeSpecifierAST *ast = 0; + if (!parseSimpleTypeSpecifier(ast)) + { + token_stream.rewind((int) start); + return false; + } + } + if (token_stream.lookAhead() != '{') { token_stream.rewind((int) start); @@ -1796,12 +1812,17 @@ bool Parser::parseForwardDeclarationSpecifier(TypeSpecifierAST *&node) std::size_t start = token_stream.cursor(); int kind = token_stream.lookAhead(); - if (kind != Token_class && kind != Token_struct && kind != Token_union) + if (kind != Token_class && kind != Token_struct && kind != Token_union && kind != Token_enum) return false; std::size_t class_key = token_stream.cursor(); token_stream.nextToken(); + if (kind == Token_enum && token_stream.lookAhead() == Token_class) + { + token_stream.nextToken(); + } + NameAST *name = 0; if (!parseName(name, false)) { token_stream.rewind((int) start);