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

Function ParseTypedefExpr

NULLC/Parser.cpp:2338–2357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2336}
2337
2338bool ParseTypedefExpr(Lexeme** str)
2339{
2340 if(!ParseLexem(str, lex_typedef))
2341 return false;
2342 if(!ParseSelectType(str))
2343 ThrowError((*str)->pos, "ERROR: typename expected after typedef");
2344
2345 if(ParseSelectType(str))
2346 ThrowError((*str - 1)->pos, "ERROR: there is already a type or an alias with the same name");
2347 if((*str)->type != lex_string)
2348 ThrowError((*str)->pos, "ERROR: alias name expected after typename in typedef expression");
2349
2350 if((*str)->length >= NULLC_MAX_VARIABLE_NAME_LENGTH)
2351 ThrowError((*str)->pos, "ERROR: alias name length is limited to 2048 symbols");
2352 AddAliasType(InplaceStr((*str)->pos, (*str)->length));
2353 (*str)++;
2354 if(!ParseLexem(str, lex_semicolon))
2355 ThrowError((*str)->pos, "ERROR: ';' not found after typedef");
2356 return true;
2357}
2358
2359bool ParseExpression(Lexeme** str)
2360{

Callers 2

ParseClassBodyFunction · 0.85
ParseExpressionFunction · 0.85

Calls 5

ParseLexemFunction · 0.85
ParseSelectTypeFunction · 0.85
ThrowErrorFunction · 0.85
AddAliasTypeFunction · 0.85
InplaceStrClass · 0.85

Tested by

no test coverage detected