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

Function ParseExpression

NULLC/Parser.cpp:2359–2474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2357}
2358
2359bool ParseExpression(Lexeme** str)
2360{
2361 switch((*str)->type)
2362 {
2363 case lex_align:
2364 case lex_noalign:
2365 if(ParseVariableDefine(str))
2366 {
2367 if(!ParseLexem(str, lex_semicolon))
2368 ThrowError((*str)->pos, "ERROR: ';' not found after variable definition");
2369 return true;
2370 }
2371 case lex_class:
2372 if(!ParseClassDefinition(str))
2373 ThrowError((*str)->pos, "ERROR: variable or class definition is expected after alignment specifier");
2374 break;
2375 case lex_enum:
2376 ParseEnum(str);
2377 break;
2378 case lex_namespace:
2379 {
2380 (*str)++;
2381 unsigned count = 0;
2382 do
2383 {
2384 count++;
2385 if((*str)->type != lex_string)
2386 ThrowError((*str)->pos, "ERROR: namespace name required");
2387 PushNamespace(InplaceStr((*str)->pos, (*str)->length));
2388 (*str)++;
2389 }while(ParseLexem(str, lex_point));
2390 if(!ParseLexem(str, lex_ofigure))
2391 ThrowError((*str)->pos, "ERROR: '{' not found after namespace name");
2392 if(!ParseCode(str))
2393 AddVoidNode();
2394 if(!ParseLexem(str, lex_cfigure))
2395 ThrowError((*str)->pos, "ERROR: '}' not found after namespace body");
2396 while(count--)
2397 PopNamespace();
2398 }
2399 break;
2400 case lex_ofigure:
2401 ParseBlock(str);
2402 break;
2403 case lex_return:
2404 ParseReturnExpr(str);
2405 break;
2406 case lex_yield:
2407 ParseReturnExpr(str, true);
2408 break;
2409 case lex_break:
2410 ParseBreakExpr(str);
2411 break;
2412 case lex_continue:
2413 ParseContinueExpr(str);
2414 break;
2415 case lex_if:
2416 ParseIfExpr(str);

Callers 6

ParseIfExprFunction · 0.85
ParseForExprFunction · 0.85
ParseWhileExprFunction · 0.85
ParseDoWhileExprFunction · 0.85
ParseSwitchExprFunction · 0.85
ParseCodeFunction · 0.85

Calls 15

ParseVariableDefineFunction · 0.85
ParseLexemFunction · 0.85
ThrowErrorFunction · 0.85
ParseClassDefinitionFunction · 0.85
ParseEnumFunction · 0.85
PushNamespaceFunction · 0.85
InplaceStrClass · 0.85
ParseCodeFunction · 0.85
AddVoidNodeFunction · 0.85
PopNamespaceFunction · 0.85
ParseBlockFunction · 0.85
ParseReturnExprFunction · 0.85

Tested by

no test coverage detected