From 7ffcfac8eed32ce596a93b4ebd9ddde7147b6ac9 Mon Sep 17 00:00:00 2001 From: Judd Date: Tue, 19 Nov 2024 15:16:29 +0800 Subject: [PATCH] Fix highlite.nim When parsing `a = 1` with `langPython`, Eof is reported unexpectedly. Fix: allow other languages to fallback to "Identifier" when it is not a keyword. This patch is useful as it highlights `Eof` as annoying. --- lib/packages/docutils/highlite.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim index f8376f46c371..7542b88018b0 100644 --- a/lib/packages/docutils/highlite.nim +++ b/lib/packages/docutils/highlite.nim @@ -301,6 +301,8 @@ proc nimNextToken(g: var GeneralTokenizer, keywords: openArray[string] = @[]) = g.kind = nimGetKeyword(id) elif isKeyword(keywords, id) >= 0: g.kind = gtKeyword + else: + g.kind = gtIdentifier of '0': inc(pos) case g.buf[pos]