diff --git a/tool/src/org/antlr/v4/codegen/target/PHPTarget.java b/tool/src/org/antlr/v4/codegen/target/PHPTarget.java index 686e10e9c..b359cee9c 100644 --- a/tool/src/org/antlr/v4/codegen/target/PHPTarget.java +++ b/tool/src/org/antlr/v4/codegen/target/PHPTarget.java @@ -102,4 +102,12 @@ public class PHPTarget extends Target { protected void appendUnicodeEscapedCodePoint(int codePoint, StringBuilder sb) { UnicodeEscapes.appendPythonStyleEscapedCodePoint(codePoint, sb); } + + @Override + public String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, String literal, boolean addQuotes) { + String targetStringLiteral = super.getTargetStringLiteralFromANTLRStringLiteral(generator, literal, addQuotes); + targetStringLiteral = targetStringLiteral.replace("$", "\\$"); + + return targetStringLiteral; + } }