From 3ba2d2a91b8b84a0fb3090919cc06116c234a049 Mon Sep 17 00:00:00 2001 From: Imuli Date: Sat, 14 Jul 2018 08:03:49 -0400 Subject: [PATCH] distinguish unknown unicode characters from EOF --- scanner/lexer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scanner/lexer.go b/scanner/lexer.go index de85922..b5680a7 100644 --- a/scanner/lexer.go +++ b/scanner/lexer.go @@ -462,8 +462,10 @@ func Rune2Class(r rune) int { if unicode.IsGraphic(r) { return classUnicodeGraphic } - // return classOther - return -1 + if r == lex.RuneEOF { + return int(r) + } + return classOther } // NewLexer the Lexer constructor