MCPcopy Create free account
hub / github.com/anjo76/angelscript / ParseExprPostOp

Method ParseExprPostOp

sdk/angelscript/source/as_parser.cpp:2292–2341  ·  view source on GitHub ↗

BNF:11: EXPRPOSTOP ::= ('.' (FUNCCALL | IDENTIFIER)) | ('[' (IDENTIFIER ':')? ASSIGN (',' (IDENTIFIER ':')? ASSIGN)* ']') | ARGLIST | '++' | '--'

Source from the content-addressed store, hash-verified

2290
2291// BNF:11: EXPRPOSTOP ::= ('.' (FUNCCALL | IDENTIFIER)) | ('[' (IDENTIFIER ':')? ASSIGN (',' (IDENTIFIER ':')? ASSIGN)* ']') | ARGLIST | '++' | '--'
2292asCScriptNode *asCParser::ParseExprPostOp()
2293{
2294 asCScriptNode *node = CreateNode(snExprPostOp);
2295 if( node == 0 ) return 0;
2296
2297 sToken t;
2298 GetToken(&t);
2299 if( !IsPostOperator(t.type) )
2300 {
2301 Error(TXT_EXPECTED_POST_OPERATOR, &t);
2302 Error(InsteadFound(t), &t);
2303 return node;
2304 }
2305
2306 node->SetToken(&t);
2307 node->UpdateSourcePos(t.pos, t.length);
2308
2309 if( t.type == ttDot )
2310 {
2311 sToken t1, t2;
2312 GetToken(&t1);
2313 GetToken(&t2);
2314 RewindTo(&t1);
2315 if (t2.type == ttOpenParenthesis || IsTemplateTypeList(t2))
2316 node->AddChildLast(ParseFunctionCall());
2317 else
2318 node->AddChildLast(ParseIdentifier());
2319 }
2320 else if( t.type == ttOpenBracket )
2321 {
2322 node->AddChildLast(ParseArgList(false));
2323
2324 GetToken(&t);
2325 if( t.type != ttCloseBracket )
2326 {
2327 Error(ExpectedToken("]"), &t);
2328 Error(InsteadFound(t), &t);
2329 return node;
2330 }
2331
2332 node->UpdateSourcePos(t.pos, t.length);
2333 }
2334 else if( t.type == ttOpenParenthesis)
2335 {
2336 RewindTo(&t);
2337 node->AddChildLast(ParseArgList());
2338 }
2339
2340 return node;
2341}
2342
2343// BNF:15: EXPROP ::= MATHOP | COMPOP | LOGICOP | BITOP
2344// BNF:16: MATHOP ::= '+' | '-' | '*' | '/' | '\%' | '**'

Callers

nothing calls this directly

Calls 3

SetTokenMethod · 0.80
UpdateSourcePosMethod · 0.80
AddChildLastMethod · 0.80

Tested by

no test coverage detected