From 7498f26909388ec1927282521f60b3f0a95ee8ec Mon Sep 17 00:00:00 2001 From: Marcos Passos Date: Fri, 11 Mar 2022 11:18:37 -0300 Subject: [PATCH] Fix PHP codegen to support int ATN serialization --- .../org/antlr/v4/tool/templates/codegen/PHP/PHP.stg | 6 +++--- tool/src/org/antlr/v4/codegen/target/PHPTarget.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/PHP/PHP.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/PHP/PHP.stg index ce1adca97e..f86347941d 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/PHP/PHP.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/PHP/PHP.stg @@ -297,7 +297,7 @@ namespace { return self::RULE_NAMES; } - public function getSerializedATN() : string + public function getSerializedATN() : array { return self::SERIALIZED_ATN; } @@ -1173,7 +1173,7 @@ namespace { return self::RULE_NAMES; } - public function getSerializedATN() : string + public function getSerializedATN() : array { return self::SERIALIZED_ATN; } @@ -1210,7 +1210,7 @@ namespace { SerializedATN(model) ::= << private const SERIALIZED_ATN = - " "}>"; + [}; separator=", ", wrap={<\n> }>]; >> /** diff --git a/tool/src/org/antlr/v4/codegen/target/PHPTarget.java b/tool/src/org/antlr/v4/codegen/target/PHPTarget.java index 84164e12b0..b8c362f2f6 100644 --- a/tool/src/org/antlr/v4/codegen/target/PHPTarget.java +++ b/tool/src/org/antlr/v4/codegen/target/PHPTarget.java @@ -96,7 +96,7 @@ public String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generat @Override public boolean isATNSerializedAsInts() { - return false; + return true; } @Override