Implement __FILE__ symbol

Also clean up built-in symbol creation
This is not great, but currently okay.
Should be fixed later, like the rest...
This commit is contained in:
ISSOtm
2020-08-16 13:33:06 +02:00
parent 62ecdce0b0
commit fd02ffb7bd
5 changed files with 90 additions and 34 deletions

View File

@@ -229,8 +229,8 @@ void fstk_RunMacro(char *macroName, struct MacroArgs *args)
newContext(0);
/* Line minus 1 because buffer begins with a newline */
contextStack->lexerState = lexer_OpenFileView(macro->macro,
macro->macroSize, macro->fileLine - 1);
contextStack->lexerState = lexer_OpenFileView(macro->macro, macro->macroSize,
macro->fileLine - 1);
if (!contextStack->lexerState)
fatalerror("Failed to set up lexer for macro invocation\n");
lexer_SetStateAtEOL(contextStack->lexerState);
@@ -307,6 +307,11 @@ char *fstk_DumpToStr(void)
return str;
}
char const *fstk_GetFileName(void)
{
return contextStack->fileName;
}
uint32_t fstk_GetLine(void)
{
return lexer_GetLineNo();