Package org.antlr.codegen
Class RubyTarget
java.lang.Object
org.antlr.codegen.Target
org.antlr.codegen.RubyTarget
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionA set of ruby keywords which are used to escape labels and method names which will cause parse errors in the ruby sourceFields inherited from class org.antlr.codegen.Target
targetCharValueEscape
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencodeIntAsCharEscape
(int v) protected void
genRecognizerFile
(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST outputFileST) int
getMaxCharValue
(CodeGenerator generator) Some targets only support ASCII or 8-bit chars/strings.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.getTokenTypeAsTargetLabel
(CodeGenerator generator, int ttype) Target must be able to override the labels used for token typesboolean
isValidActionScope
(int grammarType, String scope) Is scope in @scope::name {action} valid for this kind of grammar? Targets like C++ may want to allow new scopes like headerfile or some such.Methods inherited from class org.antlr.codegen.Target
genRecognizerHeaderFile, getTarget64BitStringFromValue, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromString, getTargetStringLiteralFromString, performGrammarAnalysis, postProcessAction, useBaseTemplatesForSynPredFragments
-
Field Details
-
rubyKeywords
A set of ruby keywords which are used to escape labels and method names which will cause parse errors in the ruby source
-
-
Constructor Details
-
RubyTarget
public RubyTarget()
-
-
Method Details
-
genRecognizerFile
protected void genRecognizerFile(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST outputFileST) throws IOException - Overrides:
genRecognizerFile
in classTarget
- Throws:
IOException
-
getTargetCharLiteralFromANTLRCharLiteral
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 classTarget
-
getMaxCharValue
Description copied from class:Target
Some targets only support ASCII or 8-bit chars/strings. For example, C++ will probably want to return 0xFF here.- Overrides:
getMaxCharValue
in classTarget
-
getTokenTypeAsTargetLabel
Description copied from class:Target
Target must be able to override the labels used for token types- Overrides:
getTokenTypeAsTargetLabel
in classTarget
-
isValidActionScope
Description copied from class:Target
Is scope in @scope::name {action} valid for this kind of grammar? Targets like C++ may want to allow new scopes like headerfile or some such. The action names themselves are not policed at the moment so targets can add template actions w/o having to recompile ANTLR.- Overrides:
isValidActionScope
in classTarget
-
encodeIntAsCharEscape
- Overrides:
encodeIntAsCharEscape
in classTarget
-