Skip to content

Commit ed2f397

Browse files
committed
lexer: Show word as token if possible during error
This closes #18
1 parent ae8e078 commit ed2f397

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fusion/core/lexer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defs.err = function(pos, char, ctx)
3535
local errormsg_table = {
3636
"SyntaxError";
3737
("Unexpected character on line %d"):format(line);
38-
("Token: %s"):format(char);
38+
("Token: %s"):format(current_file:match("%w+", pos) or char);
3939
("Input: >> %q <<"):format(input);
4040
ctx
4141
}

0 commit comments

Comments
 (0)