Preserves now has a register type

This commit is contained in:
Emery Hemingway 2023-12-30 10:59:51 +02:00
parent 0954180321
commit 8f6da89d69
2 changed files with 16 additions and 2 deletions

View File

@ -1,5 +1,17 @@
{
"depends": [
{
"method": "fetchzip",
"packages": [
"bigints"
],
"path": "/nix/store/jvrm392g8adfsgf36prgwkbyd7vh5jsw-source",
"ref": "20231006",
"rev": "86ea14d31eea9275e1408ca34e6bfe9c99989a96",
"sha256": "15pcpmnk1bnw3k8769rjzcpg00nahyrypwbxs88jnwr4aczp99j4",
"srcDir": "src",
"url": "https://github.com/ehmry/nim-bigints/archive/86ea14d31eea9275e1408ca34e6bfe9c99989a96.tar.gz"
},
{
"method": "fetchzip",
"packages": [

View File

@ -75,8 +75,8 @@ proc grab*[T](pr: Preserve[T]): Pattern =
AnyAtom(orKind: AnyAtomKind.`float`, float: pr.float).toPattern
of pkDouble:
AnyAtom(orKind: AnyAtomKind.`double`, double: pr.double).toPattern
of pkSignedInteger:
AnyAtom(orKind: AnyAtomKind.`int`, int: pr.int).toPattern
of pkRegister:
AnyAtom(orKind: AnyAtomKind.`int`, int: pr.register).toPattern
of pkString:
AnyAtom(orKind: AnyAtomKind.`string`, string: pr.string).toPattern
of pkByteString:
@ -101,6 +101,8 @@ proc grab*[T](pr: Preserve[T]): Pattern =
of pkEmbedded:
# TODO: can patterns be constructed over embedded literals?
drop()
else:
raise newException(ValueError, "cannot generate a pattern for unhandled Value type")
proc grab*[T](val: T): Pattern =
## Construct a `Pattern` from value of type `T`.