Emery Hemingway
60c5f03637
Add preservesEmbedded pragma
2022-12-06 22:30:28 -06:00
Emery Hemingway
9f8321a748
Textualize the zero length symbol as ||
2022-11-06 11:03:53 -06:00
Emery Hemingway
2d2df1f918
Parse past annotations
2022-11-02 13:58:37 -05:00
Emery Hemingway
4e795cb92a
Another getOrDefault
2022-10-30 21:09:17 -05:00
Emery Hemingway
201cb7c68e
Check for zero-length binary streams
2022-10-30 17:26:55 -05:00
Emery Hemingway
11661d453c
Replace concat with writeText
...
Write to a stream rather than concatentate a string.
2022-10-30 17:26:55 -05:00
Emery Hemingway
b4756b13ae
isRecord: add variant with a label
2022-10-27 15:29:45 -05:00
Emery Hemingway
7125eadd49
Use step rather than [] for dictionaries
2022-10-25 17:42:04 -05:00
Emery Hemingway
62480318cc
BufferedDecoder: feed by pointer
2022-10-23 23:39:37 -05:00
Emery Hemingway
5fe041fa45
New BufferedDecoder object
2022-10-22 18:40:24 -05:00
Emery Hemingway
918d4d3e2e
Fix encoding and decoding of embedded values
2022-10-16 15:32:09 -05:00
Emery Hemingway
54ec2d439a
Allocate new TableRefs when necessary
2022-10-13 23:05:37 -05:00
Emery Hemingway
cc0472da3d
Add apply procedure
2022-06-25 16:19:42 -05:00
Emery Hemingway
abb39e02a5
I'm using that, sometimes
2022-06-12 23:05:35 -05:00
Emery Hemingway
5043d8595a
Set type conversions
2022-05-18 13:57:40 -05:00
Emery Hemingway
ddc26f0c71
Add pragma accessors
...
This library requires a forked macros module, so export accessors
that would prevent a downstream library from having the same
problems with std/macros.
2022-04-25 11:33:37 -05:00
Emery Hemingway
f32e783e0b
Unembed during fromPreserve
2022-04-22 00:28:36 -05:00
Emery Hemingway
e8d1bf2c57
Refactor mapEmbeds
2022-03-18 18:57:37 -05:00
Emery Hemingway
1dcad539f4
Move preserves/parse module into preserves
...
Some macros in preserves call `parsePreserves` so include that
proc implicitly.
2022-03-18 11:26:52 -05:00
Emery Hemingway
5408cb859a
Add `step` func as a no-effects substitue for `[]` proc
...
ehmry/xdg_open_ng#2
2022-03-18 10:08:39 -05:00
Emery Hemingway
a6b31247cf
Fix indentation bug
2022-03-14 14:28:37 -05:00
Emery Hemingway
5f746706b6
Add forked macros module
...
This one has a more premissive version of "hasCustomPragma".
2022-03-10 23:41:14 -06:00
Emery Hemingway
633cb0a3c4
Tweak fromPreserve for floats and objects
2022-03-10 23:41:14 -06:00
Emery Hemingway
8b52e3baf9
Index into compound types by Preserve keys
2022-03-10 23:41:13 -06:00
Emery Hemingway
db06066e17
Trace to stderr, not stdout
...
This would interfer with stdio communications.
2022-03-08 15:22:49 -06:00
Emery Hemingway
3924e48deb
Distinct Symbol strings
...
More type buracracy makes schema conversion less lossy.
2022-02-20 09:23:49 -06:00
Emery Hemingway
6c4cfa0885
Fix fromPreserve for distinct types
...
This is an example of why bypassing the type system with "when"
is dangerous.
2022-02-11 15:36:30 -06:00
Emery Hemingway
ba4d567791
Careful with those variable length tuples
2021-12-24 00:38:02 +01:00
Emery Hemingway
e25e06efba
Don't convert Table[string,string] to {symbol:string...:...}
...
Should not assume that table keys can be treated at symbols. This
also makes the resulting dictionary convertable to JSON.
2021-12-22 23:49:06 +01:00
Emery Hemingway
200e0a0080
Do not leak null characters into the #"" encoding
2021-12-05 21:30:54 +00:00
Emery Hemingway
7cc0b050f4
Remove support for integers wider than 64 bits
...
I believe this was an unecessary compilication and it can be
restored later if necesary.
2021-11-12 12:25:28 +01:00
Emery Hemingway
e88c238a74
Schema text parsing
2021-11-11 21:57:04 +01:00
Emery Hemingway
6039a729c8
Do not intersperse commas in sequences
2021-11-07 17:30:42 +01:00
Emery Hemingway
ef4278062a
Encode short byte-strings as hex text
2021-11-03 19:17:33 +01:00
Emery Hemingway
29d7352a23
Assert upreservable pragma at runtime
...
This makes the compiler less pedantic.
2021-10-25 21:36:57 +02:00
Emery Hemingway
d1be46de49
Equality across different embedded types
2021-10-25 21:36:57 +02:00
Emery Hemingway
0387cbc7eb
Update documentation
2021-10-25 21:36:57 +02:00
Emery Hemingway
ae5f4b78ac
Adjust stringification
2021-10-25 21:36:45 +02:00
Emery Hemingway
bc9568d6bd
Add unembed routine
2021-10-25 21:36:45 +02:00
Emery Hemingway
a03a188bc2
fromPreserve: fix conversion of literals in tuples
2021-10-25 21:36:45 +02:00
Emery Hemingway
cca512c9df
mapEmbeds for Preserve[void] to Preserve[E]
2021-10-25 21:36:45 +02:00
Emery Hemingway
54c28c90ce
Mark a preserves template as used
2021-10-18 12:12:33 +02:00
Emery Hemingway
220577c8a0
New pragmas for toPreserve and fromPreserve
2021-10-17 11:38:45 +02:00
Emery Hemingway
42a9b26458
Embeddable Preserves
...
Make Preserve a generic type that can embed a native Nim type.
Generate generic implementations from schemas and discard
embeddedType.
2021-09-25 13:47:05 +02:00
Emery Hemingway
75c176ddb6
New constructors for record and sequence
2021-09-23 14:29:31 +02:00
Emery Hemingway
cd5dd7dd03
Add [] operator for dictionaries
2021-09-23 14:29:16 +02:00
Emery Hemingway
9f2921d0ca
Add is* checks
2021-09-23 13:32:04 +02:00
Emery Hemingway
dae5dd9751
Fix toPreserveHook for Table[A, B]
...
The toPreserveHook for tables was not compiling, which would fall
back to the behavior for preserving objects, which would not work
for tables.
2021-09-21 08:00:33 +02:00
Emery Hemingway
efd5cf62df
Optimize allocation of sequences from toPreserve
2021-09-21 08:00:33 +02:00
Emery Hemingway
e6d07ba924
Revert Preserve to a concrete type
...
A generic type with an embedded type is too much hassle with the
type system. Add an "embedded" flag on "Preserve" to mark if a
value should be considered as embedded.
2021-09-08 11:16:40 +02:00
Emery Hemingway
9ed18c279c
Release 1.0.0
2021-09-01 13:32:26 +02:00
Emery Hemingway
91bf449f6b
Unlicense
2021-08-31 17:00:00 +02:00
Emery Hemingway
5ca277b8c0
Embedded types
2021-08-31 16:48:55 +02:00
Emery Hemingway
41b1328e4e
Move JSON specifics to preserves/jsonhooks
2021-08-28 11:31:58 +02:00
Emery Hemingway
5aaac95ca1
Remove % operator
...
Use toPreserves, % is not compatible with a parameterized Preserve
type.
2021-08-28 11:25:04 +02:00
Emery Hemingway
d67482fad8
Do not throw from preserveTo or fromPreserve
...
Return an Option or boolean value. This makes it cheap to test if
a Preserves value is convertable to a Nim type.
2021-08-27 22:35:37 +02:00
Emery Hemingway
8341360741
Restore record pragma handling
2021-08-24 18:00:58 +02:00
Emery Hemingway
16c8ce62ff
Move some stuff around
2021-08-24 18:00:57 +02:00
Emery Hemingway
dd0937f70b
Dereference distinct types in fromPreserves
2021-08-11 13:06:19 +02:00
Emery Hemingway
84e9d00e1d
Initialize bigint
2021-08-11 13:06:19 +02:00
Emery Hemingway
26faea8d91
fix `$` for records
2021-08-11 13:06:19 +02:00
Emery Hemingway
99b0ddbb13
Textual parser
2021-08-11 13:06:16 +02:00
Emery Hemingway
30bfaa8c00
Rewrite some of `%`
2021-07-16 19:13:10 +02:00
Emery Hemingway
713f9d00d3
Add `%` operator
...
Reuse the `%` operator from json module for consistency.
2021-07-09 16:56:09 +02:00
Emery Hemingway
f0c1ebe85e
Add isNil for Preserve
...
Not a ref type, but add `isNil` for checking if a Perserve is
zero-initialized.
2021-07-09 12:24:51 +02:00
Emery Hemingway
8985060055
Add items iterator
...
Iterates over all child items in a Preserve.
2021-07-09 12:24:29 +02:00
Emery Hemingway
2eda0fc9a7
Add {.unpreservable.} pragma
2021-07-01 12:47:30 +02:00
Emery Hemingway
376c0e04c5
Add a {.record: "label".} pragma
...
A pragma for serializing tuples and objects to or from records.
2021-06-28 17:39:27 +02:00
Emery Hemingway
5aa5ccbd09
Move utilities for records to a seperate module
2021-06-28 17:38:41 +02:00
Emery Hemingway
dddf82eedd
Store record labels behind fields
2021-06-24 17:33:02 +02:00
Emery Hemingway
6ebb752690
Store embedded values as pointers
...
Reduce Preserve from a generic to a concrete type.
2021-06-15 18:51:13 +02:00
Emery Hemingway
32ce6a71fe
Implement set with HashSet rather than CountTable
...
I didn't know HashSet was a thing.
2021-06-15 16:02:14 +02:00
Emery Hemingway
db3e302067
setItems iterator
2021-06-10 12:08:34 +02:00
Emery Hemingway
b099475d25
Record utilities
2021-06-08 14:15:12 +02:00
Emery Hemingway
b5940cfe22
Symbol constructor
2021-06-08 12:22:31 +02:00
Emery Hemingway
bfb0825721
Bigint fixes
...
* Native and big integer comparison
* Refuse to serialize negative big ints for now
2021-06-04 11:41:34 +02:00
Emery Hemingway
d63dfad954
Initial commit
2021-06-02 15:51:36 +02:00