* fix nim js cmp fails at CT * Add `hasClosure` to `std/effecttraits` * type * Update changelog.md Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * fix #14011 * Delete ttypetraits.nim * Apply suggestions from code review * fix #17473 * Revert "fix #14011" This reverts commit 0eed97a84b172b198bf4e6de69c04b84ef9d9f93. * Update lib/system.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
parent
81e54c1d30
commit
e2269f9216
2 changed files with 13 additions and 4 deletions
|
|
@ -2198,13 +2198,21 @@ func insertSep*(s: string, sep = '_', digits = 3): string {.rtl,
|
||||||
|
|
||||||
func escape*(s: string, prefix = "\"", suffix = "\""): string {.rtl,
|
func escape*(s: string, prefix = "\"", suffix = "\""): string {.rtl,
|
||||||
extern: "nsuEscape".} =
|
extern: "nsuEscape".} =
|
||||||
## Escapes a string `s`. See `system.addEscapedChar
|
## Escapes a string `s`.
|
||||||
## <system.html#addEscapedChar,string,char>`_ for the escaping scheme.
|
##
|
||||||
|
## .. note:: The escaping scheme is different from
|
||||||
|
## `system.addEscapedChar`.
|
||||||
|
##
|
||||||
|
## * replaces `'\0'..'\31'` and `'\127'..'\255'` by `\xHH` where `HH` is its hexadecimal value
|
||||||
|
## * replaces ``\`` by `\\`
|
||||||
|
## * replaces `'` by `\'`
|
||||||
|
## * replaces `"` by `\"`
|
||||||
##
|
##
|
||||||
## The resulting string is prefixed with `prefix` and suffixed with `suffix`.
|
## The resulting string is prefixed with `prefix` and suffixed with `suffix`.
|
||||||
## Both may be empty strings.
|
## Both may be empty strings.
|
||||||
##
|
##
|
||||||
## See also:
|
## See also:
|
||||||
|
## * `addEscapedChar proc<system.html#addEscapedChar,string,char>`_
|
||||||
## * `unescape func<#unescape,string,string,string>`_ for the opposite
|
## * `unescape func<#unescape,string,string,string>`_ for the opposite
|
||||||
## operation
|
## operation
|
||||||
result = newStringOfCap(s.len + s.len shr 2)
|
result = newStringOfCap(s.len + s.len shr 2)
|
||||||
|
|
|
||||||
|
|
@ -2839,12 +2839,13 @@ proc addEscapedChar*(s: var string, c: char) {.noSideEffect, inline.} =
|
||||||
## * replaces any `\r` by `\\r`
|
## * replaces any `\r` by `\\r`
|
||||||
## * replaces any `\e` by `\\e`
|
## * replaces any `\e` by `\\e`
|
||||||
## * replaces any other character not in the set `{\21..\126}`
|
## * replaces any other character not in the set `{\21..\126}`
|
||||||
## by `\xHH` where `HH` is its hexadecimal value.
|
## by `\xHH` where `HH` is its hexadecimal value
|
||||||
##
|
##
|
||||||
## The procedure has been designed so that its output is usable for many
|
## The procedure has been designed so that its output is usable for many
|
||||||
## different common syntaxes.
|
## different common syntaxes.
|
||||||
##
|
##
|
||||||
## **Note**: This is **not correct** for producing Ansi C code!
|
## .. warning:: This is **not correct** for producing ANSI C code!
|
||||||
|
##
|
||||||
case c
|
case c
|
||||||
of '\a': s.add "\\a" # \x07
|
of '\a': s.add "\\a" # \x07
|
||||||
of '\b': s.add "\\b" # \x08
|
of '\b': s.add "\\b" # \x08
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue