Use nicer escape sequences in renderer.nim (#17239)
This commit is contained in:
parent
02f4464058
commit
87897fa2d6
1 changed files with 11 additions and 11 deletions
|
|
@ -203,18 +203,18 @@ proc putComment(g: var TSrcGen, s: string) =
|
||||||
case s[i]
|
case s[i]
|
||||||
of '\0':
|
of '\0':
|
||||||
break
|
break
|
||||||
of '\x0D':
|
of '\r':
|
||||||
put(g, tkComment, com)
|
put(g, tkComment, com)
|
||||||
com = "## "
|
com = "## "
|
||||||
inc(i)
|
inc(i)
|
||||||
if i <= hi and s[i] == '\x0A': inc(i)
|
if i <= hi and s[i] == '\n': inc(i)
|
||||||
optNL(g, ind)
|
optNL(g, ind)
|
||||||
of '\x0A':
|
of '\n':
|
||||||
put(g, tkComment, com)
|
put(g, tkComment, com)
|
||||||
com = "## "
|
com = "## "
|
||||||
inc(i)
|
inc(i)
|
||||||
optNL(g, ind)
|
optNL(g, ind)
|
||||||
of ' ', '\x09':
|
of ' ', '\t':
|
||||||
com.add(s[i])
|
com.add(s[i])
|
||||||
inc(i)
|
inc(i)
|
||||||
else:
|
else:
|
||||||
|
|
@ -242,12 +242,12 @@ proc maxLineLength(s: string): int =
|
||||||
case s[i]
|
case s[i]
|
||||||
of '\0':
|
of '\0':
|
||||||
break
|
break
|
||||||
of '\x0D':
|
of '\r':
|
||||||
inc(i)
|
inc(i)
|
||||||
if i <= hi and s[i] == '\x0A': inc(i)
|
if i <= hi and s[i] == '\n': inc(i)
|
||||||
result = max(result, lineLen)
|
result = max(result, lineLen)
|
||||||
lineLen = 0
|
lineLen = 0
|
||||||
of '\x0A':
|
of '\n':
|
||||||
inc(i)
|
inc(i)
|
||||||
result = max(result, lineLen)
|
result = max(result, lineLen)
|
||||||
lineLen = 0
|
lineLen = 0
|
||||||
|
|
@ -261,13 +261,13 @@ proc putRawStr(g: var TSrcGen, kind: TokType, s: string) =
|
||||||
var str = ""
|
var str = ""
|
||||||
while i <= hi:
|
while i <= hi:
|
||||||
case s[i]
|
case s[i]
|
||||||
of '\x0D':
|
of '\r':
|
||||||
put(g, kind, str)
|
put(g, kind, str)
|
||||||
str = ""
|
str = ""
|
||||||
inc(i)
|
inc(i)
|
||||||
if i <= hi and s[i] == '\x0A': inc(i)
|
if i <= hi and s[i] == '\n': inc(i)
|
||||||
optNL(g, 0)
|
optNL(g, 0)
|
||||||
of '\x0A':
|
of '\n':
|
||||||
put(g, kind, str)
|
put(g, kind, str)
|
||||||
str = ""
|
str = ""
|
||||||
inc(i)
|
inc(i)
|
||||||
|
|
@ -280,7 +280,7 @@ proc putRawStr(g: var TSrcGen, kind: TokType, s: string) =
|
||||||
proc containsNL(s: string): bool =
|
proc containsNL(s: string): bool =
|
||||||
for i in 0..<s.len:
|
for i in 0..<s.len:
|
||||||
case s[i]
|
case s[i]
|
||||||
of '\x0D', '\x0A':
|
of '\r', '\n':
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue