[PHP] Escaped dollar signs in target string literals

This commit is contained in:
Adam Wójs 2020-10-20 21:33:47 +02:00
parent a057ebbd2e
commit 5d3452e5be
1 changed files with 8 additions and 0 deletions

View File

@ -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;
}
}