NewGScriptLexer produces a new lexer instance for the optional input antlr.CharStream. The *GScriptLexer instance produced may be reused by calling the SetInputStream method. The initial lexer configuration is expensive to construct, and the object is not thread-safe; however, if used within a Gola
(input antlr.CharStream)
| 319 | // however, if used within a Golang sync.Pool, the construction cost amortizes well and the |
| 320 | // objects can be used in a thread-safe manner. |
| 321 | func NewGScriptLexer(input antlr.CharStream) *GScriptLexer { |
| 322 | l := new(GScriptLexer) |
| 323 | lexerDeserializer := antlr.NewATNDeserializer(nil) |
| 324 | lexerAtn := lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn) |
| 325 | lexerDecisionToDFA := make([]*antlr.DFA, len(lexerAtn.DecisionToState)) |
| 326 | for index, ds := range lexerAtn.DecisionToState { |
| 327 | lexerDecisionToDFA[index] = antlr.NewDFA(ds, index) |
| 328 | } |
| 329 | l.BaseLexer = antlr.NewBaseLexer(input) |
| 330 | l.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache()) |
| 331 | |
| 332 | l.channelNames = lexerChannelNames |
| 333 | l.modeNames = lexerModeNames |
| 334 | l.RuleNames = lexerRuleNames |
| 335 | l.LiteralNames = lexerLiteralNames |
| 336 | l.SymbolicNames = lexerSymbolicNames |
| 337 | l.GrammarFileName = "GScript.g4" |
| 338 | // TODO: l.EOF = antlr.TokenEOF |
| 339 | |
| 340 | return l |
| 341 | } |
| 342 | |
| 343 | // GScriptLexer tokens. |
| 344 | const ( |
no outgoing calls