Package org.antlr.codegen
Class ObjCTarget
java.lang.Object
org.antlr.codegen.Target
org.antlr.codegen.ObjCTarget
-
Field Summary
Fields inherited from class org.antlr.codegen.Target
targetCharValueEscape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgenRecognizerHeaderFile(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST headerFileST, String extName) getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, String literal) Convert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language.getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, String literal) Convert from an ANTLR string literal found in a grammar file to an equivalent string literal in the target language.getTokenTextAndTypeAsTargetLabel(CodeGenerator generator, String text, int tokenType) Target must be able to override the labels used for token types.getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype) If we have a label, prefix it with the recognizer's nameMethods inherited from class org.antlr.codegen.Target
encodeIntAsCharEscape, genRecognizerFile, getMaxCharValue, getTarget64BitStringFromValue, getTargetStringLiteralFromString, getTargetStringLiteralFromString, isValidActionScope, performGrammarAnalysis, postProcessAction, useBaseTemplatesForSynPredFragments
-
Constructor Details
-
ObjCTarget
public ObjCTarget()
-
-
Method Details
-
genRecognizerHeaderFile
protected void genRecognizerHeaderFile(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST headerFileST, String extName) throws IOException - Overrides:
genRecognizerHeaderFilein classTarget- Throws:
IOException
-
getTargetCharLiteralFromANTLRCharLiteral
Description copied from class:TargetConvert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language. For most languages, this means leaving 'x' as 'x'. Actually, we need to escape ' ' so that it doesn't get converted to \n by the compiler. Convert the literal to the char value and then to an appropriate target char literal. Expect single quotes around the incoming literal.- Overrides:
getTargetCharLiteralFromANTLRCharLiteralin classTarget
-
getTargetStringLiteralFromANTLRStringLiteral
Convert 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 \"- Overrides:
getTargetStringLiteralFromANTLRStringLiteralin classTarget
-
getTokenTypeAsTargetLabel
If we have a label, prefix it with the recognizer's name- Overrides:
getTokenTypeAsTargetLabelin classTarget
-
getTokenTextAndTypeAsTargetLabel
Target must be able to override the labels used for token types. Sometimes also depends on the token text.
-