mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 04:02:41 +00:00
fixes #2124
This commit is contained in:
@@ -735,14 +735,6 @@ regular expressions:
|
||||
return tkUnknown
|
||||
|
||||
|
||||
Term rewriting macros
|
||||
---------------------
|
||||
|
||||
Term rewriting macros can be used to enhance the compilation process
|
||||
with user defined optimizations; see this `document <trmacros.html>`_ for
|
||||
further information.
|
||||
|
||||
|
||||
Building your first macro
|
||||
-------------------------
|
||||
|
||||
|
||||
@@ -1455,7 +1455,8 @@ template `>%` *(x, y: expr): expr {.immediate.} = y <% x
|
||||
|
||||
proc `$`*(x: int): string {.magic: "IntToStr", noSideEffect.}
|
||||
## The stringify operator for an integer argument. Returns `x`
|
||||
## converted to a decimal string.
|
||||
## converted to a decimal string. ``$`` is Nim's general way of
|
||||
## spelling `toString`:idx:.
|
||||
|
||||
proc `$`*(x: int64): string {.magic: "Int64ToStr", noSideEffect.}
|
||||
## The stringify operator for an integer argument. Returns `x`
|
||||
|
||||
@@ -30,14 +30,16 @@ proc reprStrAux(result: var string, s: string) =
|
||||
add result, "nil"
|
||||
return
|
||||
add result, reprPointer(cast[pointer](s)) & "\""
|
||||
for c in items(s):
|
||||
for i in 0.. <s.len:
|
||||
let c = s[i]
|
||||
case c
|
||||
of '"': add result, "\\\""
|
||||
of '\\': add result, "\\\\" # BUGFIX: forgotten
|
||||
of '\10': add result, "\\10\"\n\"" # " \n " # better readability
|
||||
of '\128' .. '\255', '\0'..'\9', '\11'..'\31':
|
||||
add result, "\\" & reprInt(ord(c))
|
||||
else: result.add(c)
|
||||
else:
|
||||
result.add(c)
|
||||
add result, "\""
|
||||
|
||||
proc reprStr(s: string): string {.compilerRtl.} =
|
||||
|
||||
Reference in New Issue
Block a user