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

Method FunctionDeclaration

parser/gscript_parser.go:1153–1243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1151}
1152
1153func (p *GScriptParser) FunctionDeclaration() (localctx IFunctionDeclarationContext) {
1154 localctx = NewFunctionDeclarationContext(p, p.GetParserRuleContext(), p.GetState())
1155 p.EnterRule(localctx, 8, GScriptParserRULE_functionDeclaration)
1156 var _la int
1157
1158 defer func() {
1159 p.ExitRule()
1160 }()
1161
1162 defer func() {
1163 if err := recover(); err != nil {
1164 if v, ok := err.(antlr.RecognitionException); ok {
1165 localctx.SetException(v)
1166 p.GetErrorHandler().ReportError(p, v)
1167 p.GetErrorHandler().Recover(p, v)
1168 } else {
1169 panic(err)
1170 }
1171 }
1172 }()
1173
1174 p.EnterOuterAlt(localctx, 1)
1175 p.SetState(116)
1176 p.GetErrorHandler().Sync(p)
1177
1178 if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) == 1 {
1179 {
1180 p.SetState(115)
1181 p.TypeTypeOrVoid()
1182 }
1183
1184 }
1185 {
1186 p.SetState(118)
1187 p.Match(GScriptParserIDENTIFIER)
1188 }
1189 p.SetState(120)
1190 p.GetErrorHandler().Sync(p)
1191 _la = p.GetTokenStream().LA(1)
1192
1193 if ((_la-27)&-(0x1f+1)) == 0 && ((1<<uint((_la-27)))&((1<<(GScriptParserGT-27))|(1<<(GScriptParserLT-27))|(1<<(GScriptParserMULT-27))|(1<<(GScriptParserDIV-27))|(1<<(GScriptParserPLUS-27))|(1<<(GScriptParserSUB-27))|(1<<(GScriptParserEQUAL-27))|(1<<(GScriptParserLE-27))|(1<<(GScriptParserGE-27))|(1<<(GScriptParserNOTEQUAL-27)))) != 0 {
1194 {
1195 p.SetState(119)
1196 p.OperatorOverloading()
1197 }
1198
1199 }
1200 {
1201 p.SetState(122)
1202 p.FormalParameters()
1203 }
1204 p.SetState(127)
1205 p.GetErrorHandler().Sync(p)
1206 _la = p.GetTokenStream().LA(1)
1207
1208 for _la == GScriptParserLBRACK {
1209 {
1210 p.SetState(123)

Callers 2

MemberDeclarationMethod · 0.95
BlockStatementMethod · 0.95

Calls 8

TypeTypeOrVoidMethod · 0.95
OperatorOverloadingMethod · 0.95
FormalParametersMethod · 0.95
QualifiedNameListMethod · 0.95
FunctionBodyMethod · 0.95
EnterRuleMethod · 0.45
ExitRuleMethod · 0.45

Tested by

no test coverage detected