NewGScriptParser produces a new parser instance for the optional input antlr.TokenStream. The *GScriptParser instance produced may be reused by calling the SetInputStream method. The initial parser configuration is expensive to construct, and the object is not thread-safe; however, if used within a
(input antlr.TokenStream)
| 289 | // however, if used within a Golang sync.Pool, the construction cost amortizes well and the |
| 290 | // objects can be used in a thread-safe manner. |
| 291 | func NewGScriptParser(input antlr.TokenStream) *GScriptParser { |
| 292 | this := new(GScriptParser) |
| 293 | deserializer := antlr.NewATNDeserializer(nil) |
| 294 | deserializedATN := deserializer.DeserializeFromUInt16(parserATN) |
| 295 | decisionToDFA := make([]*antlr.DFA, len(deserializedATN.DecisionToState)) |
| 296 | for index, ds := range deserializedATN.DecisionToState { |
| 297 | decisionToDFA[index] = antlr.NewDFA(ds, index) |
| 298 | } |
| 299 | this.BaseParser = antlr.NewBaseParser(input) |
| 300 | |
| 301 | this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache()) |
| 302 | this.RuleNames = ruleNames |
| 303 | this.LiteralNames = literalNames |
| 304 | this.SymbolicNames = symbolicNames |
| 305 | this.GrammarFileName = "GScript.g4" |
| 306 | |
| 307 | return this |
| 308 | } |
| 309 | |
| 310 | // GScriptParser tokens. |
| 311 | const ( |
no outgoing calls
no test coverage detected