Do not convert string to string

This commit is contained in:
Emery Hemingway 2023-07-20 20:20:36 +01:00
parent 81d04290a5
commit e6868fabd2
1 changed files with 3 additions and 3 deletions

View File

@ -34,12 +34,12 @@ proc len*(s: Symbol): int {.borrow.}
proc `$`*(s: Symbol): string =
let sym = string s
if sym.len > 0 and sym.string[0] in {'A'..'z'} and not sym.anyIt(char(it) in { '\x00'..'\x19', '"', '\\', '|' }):
result = string sym
if sym.len > 0 and sym[0] in {'A'..'z'} and not sym.anyIt(char(it) in { '\x00'..'\x19', '"', '\\', '|' }):
result = sym
else:
result = newStringOfCap(sym.len shl 1)
result.add('|')
for c in sym.string:
for c in sym:
case c
of '\\':
result.add("\\\\")