Escape zero-length Symbols
This commit is contained in:
parent
acdfd3c560
commit
10d20600bf
|
@ -27,14 +27,16 @@ const
|
||||||
compoundKinds* = {pkRecord, pkSequence, pkSet, pkDictionary}
|
compoundKinds* = {pkRecord, pkSequence, pkSet, pkDictionary}
|
||||||
|
|
||||||
type Symbol* = distinct string
|
type Symbol* = distinct string
|
||||||
proc `$`*(s: Symbol): string {.borrow.}
|
|
||||||
proc `<`*(x, y: Symbol): bool {.borrow.}
|
proc `<`*(x, y: Symbol): bool {.borrow.}
|
||||||
proc `==`*(x, y: Symbol): bool {.borrow.}
|
proc `==`*(x, y: Symbol): bool {.borrow.}
|
||||||
proc hash*(s: Symbol): Hash {.borrow.}
|
proc hash*(s: Symbol): Hash {.borrow.}
|
||||||
proc len*(s: Symbol): int {.borrow.}
|
proc len*(s: Symbol): int {.borrow.}
|
||||||
|
|
||||||
|
proc `$`*(s: Symbol): string =
|
||||||
|
if s.len == 0: "||" else: string(s)
|
||||||
|
|
||||||
type
|
type
|
||||||
Preserve*[E = void] = object
|
Preserve*[E] = object
|
||||||
embedded*: bool
|
embedded*: bool
|
||||||
## Flag to mark embedded Preserves
|
## Flag to mark embedded Preserves
|
||||||
case kind*: PreserveKind
|
case kind*: PreserveKind
|
||||||
|
|
Loading…
Reference in New Issue