Skip to content

Commit

Permalink
Fix highlite.nim
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
foldl authored Nov 19, 2024
1 parent a2031ec commit 7ffcfac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/packages/docutils/highlite.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 7ffcfac

Please sign in to comment.