mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Reorganize and comment better main()
This commit is contained in:
@@ -337,19 +337,25 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(dependfile, "%s: %s\n", tzTargetFileName, mainFileName);
|
fprintf(dependfile, "%s: %s\n", tzTargetFileName, mainFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init file stack; important to do first, since it provides the file name, line, etc */
|
charmap_New("main", NULL);
|
||||||
|
|
||||||
|
// Init lexer and file stack, prodiving file info
|
||||||
lexer_Init();
|
lexer_Init();
|
||||||
fstk_Init(mainFileName, maxRecursionDepth);
|
fstk_Init(mainFileName, maxRecursionDepth);
|
||||||
|
|
||||||
charmap_New("main", NULL);
|
// Perform parse (yyparse is auto-generated from `parser.y`)
|
||||||
|
if (yyparse() != 0 && nbErrors == 0)
|
||||||
|
nbErrors = 1;
|
||||||
|
|
||||||
if (yyparse() != 0 || nbErrors != 0)
|
|
||||||
errx(1, "Assembly aborted (%u errors)!", nbErrors);
|
|
||||||
if (dependfile)
|
if (dependfile)
|
||||||
fclose(dependfile);
|
fclose(dependfile);
|
||||||
|
|
||||||
sect_CheckUnionClosed();
|
sect_CheckUnionClosed();
|
||||||
|
|
||||||
|
if (nbErrors != 0)
|
||||||
|
errx(1, "Assembly aborted (%u errors)!", nbErrors);
|
||||||
|
|
||||||
|
// If parse aborted due to missing an include, and `-MG` was given, exit normally
|
||||||
if (oFailedOnMissingInclude)
|
if (oFailedOnMissingInclude)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ void sect_EndUnion(void)
|
|||||||
void sect_CheckUnionClosed(void)
|
void sect_CheckUnionClosed(void)
|
||||||
{
|
{
|
||||||
if (unionStack)
|
if (unionStack)
|
||||||
fatalerror("Unterminated UNION construct!\n");
|
error("Unterminated UNION construct!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user