From d760aa7784c28cb914e51f7f771652d2bbbd1d32 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sat, 4 Jun 2022 10:47:32 +0200 Subject: [PATCH 7/9] ANTLR4 4.10 compatibility Commit 70b2edcf98[0] removed antlrcpp::Any in favor of std::any. [0]: https://github.com/antlr/antlr4/commit/70b2edcf98eb612a92d3dbaedb2ce0b69533b0cb --- src/ParseFasm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ParseFasm.cpp b/src/ParseFasm.cpp index 6a1e720..8f3ca67 100644 --- a/src/ParseFasm.cpp +++ b/src/ParseFasm.cpp @@ -199,7 +199,7 @@ struct ParseException { /// Helper macro to convert a rule context into a string /// For use inside FasmParserBaseVisitor -#define GET(x) (context->x() ? visit(context->x()).as() : "") +#define GET(x) (context->x() ? std::any_cast(visit(context->x())) : "") /// FasmParserBaseVisitor is a visitor for the parse tree /// generated by the ANTLR parser. @@ -218,7 +218,7 @@ class FasmParserBaseVisitor : public FasmParserVisitor { virtual Any visitFasmFile( FasmParser::FasmFileContext* context) override { for (auto& line : context->fasmLine()) { - std::string str = visit(line).as(); + std::string str = std::any_cast(visit(line)); if (!str.empty()) { out << str; if (hex_mode) @@ -285,8 +285,7 @@ class FasmParserBaseVisitor : public FasmParserVisitor { TAG('\'', width), std::stoi(context->INT()->getText())); } - data << visit(context->verilogDigits()) - .as(); + data << std::any_cast(visit(context->verilogDigits())); } return data.str(); } @@ -439,7 +438,7 @@ class FasmParserBaseVisitor : public FasmParserVisitor { FasmParser::AnnotationsContext* context) override { std::ostringstream data; for (auto& a : context->annotation()) { - data << visit(a).as(); + data << std::any_cast(visit(a)); } return withHeader(TAG('{', annotations), data.str()); } -- 2.36.1