Mattias Wadman
06245d1295
binary,decode,doc: Rename buffer to binary and add some documentation
...
Rename buffer to binary. Still some work left what to call buffer/binary in decode code.
Document decode value and binary type
Fix proper unit padding for tobytes and add still undocumenated extra padding argument.
Add some additional binary tests
2022-02-08 22:20:28 +01:00
Mattias Wadman
7c5215347d
bitio,decode: Refactor bitio usage and make buffer slicing more correct
...
Remove bitio.Buffer layer. bitio.Buffer was a kitchen sink layer with helpers
now it's just a buffer and most functions have been moved to decode instead.
bitio package now only have primitive types and functions simialar to standard
library io and bytes packages.
Make nearly eveything internally use bitio.Bit* interfaces so that slicing work
correctly this will also make it possible to start experimenting with more
complicated silcing helpers, ex things like:
breplace(.header.bitrate; 123) to get a new buffer with bitrate changed.
2022-02-04 21:41:53 +01:00
Mattias Wadman
ca68e6a1e4
interp: Add Platform() method to OS interface
...
Felt bad that main should have to know about it
2022-01-29 11:31:36 +01:00
Mattias Wadman
898dfec1d1
lint: Fix typeassert and case exhaustive warnings
2022-01-25 17:23:41 +01:00
Mattias Wadman
548a065388
decode,interp: Finish up nil value support
...
Update msgpack, bson and cbor to use it.
2022-01-17 10:49:46 +01:00
Mattias Wadman
edad481878
num,mathextra: Rename num package to mathextra
...
Think it makes more sense
2022-01-15 19:00:42 +01:00
Mattias Wadman
1383b411ae
decode,interp: Add arbitrary large integer support (BigInt)
...
Was already handled in fq in various places as gojq uses them
Update msgpack to support negative integers that can't represented as int64
Rename read try* number functions to make them more explicit
2022-01-15 19:00:42 +01:00
Mattias Wadman
0b0f28e966
cbor: Add decoder
...
Does not decode sematic tag types
Also fixes broken float16 support
Fixes #71
2022-01-12 17:56:03 +01:00
Mattias Wadman
9770b0046b
repl: Make prompt for array and iter more jqish
...
Really need to refactor script.go some day into a proper parser
2022-01-10 20:02:43 +01:00
Mattias Wadman
be0ef80c8d
interp,fq: Make bit operators normal functions
...
Uses same rule as jq math functions, 1 arg uses input, more than one all passed as args.
So "bnot 1" -> "1 | bnot", "1 bsl 1" -> "bsl(1; 1)"
Don't think it's worth changing the jq syntax for this and also it could make fq
scripts no compatiblr with other jq tools. Non-10 base number literals are still allowed
but should probably not be used in scripts, only in repl and with cli.
2022-01-09 01:06:36 +01:00
Mattias Wadman
bf9e13c85a
windows: Unbreak tests
...
Normalize OS specific errors paths to make difftests work
Related to #21
2022-01-04 22:11:25 +01:00
Mattias Wadman
f7c7801bbe
interp: Rework buffer regex support
...
Now all regexp functions should work similar to string version for buffers.
Added scan_toend that works as scan but outputs buffer from match to end of buffer,
useful when trying to decode a format and you dont know or care to limit.
2021-12-17 16:23:44 +01:00
Mattias Wadman
9f2dddc6e1
interp,gojqextra: Make buffers values even more lazy and error early on non-scalar calls
2021-11-29 14:51:00 +01:00
Mattias Wadman
fdb811ec54
gojqextra,decode: Add generic lazy JQValue
2021-11-22 01:23:59 +01:00
Mattias Wadman
1047d909ac
doc: Document io packages a bit
2021-11-21 21:55:53 +01:00
Mattias Wadman
aab32cf2db
gojqextra,interp: Add lazy string to speed usage of decode value buffer where string is not used
2021-11-21 21:27:44 +01:00
Mattias Wadman
74b57501b5
shquote: Remove unnecessary sb.Reset()
2021-11-20 10:46:36 +01:00
Mattias Wadman
b66ed32614
decode,interp: Make fuzzing work again and cleanup fatal/error code
2021-11-16 17:11:26 +01:00
Mattias Wadman
1b32b42f93
decode: Major decode API refactor
...
Generate more code
More generic and comfortable API
Improve and Update format decoder to new API
Add some more format tests
2021-11-15 21:12:07 +01:00
Mattias Wadman
6a15625587
interp,decode: Refactor out Scalar from Value and merge Array/Struct into Compound
...
Also add tosym, toactual
2021-11-05 17:29:22 +01:00
Mattias Wadman
6cacc9b398
interp: Move *CtxWriter to ioextra, some comments cleanup
2021-11-05 17:28:29 +01:00
Mattias Wadman
13fae09172
interp: Don't print context cancel
2021-11-01 13:01:05 +01:00
Mattias Wadman
1e1ad14cc2
difftest: Sync code
2021-10-30 01:26:00 +02:00
Mattias Wadman
95ec5e1077
Cleanup and rename s/BufferView/BufferRange
2021-10-21 00:48:30 +02:00
Mattias Wadman
4af5739712
interp: Rework string/buffer for decode values
2021-10-20 01:31:59 +02:00
Mattias Wadman
5052bae18e
decode,interp: Refactor to allow decode/fillgap a range
2021-10-19 14:38:11 +02:00
Mattias Wadman
7f36f703dd
Add to/bytes/bits[range]
2021-10-17 14:43:37 +02:00
Mattias Wadman
e86b45bd1a
Add *grep/1/2 and find/1/2
2021-10-13 01:27:04 +02:00
Mattias Wadman
b17a7155b5
difftest: Remove accidental log
2021-10-10 21:19:40 +02:00
Mattias Wadman
f0233bb811
test: Refactor out diff testing into own package
2021-10-10 17:20:49 +02:00
Mattias Wadman
691688022f
fqtest: Refactor our script part to own package
...
Hopefully can be reused for docs generation
2021-10-06 18:49:03 +02:00
Mattias Wadman
15e9f6f0af
ansi: Correct background reset code
2021-09-30 22:37:45 +02:00
Mattias Wadman
9035278e81
gojqextra: Move errors to own file
2021-09-28 01:45:32 +02:00
Mattias Wadman
3ff0c9b5e0
lint: Enable errcheck adnd revive
2021-09-27 11:01:14 +02:00
Mattias Wadman
110c86b959
interp: Fix broken dynamic width/height
...
Refactor options to fixed/dynamic and just use stack
Added support for env in fqtest readlines
2021-09-22 18:18:57 +02:00
Mattias Wadman
976e992c31
interp: Move progress logic to jq
2021-09-20 17:47:40 +02:00
Mattias Wadman
31d7611f55
fqtest: Add env support and isterminal/width/height support
2021-09-19 02:17:31 +02:00
Mattias Wadman
b33f2cd678
cli: Make profile build optional and move it to cli
2021-09-12 13:08:53 +02:00
Mattias Wadman
f1507f7f65
mod: Use proper path and dont use replace
2021-09-12 13:08:50 +02:00
Mattias Wadman
0c7fa090b0
gojq: Initial update support
...
decode value give no updateable error
JQValue json value tries to replicate behaveior
2021-09-12 13:08:50 +02:00
Mattias Wadman
ad850d69e3
lint: want explicit types in gojqextra.go
2021-09-12 13:08:49 +02:00
Mattias Wadman
f33b31049d
Refactor decode.Value gojq bindings
2021-09-12 13:08:48 +02:00
Mattias Wadman
970465996c
Init
2021-09-12 13:08:42 +02:00