nicer error messages for used keywords as identifiers

This commit is contained in:
Araq 2011-06-19 16:22:39 +02:00
commit 54021471e4
3 changed files with 7 additions and 4 deletions

View file

@ -165,6 +165,10 @@ proc tokToStr*(tok: TToken): string =
InternalError("tokToStr")
result = ""
proc prettyTok*(tok: TToken): string =
if IsKeyword(tok.tokType): result = "keyword " & tok.ident.s
else: result = tokToStr(tok)
proc PrintTok*(tok: TToken) =
write(stdout, TokTypeToStr[tok.tokType])
write(stdout, " ")