Skip to content

Commit

Permalink
related #22534; fixes documentation rendering of custom number litera…
Browse files Browse the repository at this point in the history
…l routine declaration (#23015)

I'm not sure if this is a complete fix, as it does not match the
expected output given in the issue. The expected output given in the
issue highlights the identifier after the `'` the same color as numeric
literals (blue), and this change does not address that. I think that
would involve simplifying `nimNumberPostfix`.

However, this fixes the issue where the routine declaration was rendered
as a string.
New rendering: 
![Screenshot from 2023-11-30
22-17-17](https://github.com/nim-lang/Nim/assets/80008541/b604ce27-a4ad-496b-82c3-0b568d99a8bf)
  • Loading branch information
Erich-Reitz authored Dec 1, 2023
1 parent ab7faa7 commit 5dfa134
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/packages/docutils/highlite.nim
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,18 @@ proc nimNextToken(g: var GeneralTokenizer, keywords: openArray[string] = @[]) =
pos = nimNumber(g, pos)
of '\'':
inc(pos)
g.kind = gtCharLit
while true:
case g.buf[pos]
of '\0', '\r', '\n':
break
of '\'':
inc(pos)
break
of '\\':
inc(pos, 2)
else: inc(pos)
if g.kind != gtPunctuation:
g.kind = gtCharLit
while true:
case g.buf[pos]
of '\0', '\r', '\n':
break
of '\'':
inc(pos)
break
of '\\':
inc(pos, 2)
else: inc(pos)
of '\"':
inc(pos)
if (g.buf[pos] == '\"') and (g.buf[pos + 1] == '\"'):
Expand Down

0 comments on commit 5dfa134

Please sign in to comment.