org.antlr.codegen
Class ObjCTarget

java.lang.Object
  extended by org.antlr.codegen.Target
      extended by org.antlr.codegen.ObjCTarget

public class ObjCTarget
extends Target


Field Summary
 
Fields inherited from class org.antlr.codegen.Target
targetCharValueEscape
 
Constructor Summary
ObjCTarget()
           
 
Method Summary
protected  void genRecognizerHeaderFile(Tool tool, CodeGenerator generator, Grammar grammar, org.antlr.stringtemplate.StringTemplate headerFileST, java.lang.String extName)
           
 java.lang.String getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, java.lang.String literal)
          Convert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language.
 java.lang.String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, java.lang.String literal)
          Convert from an ANTLR string literal found in a grammar file to an equivalent string literal in the target language.
 java.lang.String getTokenTextAndTypeAsTargetLabel(CodeGenerator generator, java.lang.String text, int tokenType)
          Target must be able to override the labels used for token types.
 java.lang.String getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype)
          If we have a label, prefix it with the recognizer's name
 
Methods inherited from class org.antlr.codegen.Target
encodeIntAsCharEscape, genRecognizerFile, getMaxCharValue, getTarget64BitStringFromValue, getTargetStringLiteralFromString, getTargetStringLiteralFromString, isValidActionScope, performGrammarAnalysis, postProcessAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjCTarget

public ObjCTarget()
Method Detail

genRecognizerHeaderFile

protected void genRecognizerHeaderFile(Tool tool,
                                       CodeGenerator generator,
                                       Grammar grammar,
                                       org.antlr.stringtemplate.StringTemplate headerFileST,
                                       java.lang.String extName)
                                throws java.io.IOException
Overrides:
genRecognizerHeaderFile in class Target
Throws:
java.io.IOException

getTargetCharLiteralFromANTLRCharLiteral

public java.lang.String getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator,
                                                                 java.lang.String literal)
Description copied from class: Target
Convert 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:
getTargetCharLiteralFromANTLRCharLiteral in class Target

getTargetStringLiteralFromANTLRStringLiteral

public java.lang.String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator,
                                                                     java.lang.String literal)
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:
getTargetStringLiteralFromANTLRStringLiteral in class Target

getTokenTypeAsTargetLabel

public java.lang.String getTokenTypeAsTargetLabel(CodeGenerator generator,
                                                  int ttype)
If we have a label, prefix it with the recognizer's name

Overrides:
getTokenTypeAsTargetLabel in class Target

getTokenTextAndTypeAsTargetLabel

public java.lang.String getTokenTextAndTypeAsTargetLabel(CodeGenerator generator,
                                                         java.lang.String text,
                                                         int tokenType)
Target must be able to override the labels used for token types. Sometimes also depends on the token text.



Copyright © 2011. All Rights Reserved.