org.antlr.codegen
Class DelphiTarget

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

public class DelphiTarget
extends Target


Field Summary
 
Fields inherited from class org.antlr.codegen.Target
targetCharValueEscape
 
Constructor Summary
DelphiTarget()
           
 
Method Summary
protected  org.antlr.stringtemplate.StringTemplate chooseWhereCyclicDFAsGo(Tool tool, CodeGenerator generator, Grammar grammar, org.antlr.stringtemplate.StringTemplate recognizerST, org.antlr.stringtemplate.StringTemplate cyclicDFAST)
           
 java.lang.String encodeIntAsCharEscape(int v)
           
 java.lang.String getTarget64BitStringFromValue(long word)
          Convert long to 0xNNNNNNNNNNNNNNNN by default for spitting out with bitsets.
 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 getTargetStringLiteralFromString(java.lang.String s, boolean quoted)
          Given a random string of Java unicode chars, return a new string with optionally appropriate quote characters for target language and possibly with some escaped characters.
 
Methods inherited from class org.antlr.codegen.Target
genRecognizerFile, genRecognizerHeaderFile, getMaxCharValue, getTargetStringLiteralFromString, getTokenTypeAsTargetLabel, isValidActionScope, performGrammarAnalysis, postProcessAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelphiTarget

public DelphiTarget()
Method Detail

chooseWhereCyclicDFAsGo

protected org.antlr.stringtemplate.StringTemplate chooseWhereCyclicDFAsGo(Tool tool,
                                                                          CodeGenerator generator,
                                                                          Grammar grammar,
                                                                          org.antlr.stringtemplate.StringTemplate recognizerST,
                                                                          org.antlr.stringtemplate.StringTemplate cyclicDFAST)

encodeIntAsCharEscape

public java.lang.String encodeIntAsCharEscape(int v)
Overrides:
encodeIntAsCharEscape in class Target

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

getTargetStringLiteralFromString

public java.lang.String getTargetStringLiteralFromString(java.lang.String s,
                                                         boolean quoted)
Description copied from class: Target
Given a random string of Java unicode chars, return a new string with optionally appropriate quote characters for target language and possibly with some escaped characters. For example, if the incoming string has actual newline characters, the output of this method would convert them to the two char sequence \n for Java, C, C++, ... The new string has double-quotes around it as well. Example String in memory: a"[newlinechar]b'c[carriagereturnchar]d[tab]e\f would be converted to the valid Java s: "a\"\nb'c\rd\te\\f" or a\"\nb'c\rd\te\\f depending on the quoted arg.

Overrides:
getTargetStringLiteralFromString in class Target

getTargetStringLiteralFromANTLRStringLiteral

public java.lang.String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator,
                                                                     java.lang.String literal)
Description copied from class: Target
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 \" Note that we have decided to allow poeple to use '\"' without penalty, so we must build the target string in a loop as Utils.replae cannot handle both \" and " without a lot of messing around.

Overrides:
getTargetStringLiteralFromANTLRStringLiteral in class Target

getTarget64BitStringFromValue

public java.lang.String getTarget64BitStringFromValue(long word)
Description copied from class: Target
Convert long to 0xNNNNNNNNNNNNNNNN by default for spitting out with bitsets. I.e., convert bytes to hex string.

Overrides:
getTarget64BitStringFromValue in class Target


Copyright © 2013. All Rights Reserved.