improve error message if literal ends with an underscore (#8114)

This commit is contained in:
Vindaar
2018-06-28 00:33:15 +02:00
committed by Andreas Rumpf
parent cecce80d42
commit cc7479b70f

View File

@@ -344,7 +344,8 @@ proc getNumber(L: var TLexer, result: var TToken) =
if buf[pos] == '_':
if buf[pos+1] notin chars:
lexMessage(L, errGenerated,
"only single underscores may occur in a token: '__' is invalid")
"only single underscores may occur in a token and token may not " &
"end with an underscore: e.g. '1__1' and '1_' are invalid")
break
add(tok.literal, '_')
inc(pos)