forked from jasder/antlr
Init stuff correctly
This commit is contained in:
parent
36ae2795f8
commit
694096d517
|
@ -122,7 +122,7 @@ func New<parser.name>(input antlr4.TokenStream) *<parser.name> {
|
|||
|
||||
parser := new(<parser.name>)
|
||||
|
||||
parser.InitParser(input)
|
||||
parser.Parser = NewParser(input)
|
||||
|
||||
parser.Interpreter = antlr4.NewParserATNSimulator(parser, deserializedATN, decisionToDFA, sharedContextCache)
|
||||
parser.RuleNames = ruleNames
|
||||
|
@ -823,7 +823,7 @@ func New<lexer.name>(input antlr4.CharStream) *<lexer.name> {
|
|||
|
||||
lex := new(<lexer.name>)
|
||||
|
||||
lex.InitLexer(input)
|
||||
lex.Lexer = NewLexer(input)
|
||||
|
||||
lex.Interpreter = antlr4.NewLexerATNSimulator(lex, lexerAtn, lexerDecisionToDFA, antlr4.NewPredictionContextCache())
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ func NewATNConfigSet(fullCtx bool) *ATNConfigSet {
|
|||
|
||||
this := new(ATNConfigSet)
|
||||
|
||||
this.InitATNConfigSet(fullCtx)
|
||||
this.ATNConfigSet = NewATNConfigSet(fullCtx)
|
||||
|
||||
return this
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ func NewOrderedATNConfigSet() *OrderedATNConfigSet {
|
|||
|
||||
this := new(OrderedATNConfigSet)
|
||||
|
||||
this.InitATNConfigSet(false)
|
||||
this.ATNConfigSet = NewATNConfigSet(false)
|
||||
this.configLookup = NewSet(nil, nil)
|
||||
|
||||
return this
|
||||
|
|
|
@ -26,7 +26,7 @@ type BufferedTokenStream struct {
|
|||
func NewBufferedTokenStream(tokenSource TokenSource) *BufferedTokenStream {
|
||||
|
||||
ts := new(BufferedTokenStream)
|
||||
ts.InitBufferedTokenStream(tokenSource)
|
||||
ts.BufferedTokenStream = NewBufferedTokenStream(tokenSource)
|
||||
return ts
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ type CommonTokenStream struct {
|
|||
func NewCommonTokenStream(lexer ILexer, channel int) *CommonTokenStream {
|
||||
|
||||
ts := new(CommonTokenStream)
|
||||
ts.InitBufferedTokenStream(lexer)
|
||||
ts.BufferedTokenStream = NewBufferedTokenStream(lexer)
|
||||
|
||||
ts.channel = channel
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ func NewFileStream(fileName string) *FileStream {
|
|||
s := string(buf.Bytes())
|
||||
|
||||
fmt.Println(s)
|
||||
fs.InitInputStream(s)
|
||||
fs.InputStream = NewInputStream(s)
|
||||
|
||||
return fs
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ func NewInputStream(data string) *InputStream {
|
|||
|
||||
is := new(InputStream)
|
||||
|
||||
is.InitInputStream(data)
|
||||
is.InputStream = NewInputStream(data)
|
||||
|
||||
return is
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ func NewLexer(input CharStream) *Lexer {
|
|||
lexer := new(Lexer)
|
||||
|
||||
lexer.InitRecognizer()
|
||||
lexer.InitLexer(input)
|
||||
lexer.Lexer = NewLexer(input)
|
||||
|
||||
return lexer
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ type LexerAction struct {
|
|||
|
||||
func NewLexerAction(action int) *LexerAction {
|
||||
la := new(LexerAction)
|
||||
la.InitLexerAction(action)
|
||||
la.LexerAction = NewLexerAction(action)
|
||||
return la
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ type LexerSkipAction struct {
|
|||
|
||||
func NewLexerSkipAction() *LexerSkipAction {
|
||||
la := new(LexerSkipAction)
|
||||
la.InitLexerAction(LexerActionTypeSKIP)
|
||||
la.LexerAction = NewLexerAction(LexerActionTypeSKIP)
|
||||
return la
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ type LexerTypeAction struct {
|
|||
|
||||
func NewLexerTypeAction(_type int) *LexerTypeAction {
|
||||
this := new(LexerTypeAction)
|
||||
this.InitLexerAction(LexerActionTypeTYPE)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypeTYPE)
|
||||
this._type = _type
|
||||
return this
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ type LexerPushModeAction struct {
|
|||
func NewLexerPushModeAction(mode int) *LexerPushModeAction {
|
||||
|
||||
this := new(LexerPushModeAction)
|
||||
this.InitLexerAction(LexerActionTypePUSH_MODE)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypePUSH_MODE)
|
||||
|
||||
this.mode = mode
|
||||
return this
|
||||
|
@ -173,7 +173,7 @@ func NewLexerPopModeAction() *LexerPopModeAction {
|
|||
|
||||
this := new(LexerPopModeAction)
|
||||
|
||||
this.InitLexerAction(LexerActionTypePOP_MODE)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypePOP_MODE)
|
||||
|
||||
return this
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ type LexerMoreAction struct {
|
|||
|
||||
func NewLexerMoreAction() *LexerModeAction {
|
||||
this := new(LexerModeAction)
|
||||
this.InitLexerAction(LexerActionTypeMORE)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypeMORE)
|
||||
|
||||
return this
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ type LexerModeAction struct {
|
|||
|
||||
func NewLexerModeAction(mode int) *LexerModeAction {
|
||||
this := new(LexerModeAction)
|
||||
this.InitLexerAction(LexerActionTypeMODE)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypeMODE)
|
||||
this.mode = mode
|
||||
return this
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ type LexerCustomAction struct {
|
|||
|
||||
func NewLexerCustomAction(ruleIndex, actionIndex int) *LexerCustomAction {
|
||||
this := new(LexerCustomAction)
|
||||
this.InitLexerAction(LexerActionTypeCUSTOM)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypeCUSTOM)
|
||||
this.ruleIndex = ruleIndex
|
||||
this.actionIndex = actionIndex
|
||||
this.isPositionDependent = true
|
||||
|
@ -318,7 +318,7 @@ type LexerChannelAction struct {
|
|||
|
||||
func NewLexerChannelAction(channel int) *LexerChannelAction {
|
||||
this := new(LexerChannelAction)
|
||||
this.InitLexerAction(LexerActionTypeCHANNEL)
|
||||
this.LexerAction = NewLexerAction(LexerActionTypeCHANNEL)
|
||||
this.channel = channel
|
||||
return this
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ func NewParser(input TokenStream) *Parser {
|
|||
|
||||
p := new(Parser)
|
||||
|
||||
p.InitParser(input)
|
||||
p.Parser = NewParser(input)
|
||||
|
||||
return p
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ func NewTransition(target IATNState) *Transition {
|
|||
}
|
||||
|
||||
t := new(Transition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
return t
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ type AtomTransition struct {
|
|||
func NewAtomTransition(target IATNState, label int) *AtomTransition {
|
||||
|
||||
t := new(AtomTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.label_ = label // The token type or character value or, signifies special label.
|
||||
t.label = t.makeLabel()
|
||||
|
@ -167,7 +167,7 @@ type RuleTransition struct {
|
|||
func NewRuleTransition(ruleStart IATNState, ruleIndex, precedence int, followState IATNState) *RuleTransition {
|
||||
|
||||
t := new(RuleTransition)
|
||||
t.InitTransition(ruleStart)
|
||||
t.Transition = NewTransition(ruleStart)
|
||||
|
||||
t.ruleIndex = ruleIndex
|
||||
t.precedence = precedence
|
||||
|
@ -192,7 +192,7 @@ type EpsilonTransition struct {
|
|||
func NewEpsilonTransition(target IATNState, outermostPrecedenceReturn int) *EpsilonTransition {
|
||||
|
||||
t := new(EpsilonTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.serializationType = TransitionEPSILON
|
||||
t.isEpsilon = true
|
||||
|
@ -217,7 +217,7 @@ type RangeTransition struct {
|
|||
func NewRangeTransition(target IATNState, start, stop int) *RangeTransition {
|
||||
|
||||
t := new(RangeTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.serializationType = TransitionRANGE
|
||||
t.start = start
|
||||
|
@ -247,7 +247,7 @@ type AbstractPredicateTransition struct {
|
|||
func NewAbstractPredicateTransition(target IATNState) *AbstractPredicateTransition {
|
||||
|
||||
t := new(AbstractPredicateTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
return t
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ type PredicateTransition struct {
|
|||
func NewPredicateTransition(target IATNState, ruleIndex, predIndex int, isCtxDependent bool) *PredicateTransition {
|
||||
|
||||
t := new(PredicateTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.serializationType = TransitionPREDICATE
|
||||
t.ruleIndex = ruleIndex
|
||||
|
@ -294,7 +294,7 @@ type ActionTransition struct {
|
|||
func NewActionTransition(target IATNState, ruleIndex, actionIndex int, isCtxDependent bool) *ActionTransition {
|
||||
|
||||
t := new(ActionTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.serializationType = TransitionACTION
|
||||
t.ruleIndex = ruleIndex
|
||||
|
@ -319,8 +319,8 @@ type SetTransition struct {
|
|||
func NewSetTransition(target IATNState, set *IntervalSet) *SetTransition {
|
||||
|
||||
t := new(SetTransition)
|
||||
t.InitTransition(target)
|
||||
t.InitSetTransition(set)
|
||||
t.Transition = NewTransition(target)
|
||||
t.SetTransition = NewSetTransition(set)
|
||||
|
||||
return t
|
||||
}
|
||||
|
@ -352,8 +352,8 @@ type NotSetTransition struct {
|
|||
func NewNotSetTransition(target IATNState, set *IntervalSet) *NotSetTransition {
|
||||
|
||||
t := new(NotSetTransition)
|
||||
t.InitTransition(target)
|
||||
t.InitSetTransition(set)
|
||||
t.Transition = NewTransition(target)
|
||||
t.SetTransition = NewSetTransition(set)
|
||||
|
||||
t.serializationType = TransitionNOT_SET
|
||||
|
||||
|
@ -375,7 +375,7 @@ type WildcardTransition struct {
|
|||
func NewWildcardTransition(target IATNState) *WildcardTransition {
|
||||
|
||||
t := new(WildcardTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.serializationType = TransitionWILDCARD
|
||||
return t
|
||||
|
@ -398,7 +398,7 @@ type PrecedencePredicateTransition struct {
|
|||
func NewPrecedencePredicateTransition(target IATNState, precedence int) *PrecedencePredicateTransition {
|
||||
|
||||
t := new(PrecedencePredicateTransition)
|
||||
t.InitTransition(target)
|
||||
t.Transition = NewTransition(target)
|
||||
|
||||
t.serializationType = TransitionPRECEDENCE
|
||||
t.precedence = precedence
|
||||
|
|
|
@ -93,7 +93,7 @@ type TerminalNodeImpl struct {
|
|||
func NewTerminalNodeImpl(symbol *Token) *TerminalNodeImpl {
|
||||
tn := new(TerminalNodeImpl)
|
||||
|
||||
tn.InitTerminalNodeImpl(symbol)
|
||||
tn.TerminalNodeImpl = NewTerminalNodeImpl(symbol)
|
||||
|
||||
return tn
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ type ErrorNodeImpl struct {
|
|||
|
||||
func NewErrorNodeImpl(token *Token) *ErrorNodeImpl {
|
||||
en := new(ErrorNodeImpl)
|
||||
en.InitTerminalNodeImpl(token)
|
||||
en.TerminalNodeImpl = NewTerminalNodeImpl(token)
|
||||
return en
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ func New<parser.name>(input antlr4.TokenStream) *<parser.name> {
|
|||
|
||||
parser := new(<parser.name>)
|
||||
|
||||
parser.InitParser(input)
|
||||
parser.Parser = NewParser(input)
|
||||
|
||||
parser.Interpreter = antlr4.NewParserATNSimulator(parser, deserializedATN, decisionToDFA, sharedContextCache)
|
||||
parser.RuleNames = ruleNames
|
||||
|
@ -823,7 +823,7 @@ func New<lexer.name>(input antlr4.CharStream) *<lexer.name> {
|
|||
|
||||
lex := new(<lexer.name>)
|
||||
|
||||
lex.InitLexer(input)
|
||||
lex.Lexer = NewLexer(input)
|
||||
|
||||
lex.Interpreter = antlr4.NewLexerATNSimulator(lex, lexerAtn, lexerDecisionToDFA, antlr4.NewPredictionContextCache())
|
||||
|
||||
|
|
Loading…
Reference in New Issue