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

Function ParseTernaryExpr

NULLC/Parser.cpp:2281–2297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2279}
2280
2281bool ParseTernaryExpr(Lexeme** str)
2282{
2283 const char *condPos = (*str)->pos;
2284 if(!ParseArithmetic(str))
2285 return false;
2286 while(ParseLexem(str, lex_questionmark))
2287 {
2288 if(!ParseVaribleSet(str))
2289 ThrowError((*str)->pos, "ERROR: expression not found after '?'");
2290 if(!ParseLexem(str, lex_colon))
2291 ThrowError((*str)->pos, "ERROR: ':' not found after expression in ternary operator");
2292 if(!ParseVaribleSet(str))
2293 ThrowError((*str)->pos, "ERROR: expression not found after ':'");
2294 AddIfElseTermNode(condPos);
2295 }
2296 return true;
2297}
2298
2299bool ParseVaribleSet(Lexeme** str)
2300{

Callers 10

GetCurrentArgumentTypeFunction · 0.85
GetGenericFunctionRatingFunction · 0.85
ParseArrayDefinitionFunction · 0.85
ParseClassBodyFunction · 0.85
ParseEnumFunction · 0.85
ParseFunctionVariablesFunction · 0.85
ParseForExprFunction · 0.85
ParseArrayFunction · 0.85
ParseTerminalFunction · 0.85
ParseVaribleSetFunction · 0.85

Calls 5

ParseArithmeticFunction · 0.85
ParseLexemFunction · 0.85
ParseVaribleSetFunction · 0.85
ThrowErrorFunction · 0.85
AddIfElseTermNodeFunction · 0.85

Tested by

no test coverage detected