summarylogtreecommitdiffstats
path: root/0001-ANTLR4-4.10-compatibility.patch
diff options
context:
space:
mode:
Diffstat (limited to '0001-ANTLR4-4.10-compatibility.patch')
-rw-r--r--0001-ANTLR4-4.10-compatibility.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/0001-ANTLR4-4.10-compatibility.patch b/0001-ANTLR4-4.10-compatibility.patch
new file mode 100644
index 000000000000..de89c5d9e39f
--- /dev/null
+++ b/0001-ANTLR4-4.10-compatibility.patch
@@ -0,0 +1,56 @@
+From 752ae3a73c5c5c17feacf896d269752956700c11 Mon Sep 17 00:00:00 2001
+From: Xiretza <xiretza@xiretza.xyz>
+Date: Sat, 4 Jun 2022 10:47:32 +0200
+Subject: [PATCH 1/7] 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<std::string>() : "")
++#define GET(x) (context->x() ? std::any_cast<std::string>(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>();
++ std::string str = std::any_cast<std::string>(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<std::string>();
++ data << std::any_cast<std::string>(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<std::string>();
++ data << std::any_cast<std::string>(visit(a));
+ }
+ return withHeader(TAG('{', annotations), data.str());
+ }
+--
+2.36.1
+