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

Function ParseGenericEnd

NULLC/Parser.cpp:372–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void ParseGenericEnd(Lexeme** str)
373{
374 // If it was '>>' which is now looks like '>', then check it back
375 if((*str)->type == lex_greater && (*str)->length == 2)
376 {
377 (*str)->type = lex_shr;
378 (*str)++;
379 return;
380 }
381 if(!ParseLexem(str, lex_greater))
382 {
383 if((*str)->type == lex_shr) // if we have '>>'
384 (*str)->type = lex_greater; // "parse" half of it and replace lexeme with '>' while preserving original length to restore later
385 else
386 ThrowError((*str)->pos, "ERROR: '>' expected after generic type alias list");
387 }
388}
389
390// allowArray allows parsing of array types. It is disabled when parsing a type for "new" expression
391// allowGenericType is used in parsing of generic function declaration, it allows parts of types to be "generic"

Callers 1

ParseSelectTypeFunction · 0.85

Calls 2

ParseLexemFunction · 0.85
ThrowErrorFunction · 0.85

Tested by

no test coverage detected