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

Method Primary

parser/gscript_parser.go:7058–7116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7056}
7057
7058func (p *GScriptParser) Primary() (localctx IPrimaryContext) {
7059 localctx = NewPrimaryContext(p, p.GetParserRuleContext(), p.GetState())
7060 p.EnterRule(localctx, 70, GScriptParserRULE_primary)
7061
7062 defer func() {
7063 p.ExitRule()
7064 }()
7065
7066 defer func() {
7067 if err := recover(); err != nil {
7068 if v, ok := err.(antlr.RecognitionException); ok {
7069 localctx.SetException(v)
7070 p.GetErrorHandler().ReportError(p, v)
7071 p.GetErrorHandler().Recover(p, v)
7072 } else {
7073 panic(err)
7074 }
7075 }
7076 }()
7077
7078 p.SetState(446)
7079 p.GetErrorHandler().Sync(p)
7080
7081 switch p.GetTokenStream().LA(1) {
7082 case GScriptParserLPAREN:
7083 p.EnterOuterAlt(localctx, 1)
7084 {
7085 p.SetState(440)
7086 p.Match(GScriptParserLPAREN)
7087 }
7088 {
7089 p.SetState(441)
7090 p.expr(0)
7091 }
7092 {
7093 p.SetState(442)
7094 p.Match(GScriptParserRPAREN)
7095 }
7096
7097 case GScriptParserNil, GScriptParserBOOL_LITERAL, GScriptParserSTRING_LITERAL, GScriptParserRAW_STRING_LIT, GScriptParserNULL_LITERAL, GScriptParserDECIMAL_LITERAL, GScriptParserFLOAT_LITERAL:
7098 p.EnterOuterAlt(localctx, 2)
7099 {
7100 p.SetState(444)
7101 p.Literal()
7102 }
7103
7104 case GScriptParserIDENTIFIER:
7105 p.EnterOuterAlt(localctx, 3)
7106 {
7107 p.SetState(445)
7108 p.Match(GScriptParserIDENTIFIER)
7109 }
7110
7111 default:
7112 panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
7113 }
7114
7115 return localctx

Callers 1

exprMethod · 0.95

Calls 5

exprMethod · 0.95
LiteralMethod · 0.95
NewPrimaryContextFunction · 0.85
EnterRuleMethod · 0.45
ExitRuleMethod · 0.45

Tested by

no test coverage detected