C# Class Antlr4.Tool.Grammar

Inheritance: AttributeResolver
Show file Open project: sharwell/antlr4cs Class Usage Examples

Public Properties

Property Type Description
AUTO_GENERATED_TOKEN_NAME_PREFIX string
GRAMMAR_FROM_STRING_NAME string
INVALID_RULE_NAME string
INVALID_TOKEN_NAME string
LexerBlockOptions ISet
ParserBlockOptions ISet
actionOptions ISet
ast Antlr4.Tool.Ast.GrammarRootAST
atn Antlr4.Runtime.Atn.ATN
channelNameToValueMap int>.IDictionary
channelValueToNameList IList
contextASTs IList>.IDictionary
decisionDFAs DFA>.IDictionary
decisionLOOK IList
doNotCopyOptionsToLexer ISet
fileName string
grammarAndLabelRefTypeToScope AttributeDict>.IDictionary
implicitLexer LexerGrammar
importedGrammars IList
indexToPredMap PredAST>.LinkedHashMap
indexToRule IList
lexerActions int>.LinkedHashMap
lexerOptions ISet
name string
namedActions ActionAST>.IDictionary
originalGrammar Grammar
parent Grammar
parserOptions ISet
ruleOptions ISet
ruleRefOptions ISet
rules Rule>.OrderedHashMap
semPredOptions ISet
sempreds int>.LinkedHashMap
stateToGrammarRegionMap Interval>.IDictionary
stringLiteralToTypeMap int>.IDictionary
text string
tokenNameToTypeMap int>.IDictionary
tokenOptions ISet
typeToStringLiteralList IList
typeToTokenList IList

Public Methods

Method Description
CreateGrammarParserInterpreter ( Antlr4.Runtime.ITokenStream tokenStream ) : GrammarParserInterpreter
CreateLexerInterpreter ( Antlr4.Runtime.ICharStream input ) : Antlr4.Runtime.LexerInterpreter
CreateParserInterpreter ( Antlr4.Runtime.ITokenStream tokenStream ) : Antlr4.Runtime.ParserInterpreter
DefineAction ( GrammarAST atAST ) : void
DefineChannelName ( string name ) : int
DefineChannelName ( string name, int value ) : int
DefineRule ( [ r ) : bool
DefineStringLiteral ( string lit ) : int
DefineStringLiteral ( string lit, int ttype ) : int
DefineTokenAlias ( string name, string lit ) : int
DefineTokenName ( string name ) : int
DefineTokenName ( string name, int ttype ) : int
GetATN ( ) : ATN
GetAllCharValues ( ) : Antlr4.Runtime.Misc.IIntSet
GetAllImportedGrammars ( ) : IList
GetChannelValue ( string channel ) : int
GetDefaultActionScope ( ) : string
GetGrammarAncestors ( ) : IList
GetGrammarTypeToFileNameSuffix ( int type ) : string
GetImplicitLexer ( ) : LexerGrammar
GetImportedGrammar ( string name ) : Grammar
GetImportedGrammars ( ) : IList
GetIndexToPredicateMap ( ) : PredAST>.LinkedHashMap
GetLabeledAlternatives ( RuleAST ast ) : IDictionary>>
GetMaxCharValue ( ) : int
GetMaxTokenType ( ) : int
GetNewChannelNumber ( ) : int
GetNewTokenType ( ) : int
GetOptionString ( string key ) : string
GetOutermostGrammar ( ) : Grammar
GetPredicateDisplayString ( SemanticContext pred ) : string
GetRecognizerName ( ) : string
GetRule ( int index ) : Rule
GetRule ( string name ) : Rule
GetRule ( string grammarName, string ruleName ) : Rule
GetRuleNames ( ) : string[]
GetSemanticContextDisplayString ( SemanticContext semctx ) : string
GetStateToGrammarRegion ( int atnStateNumber ) : Antlr4.Runtime.Misc.Interval
GetStateToGrammarRegionMap ( GrammarRootAST ast, Antlr4.Runtime.Misc.IntervalSet grammarTokenTypes ) : Interval>.IDictionary
GetStringLiteralAliasesFromLexerRules ( GrammarRootAST ast ) : GrammarAST>>.IList
GetStringLiteralLexerRuleName ( string lit ) : string
GetStringLiterals ( ) : ISet
GetTokenDisplayName ( int ttype ) : string
GetTokenDisplayNames ( ) : string[]
GetTokenNames ( ) : string[]
GetTokenStream ( ) : Antlr.Runtime.Antlr4.Runtime.ITokenStream
GetTokenType ( string token ) : int
GetTokenTypes ( ) : Antlr4.Runtime.Misc.IIntSet
GetTypeString ( ) : string
GetUnlabeledAlternatives ( RuleAST ast ) : IList
Grammar ( AntlrTool tool, [ ast ) : System.Collections.Generic
Grammar ( string grammarText ) : System.Collections.Generic
Grammar ( string grammarText, ANTLRToolListener listener ) : System.Collections.Generic
Grammar ( string grammarText, LexerGrammar tokenVocabSource ) : System.Collections.Generic
Grammar ( string fileName, string grammarText ) : System.Collections.Generic
Grammar ( string fileName, string grammarText, Grammar tokenVocabSource, [ listener ) : System.Collections.Generic
Grammar ( string fileName, string grammarText, [ listener ) : System.Collections.Generic
ImportTokensFromTokensFile ( ) : void
ImportVocab ( Grammar importG ) : void
IsAbstract ( ) : bool
IsCombined ( ) : bool
IsLexer ( ) : bool
IsParser ( ) : bool
IsTokenName ( string id ) : bool
JoinPredicateOperands ( SemanticContext op, string separator ) : string
Load ( string fileName ) : Grammar
LoadImportedGrammars ( ) : void
ResolveToAttribute ( string x, ActionAST node ) : Attribute
ResolveToAttribute ( string x, string y, ActionAST node ) : Attribute
ResolvesToAttributeDict ( string x, ActionAST node ) : bool
ResolvesToLabel ( string x, ActionAST node ) : bool
ResolvesToListLabel ( string x, ActionAST node ) : bool
ResolvesToToken ( string x, ActionAST node ) : bool
SetChannelNameForValue ( int channelValue, string name ) : void
SetLookaheadDFA ( int decision, DFA lookaheadDFA ) : void
SetNodeOptions ( GrammarAST node, GrammarAST options ) : void
SetTokenForType ( int ttype, string text ) : void
UndefineRule ( [ r ) : bool

Protected Methods

Method Description
DefAlias ( GrammarAST r, string pattern, Antlr wiz, GrammarAST>.IList lexerRuleToStringLiteral ) : bool
GetBaseContextName ( string ruleName ) : string
InitTokenSymbolTables ( ) : void

Private Methods

Method Description
GetTokenLiteralNames ( ) : string[]
GetTokenName ( int ttype ) : string
GetTokenSymbolicNames ( ) : string[]
GetVocabulary ( ) : Antlr4.Runtime.IVocabulary

Method Details

CreateGrammarParserInterpreter() public method

public CreateGrammarParserInterpreter ( Antlr4.Runtime.ITokenStream tokenStream ) : GrammarParserInterpreter
tokenStream Antlr4.Runtime.ITokenStream
return GrammarParserInterpreter

CreateLexerInterpreter() public method

public CreateLexerInterpreter ( Antlr4.Runtime.ICharStream input ) : Antlr4.Runtime.LexerInterpreter
input Antlr4.Runtime.ICharStream
return Antlr4.Runtime.LexerInterpreter

CreateParserInterpreter() public method

public CreateParserInterpreter ( Antlr4.Runtime.ITokenStream tokenStream ) : Antlr4.Runtime.ParserInterpreter
tokenStream Antlr4.Runtime.ITokenStream
return Antlr4.Runtime.ParserInterpreter

DefAlias() protected static method

protected static DefAlias ( GrammarAST r, string pattern, Antlr wiz, GrammarAST>.IList lexerRuleToStringLiteral ) : bool
r Antlr4.Tool.Ast.GrammarAST
pattern string
wiz Antlr
lexerRuleToStringLiteral GrammarAST>.IList
return bool

DefineAction() public method

public DefineAction ( GrammarAST atAST ) : void
atAST Antlr4.Tool.Ast.GrammarAST
return void

DefineChannelName() public method

public DefineChannelName ( string name ) : int
name string
return int

DefineChannelName() public method

public DefineChannelName ( string name, int value ) : int
name string
value int
return int

DefineRule() public method

public DefineRule ( [ r ) : bool
r [
return bool

DefineStringLiteral() public method

public DefineStringLiteral ( string lit ) : int
lit string
return int

DefineStringLiteral() public method

public DefineStringLiteral ( string lit, int ttype ) : int
lit string
ttype int
return int

DefineTokenAlias() public method

public DefineTokenAlias ( string name, string lit ) : int
name string
lit string
return int

DefineTokenName() public method

public DefineTokenName ( string name ) : int
name string
return int

DefineTokenName() public method

public DefineTokenName ( string name, int ttype ) : int
name string
ttype int
return int

GetATN() public method

public GetATN ( ) : ATN
return Antlr4.Runtime.Atn.ATN

GetAllCharValues() public method

public GetAllCharValues ( ) : Antlr4.Runtime.Misc.IIntSet
return Antlr4.Runtime.Misc.IIntSet

GetAllImportedGrammars() public method

public GetAllImportedGrammars ( ) : IList
return IList

GetBaseContextName() protected method

protected GetBaseContextName ( string ruleName ) : string
ruleName string
return string

GetChannelValue() public method

public GetChannelValue ( string channel ) : int
channel string
return int

GetDefaultActionScope() public method

public GetDefaultActionScope ( ) : string
return string

GetGrammarAncestors() public method

public GetGrammarAncestors ( ) : IList
return IList

GetGrammarTypeToFileNameSuffix() public static method

public static GetGrammarTypeToFileNameSuffix ( int type ) : string
type int
return string

GetImplicitLexer() public method

public GetImplicitLexer ( ) : LexerGrammar
return LexerGrammar

GetImportedGrammar() public method

public GetImportedGrammar ( string name ) : Grammar
name string
return Grammar

GetImportedGrammars() public method

public GetImportedGrammars ( ) : IList
return IList

GetIndexToPredicateMap() public method

public GetIndexToPredicateMap ( ) : PredAST>.LinkedHashMap
return PredAST>.LinkedHashMap

GetLabeledAlternatives() public method

public GetLabeledAlternatives ( RuleAST ast ) : IDictionary>>
ast Antlr4.Tool.Ast.RuleAST
return IDictionary>>

GetMaxCharValue() public method

public GetMaxCharValue ( ) : int
return int

GetMaxTokenType() public method

public GetMaxTokenType ( ) : int
return int

GetNewChannelNumber() public method

public GetNewChannelNumber ( ) : int
return int

GetNewTokenType() public method

public GetNewTokenType ( ) : int
return int

GetOptionString() public method

public GetOptionString ( string key ) : string
key string
return string

GetOutermostGrammar() public method

public GetOutermostGrammar ( ) : Grammar
return Grammar

GetPredicateDisplayString() public method

public GetPredicateDisplayString ( SemanticContext pred ) : string
pred SemanticContext
return string

GetRecognizerName() public method

public GetRecognizerName ( ) : string
return string

GetRule() public method

public GetRule ( int index ) : Rule
index int
return Rule

GetRule() public method

public GetRule ( string name ) : Rule
name string
return Rule

GetRule() public method

public GetRule ( string grammarName, string ruleName ) : Rule
grammarName string
ruleName string
return Rule

GetRuleNames() public method

public GetRuleNames ( ) : string[]
return string[]

GetSemanticContextDisplayString() public method

public GetSemanticContextDisplayString ( SemanticContext semctx ) : string
semctx SemanticContext
return string

GetStateToGrammarRegion() public method

public GetStateToGrammarRegion ( int atnStateNumber ) : Antlr4.Runtime.Misc.Interval
atnStateNumber int
return Antlr4.Runtime.Misc.Interval

GetStateToGrammarRegionMap() public static method

public static GetStateToGrammarRegionMap ( GrammarRootAST ast, Antlr4.Runtime.Misc.IntervalSet grammarTokenTypes ) : Interval>.IDictionary
ast Antlr4.Tool.Ast.GrammarRootAST
grammarTokenTypes Antlr4.Runtime.Misc.IntervalSet
return Interval>.IDictionary

GetStringLiteralAliasesFromLexerRules() public static method

public static GetStringLiteralAliasesFromLexerRules ( GrammarRootAST ast ) : GrammarAST>>.IList
ast Antlr4.Tool.Ast.GrammarRootAST
return GrammarAST>>.IList

GetStringLiteralLexerRuleName() public method

public GetStringLiteralLexerRuleName ( string lit ) : string
lit string
return string

GetStringLiterals() public method

public GetStringLiterals ( ) : ISet
return ISet

GetTokenDisplayName() public method

public GetTokenDisplayName ( int ttype ) : string
ttype int
return string

GetTokenDisplayNames() public method

public GetTokenDisplayNames ( ) : string[]
return string[]

GetTokenNames() public method

public GetTokenNames ( ) : string[]
return string[]

GetTokenStream() public method

public GetTokenStream ( ) : Antlr.Runtime.Antlr4.Runtime.ITokenStream
return Antlr.Runtime.Antlr4.Runtime.ITokenStream

GetTokenType() public method

public GetTokenType ( string token ) : int
token string
return int

GetTokenTypes() public method

public GetTokenTypes ( ) : Antlr4.Runtime.Misc.IIntSet
return Antlr4.Runtime.Misc.IIntSet

GetTypeString() public method

public GetTypeString ( ) : string
return string

GetUnlabeledAlternatives() public method

public GetUnlabeledAlternatives ( RuleAST ast ) : IList
ast Antlr4.Tool.Ast.RuleAST
return IList

Grammar() public method

public Grammar ( AntlrTool tool, [ ast ) : System.Collections.Generic
tool AntlrTool
ast [
return System.Collections.Generic

Grammar() public method

public Grammar ( string grammarText ) : System.Collections.Generic
grammarText string
return System.Collections.Generic

Grammar() public method

public Grammar ( string grammarText, ANTLRToolListener listener ) : System.Collections.Generic
grammarText string
listener ANTLRToolListener
return System.Collections.Generic

Grammar() public method

public Grammar ( string grammarText, LexerGrammar tokenVocabSource ) : System.Collections.Generic
grammarText string
tokenVocabSource LexerGrammar
return System.Collections.Generic

Grammar() public method

public Grammar ( string fileName, string grammarText ) : System.Collections.Generic
fileName string
grammarText string
return System.Collections.Generic

Grammar() public method

public Grammar ( string fileName, string grammarText, Grammar tokenVocabSource, [ listener ) : System.Collections.Generic
fileName string
grammarText string
tokenVocabSource Grammar
listener [
return System.Collections.Generic

Grammar() public method

public Grammar ( string fileName, string grammarText, [ listener ) : System.Collections.Generic
fileName string
grammarText string
listener [
return System.Collections.Generic

ImportTokensFromTokensFile() public method

public ImportTokensFromTokensFile ( ) : void
return void

ImportVocab() public method

public ImportVocab ( Grammar importG ) : void
importG Grammar
return void

InitTokenSymbolTables() protected method

protected InitTokenSymbolTables ( ) : void
return void

IsAbstract() public method

public IsAbstract ( ) : bool
return bool

IsCombined() public method

public IsCombined ( ) : bool
return bool

IsLexer() public method

public IsLexer ( ) : bool
return bool

IsParser() public method

public IsParser ( ) : bool
return bool

IsTokenName() public static method

public static IsTokenName ( string id ) : bool
id string
return bool

JoinPredicateOperands() public method

public JoinPredicateOperands ( SemanticContext op, string separator ) : string
op SemanticContext
separator string
return string

Load() public static method

public static Load ( string fileName ) : Grammar
fileName string
return Grammar

LoadImportedGrammars() public method

public LoadImportedGrammars ( ) : void
return void

ResolveToAttribute() public method

public ResolveToAttribute ( string x, ActionAST node ) : Attribute
x string
node Antlr4.Tool.Ast.ActionAST
return Attribute

ResolveToAttribute() public method

public ResolveToAttribute ( string x, string y, ActionAST node ) : Attribute
x string
y string
node Antlr4.Tool.Ast.ActionAST
return Attribute

ResolvesToAttributeDict() public method

public ResolvesToAttributeDict ( string x, ActionAST node ) : bool
x string
node Antlr4.Tool.Ast.ActionAST
return bool

ResolvesToLabel() public method

public ResolvesToLabel ( string x, ActionAST node ) : bool
x string
node Antlr4.Tool.Ast.ActionAST
return bool

ResolvesToListLabel() public method

public ResolvesToListLabel ( string x, ActionAST node ) : bool
x string
node Antlr4.Tool.Ast.ActionAST
return bool

ResolvesToToken() public method

public ResolvesToToken ( string x, ActionAST node ) : bool
x string
node Antlr4.Tool.Ast.ActionAST
return bool

SetChannelNameForValue() public method

public SetChannelNameForValue ( int channelValue, string name ) : void
channelValue int
name string
return void

SetLookaheadDFA() public method

public SetLookaheadDFA ( int decision, DFA lookaheadDFA ) : void
decision int
lookaheadDFA Antlr4.Runtime.Dfa.DFA
return void

SetNodeOptions() public static method

public static SetNodeOptions ( GrammarAST node, GrammarAST options ) : void
node Antlr4.Tool.Ast.GrammarAST
options Antlr4.Tool.Ast.GrammarAST
return void

SetTokenForType() public method

public SetTokenForType ( int ttype, string text ) : void
ttype int
text string
return void

UndefineRule() public method

public UndefineRule ( [ r ) : bool
r [
return bool

Property Details

AUTO_GENERATED_TOKEN_NAME_PREFIX public static property

public static string AUTO_GENERATED_TOKEN_NAME_PREFIX
return string

GRAMMAR_FROM_STRING_NAME public static property

public static string GRAMMAR_FROM_STRING_NAME
return string

INVALID_RULE_NAME public static property

public static string INVALID_RULE_NAME
return string

INVALID_TOKEN_NAME public static property

public static string INVALID_TOKEN_NAME
return string

LexerBlockOptions public static property

public static ISet LexerBlockOptions
return ISet

ParserBlockOptions public static property

public static ISet ParserBlockOptions
return ISet

actionOptions public static property

public static ISet actionOptions
return ISet

ast public property

public GrammarRootAST,Antlr4.Tool.Ast ast
return Antlr4.Tool.Ast.GrammarRootAST

atn public property

public ATN,Antlr4.Runtime.Atn atn
return Antlr4.Runtime.Atn.ATN

channelNameToValueMap public property

public IDictionary channelNameToValueMap
return int>.IDictionary

channelValueToNameList public property

public IList channelValueToNameList
return IList

contextASTs public property

public IDictionary> contextASTs
return IList>.IDictionary

decisionDFAs public property

public IDictionary decisionDFAs
return DFA>.IDictionary

decisionLOOK public property

public IList decisionLOOK
return IList

doNotCopyOptionsToLexer public static property

public static ISet doNotCopyOptionsToLexer
return ISet

fileName public property

public string fileName
return string

grammarAndLabelRefTypeToScope public static property

public static IDictionary grammarAndLabelRefTypeToScope
return AttributeDict>.IDictionary

implicitLexer public property

public LexerGrammar,Antlr4.Tool implicitLexer
return LexerGrammar

importedGrammars public property

public IList importedGrammars
return IList

indexToPredMap public property

public LinkedHashMap indexToPredMap
return PredAST>.LinkedHashMap

indexToRule public property

public IList indexToRule
return IList

lexerActions public property

public LinkedHashMap lexerActions
return int>.LinkedHashMap

lexerOptions public static property

public static ISet lexerOptions
return ISet

name public property

public string name
return string

namedActions public property

public IDictionary namedActions
return ActionAST>.IDictionary

originalGrammar public property

public Grammar,Antlr4.Tool originalGrammar
return Grammar

parent public property

public Grammar,Antlr4.Tool parent
return Grammar

parserOptions public static property

public static ISet parserOptions
return ISet

ruleOptions public static property

public static ISet ruleOptions
return ISet

ruleRefOptions public static property

public static ISet ruleRefOptions
return ISet

rules public property

public OrderedHashMap rules
return Rule>.OrderedHashMap

semPredOptions public static property

public static ISet semPredOptions
return ISet

sempreds public property

public LinkedHashMap sempreds
return int>.LinkedHashMap

stateToGrammarRegionMap public property

public IDictionary stateToGrammarRegionMap
return Interval>.IDictionary

stringLiteralToTypeMap public property

public IDictionary stringLiteralToTypeMap
return int>.IDictionary

text public property

public string text
return string

tokenNameToTypeMap public property

public IDictionary tokenNameToTypeMap
return int>.IDictionary

tokenOptions public static property

public static ISet tokenOptions
return ISet

typeToStringLiteralList public property

public IList typeToStringLiteralList
return IList

typeToTokenList public property

public IList typeToTokenList
return IList