MCPcopy Create free account
hub / github.com/WheretIB/nullc / ParseVaribleSet

Function ParseVaribleSet

NULLC/Parser.cpp:2299–2323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2297}
2298
2299bool ParseVaribleSet(Lexeme** str)
2300{
2301 if(!ParseTernaryExpr(str))
2302 return false;
2303
2304 Lexeme *curr = *str;
2305 if(ParseLexem(str, lex_set))
2306 {
2307 if(ParseVaribleSet(str))
2308 AddSetVariableNode((*str)->pos);
2309 else
2310 ThrowError((*str)->pos, "ERROR: expression not found after '='");
2311 }else if((*str)->type >= lex_addset && (*str)->type <= lex_xorset){
2312 (*str)++;
2313 CmdID cmdID[] = { cmdAdd, cmdSub, cmdMul, cmdDiv, cmdPow, cmdMod, cmdShl, cmdShr, cmdBitAnd, cmdBitOr, cmdBitXor };
2314 const char *cmdName[] = { "+=", "-=", "*=", "/=", "**=", "%=", "<<=", ">>=", "&=", "|=", "^=" };
2315 assert((unsigned)(curr->type - lex_addset) <= 10);
2316 if(ParseVaribleSet(str))
2317 AddModifyVariableNode((*str)->pos, cmdID[curr->type - lex_addset], cmdName[curr->type - lex_addset]);
2318 else
2319 ThrowError((*str)->pos, "ERROR: expression not found after '%s' operator", cmdName[curr->type - lex_addset]);
2320 }
2321
2322 return true;
2323}
2324
2325bool ParseBlock(Lexeme** str)
2326{

Callers 13

ParseSelectTypeFunction · 0.85
ParseFunctionArgumentsFunction · 0.85
ParseAddVariableFunction · 0.85
ParseIfExprFunction · 0.85
ParseForExprFunction · 0.85
ParseWhileExprFunction · 0.85
ParseDoWhileExprFunction · 0.85
ParseSwitchExprFunction · 0.85
ParseReturnExprFunction · 0.85
ParseGroupFunction · 0.85
ParseTerminalFunction · 0.85
ParseTernaryExprFunction · 0.85

Calls 6

ParseTernaryExprFunction · 0.85
ParseLexemFunction · 0.85
AddSetVariableNodeFunction · 0.85
ThrowErrorFunction · 0.85
assertFunction · 0.85
AddModifyVariableNodeFunction · 0.85

Tested by

no test coverage detected