MCPcopy Create free account
hub / github.com/crossoverJie/gscript / NewGScriptParser

Function NewGScriptParser

parser/gscript_parser.go:291–308  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
291func 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.
311const (

Callers 3

ArithmeticOperatorsFunction · 0.92
GetCompileInfoMethod · 0.92
compileMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected