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

Function NewGScriptLexer

parser/gscript_lexer.go:321–341  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
321func 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.
344const (

Callers 4

ArithmeticOperatorsFunction · 0.92
GetCompileInfoMethod · 0.92
compileMethod · 0.92

Calls

no outgoing calls

Tested by 1