diff --git a/src/u_mapinfo.c b/src/u_mapinfo.c index c3adfb7..41ebc70 100644 --- a/src/u_mapinfo.c +++ b/src/u_mapinfo.c @@ -332,7 +332,7 @@ static int ParseMapEntry(u_scanner_t *s, mapentry_t *val) int U_ParseMapInfo(const char *buffer, size_t length) { unsigned int i; - u_scanner_t scanner = U_ScanOpen(buffer, length); + u_scanner_t scanner = U_ScanOpen(buffer, length, "UMAPINFO"); while (U_HasTokensLeft(&scanner)) { diff --git a/src/u_musinfo.c b/src/u_musinfo.c index 9d8a2d0..71aa21a 100644 --- a/src/u_musinfo.c +++ b/src/u_musinfo.c @@ -86,7 +86,7 @@ void U_ParseMusInfo(const char *mapid) int lumpnum; int inMap = false; - u_scanner_t s = U_ScanOpen(data, datalength); + u_scanner_t s = U_ScanOpen(data, datalength, "MUSINFO"); while (U_HasTokensLeft(&s)) { if (inMap || U_CheckToken(&s, TK_Identifier)) diff --git a/src/u_scanner.c b/src/u_scanner.c index d4f06ff..81ad832 100644 --- a/src/u_scanner.c +++ b/src/u_scanner.c @@ -54,7 +54,7 @@ void U_ExpandState(u_scanner_t* scanner); void U_Unescape(char *str); void U_SetString(char **ptr, const char *start, int length); -u_scanner_t U_ScanOpen(const char* data, int length) +u_scanner_t U_ScanOpen(const char* data, int length, const char* name) { u_scanner_t scanner; scanner.lineStart = scanner.logicalPosition = scanner.scanPos = scanner.tokenLinePosition = 0; @@ -62,6 +62,7 @@ u_scanner_t U_ScanOpen(const char* data, int length) scanner.needNext = TRUE; scanner.string = NULL; scanner.nextState.string = NULL; + scanner.name = name; if(length == -1) length = strlen(data); @@ -470,7 +471,7 @@ void U_Error(u_scanner_t* s, const char *msg, ...) va_start(ap, msg); vsnprintf(buffer, 1024, msg, ap); va_end(ap); - I_Error("%d:%d:%s.", s->tokenLine, s->tokenLinePosition, buffer); + I_Error("%s:%d:%d:%s.", s->name, s->tokenLine, s->tokenLinePosition, buffer); } boolean U_MustGetToken(u_scanner_t* s, char token) diff --git a/src/u_scanner.h b/src/u_scanner.h index 4e20651..ea4ef9d 100644 --- a/src/u_scanner.h +++ b/src/u_scanner.h @@ -63,6 +63,8 @@ typedef struct typedef struct { + const char* name; + u_parserstate_t nextState; char* data; @@ -86,7 +88,7 @@ typedef struct } u_scanner_t; -u_scanner_t U_ScanOpen(const char* data, int length); +u_scanner_t U_ScanOpen(const char* data, int length, const char *name); void U_ScanClose(u_scanner_t* scanner); boolean U_GetNextToken(u_scanner_t* scanner, boolean expandState); boolean U_HasTokensLeft(u_scanner_t* scanner);