Package org.antlr.v4.codegen.target
Class PHPTarget
java.lang.Object
org.antlr.v4.codegen.Target
org.antlr.v4.codegen.target.PHPTarget
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.antlr.v4.codegen.Target
defaultCharValueEscape, gen -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringescapeChar(int v) For pure strings of Unicode char, how can we display it in the target language as a literal.getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, String literal, boolean addQuotes, boolean escapeSpecial) Convert from an ANTLR string literal found in a grammar file to an equivalent string literal in the target language.booleanbooleanMethods inherited from class org.antlr.v4.codegen.Target
addEscapedChar, addEscapedChar, appendUnicodeEscapedCodePoint, encodeInt16AsCharEscape, escapeIfNeeded, escapeWord, genFile, getAltLabelContextStructName, getBaseListenerFileName, getBaseVisitorFileName, getCodeGenerator, getElementListName, getElementName, getImplicitRuleLabel, getImplicitSetLabel, getImplicitTokenLabel, getInlineTestSetWordSize, getLanguage, getListenerFileName, getListLabel, getLoopCounter, getLoopLabel, getRecognizerFileName, getRuleFunctionContextStructName, getRuleFunctionContextStructName, getSerializedATNSegmentLimit, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromString, getTargetStringLiteralFromString, getTemplates, getTokenTypeAsTargetLabel, getTokenTypesAsTargetLabels, getVersion, getVisitorFileName, grammarSymbolCausesIssueInGeneratedCode, loadTemplates, needsHeader, shouldUseUnicodeEscapeForCodePointInDoubleQuotedString, templatesExist, visibleGrammarSymbolCausesIssueInGeneratedCode, wantsBaseListener, wantsBaseVisitor
-
Field Details
-
reservedWords
-
targetCharValueEscape
-
-
Constructor Details
-
PHPTarget
-
-
Method Details
-
getTargetCharValueEscape
Description copied from class:TargetFor pure strings of Unicode char, how can we display it in the target language as a literal. Useful for dumping predicates and such that may refer to chars that need to be escaped when represented as strings. Also, templates need to be escaped so that the target language can hold them as a string. Each target can have a different set in memory at same time.- Overrides:
getTargetCharValueEscapein classTarget
-
getReservedWords
- Specified by:
getReservedWordsin classTarget
-
supportsOverloadedMethods
public boolean supportsOverloadedMethods()- Overrides:
supportsOverloadedMethodsin classTarget
-
getTargetStringLiteralFromANTLRStringLiteral
public String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, String literal, boolean addQuotes, boolean escapeSpecial) Description copied from class:TargetConvert from an ANTLR string literal found in a grammar file to an equivalent string literal in the target language.
For Java, this is the translation
'a\n"'→"a\n\"". Expect single quotes around the incoming literal. Just flip the quotes and replace double quotes with\".Note that we have decided to allow people to use '\"' without penalty, so we must build the target string in a loop as
String.replace(char, char)cannot handle both\"and"without a lot of messing around.- Overrides:
getTargetStringLiteralFromANTLRStringLiteralin classTarget
-
isATNSerializedAsInts
public boolean isATNSerializedAsInts()- Overrides:
isATNSerializedAsIntsin classTarget
-
escapeChar
- Overrides:
escapeCharin classTarget
-