- migrated defs error reporting to FScriptPosition

This not only prints better formatted texts, it also takes a lot of script maintenance out of the code.
This commit is contained in:
Christoph Oelckers 2020-09-14 22:55:21 +02:00
parent 8a7502c00d
commit e382690f9c
3 changed files with 151 additions and 222 deletions

View file

@ -21,6 +21,7 @@ int32_t scriptfile_getdouble(scriptfile *sf, double *num);
int32_t scriptfile_getstring(scriptfile *sf, FString *st); int32_t scriptfile_getstring(scriptfile *sf, FString *st);
int scriptfile_getsymbol(scriptfile *sf, int32_t *num); int scriptfile_getsymbol(scriptfile *sf, int32_t *num);
int32_t scriptfile_getlinum(const scriptfile *sf, const char *ptr); int32_t scriptfile_getlinum(const scriptfile *sf, const char *ptr);
FScriptPosition scriptfile_getposition(const scriptfile *sf);
int32_t scriptfile_getbraces(scriptfile *sf, FScanner::SavedPos *braceend); int32_t scriptfile_getbraces(scriptfile *sf, FScanner::SavedPos *braceend);
inline bool scriptfile_endofblock(scriptfile* sf, FScanner::SavedPos& braceend) inline bool scriptfile_endofblock(scriptfile* sf, FScanner::SavedPos& braceend)
{ {

File diff suppressed because it is too large Load diff

View file

@ -151,6 +151,15 @@ int scriptfile_getsymbol(scriptfile *sf, int32_t *num)
return 0; return 0;
} }
FScriptPosition scriptfile_getposition(const scriptfile *sf)
{
FScriptPosition pos;
pos.FileName = sf->filename;
pos.ScriptLine = scriptfile_getlinum(sf, sf->ltextptr);
return pos;
}
int32_t scriptfile_getbraces(scriptfile *sf, FScanner::SavedPos *braceend) int32_t scriptfile_getbraces(scriptfile *sf, FScanner::SavedPos *braceend)
{ {
if (scriptfile_eof_error(sf)) if (scriptfile_eof_error(sf))