Escape zero-length Symbols

This commit is contained in:
Emery Hemingway 2023-06-11 21:24:10 +01:00
parent acdfd3c560
commit 10d20600bf
1 changed files with 4 additions and 2 deletions

View File

@ -27,14 +27,16 @@ const
compoundKinds* = {pkRecord, pkSequence, pkSet, pkDictionary}
type Symbol* = distinct string
proc `$`*(s: Symbol): string {.borrow.}
proc `<`*(x, y: Symbol): bool {.borrow.}
proc `==`*(x, y: Symbol): bool {.borrow.}
proc hash*(s: Symbol): Hash {.borrow.}
proc len*(s: Symbol): int {.borrow.}
proc `$`*(s: Symbol): string =
if s.len == 0: "||" else: string(s)
type
Preserve*[E = void] = object
Preserve*[E] = object
embedded*: bool
## Flag to mark embedded Preserves
case kind*: PreserveKind