1
1
mirror of https://github.com/wader/fq.git synced 2024-10-07 08:57:20 +03:00
Commit Graph

347 Commits

Author SHA1 Message Date
Mattias Wadman
c4dd518e04 decode: Make compound range sort optional
Some formats might want to control child order
mp4: Keep tracks in track id order
dns: Keep label component order
elf: Keep seciton order
macho: Keep command and section order
2022-05-03 16:16:09 +02:00
Mattias Wadman
3ce660a2cf decode: Keep decode tree on RangeFn error 2022-05-03 10:57:43 +02:00
Mattias Wadman
f4480c6fe5 decode,interp: Support for format specific options
interp: Refactor format help and also include options
interp: Add -o name=@path to load file content as value (not documented yet, might change)
interp,decode: Expose decode out value as _out (might change)
interp: Refactor foramts.jq into format_{decode,func,include}.jq
interp: Refactor torepr into _format_func for generic format function overloading
interp: Refactor -o options parsing to be more generic and collect unknowns options to be used as format options
decode of decode alises
func for format overloaded functions
include for format specific jq functions (also _help, torepr etc)
flac_frame: Add bits_per_sample option
mp3: Add max_unique_header_config and max_sync_seek options
mp4: Add decode_samples and allow_truncate options
avc_au: Has length_size option
hevc_au: Has length_size option
aac_frame: Has object_typee option
doc: Rewrite format doc generation, less hack more jq
2022-05-01 17:08:30 +02:00
Mattias Wadman
21ad628add interp: dump: Show field name for compound values in arrays
mp3: Remove one level of struct for granales
dump: Makes it a bit easier to understand array of arrays/structs.
avro_ocf: Rename ocf.go -> avro_ocr.go to have same name of source file as format
pcap,pcapng: Rename tcp flow struct to tcp_connection, makes more sense i think
mp4: Add ISOBMFF to format description
2022-04-21 17:47:15 +02:00
Mattias Wadman
afd724bf9c gojq: Rebase fq fork. Fixes JQValue path tracking when iterating
Add some decode value path and assign tests
2022-04-19 19:00:37 +02:00
Mattias Wadman
6b4dbbf415
Merge pull request #234 from wader/field-truncate2
interp: Don't truncate last display column
2022-04-19 18:30:17 +02:00
Mattias Wadman
607202bb67 interp: Don't truncate last display column
Wrapping lines might be annoying but not seeing things even worse i think.
Hopefully once column config is in jq it could be an option.
2022-04-19 18:19:42 +02:00
Mattias Wadman
087d12419e interp: Simpler and more efficient hexdump
Should not need to copy bits, just use existing bitreader
2022-04-19 18:12:58 +02:00
Mattias Wadman
dabad85080 interp: Proper display column truncate
Also speed up by using less string allocs
2022-04-16 18:48:21 +02:00
Mattias Wadman
b35b1804be decode,format: Add d.FieldFormatOrRaw(Len) 2022-04-11 23:01:45 +02:00
Mattias Wadman
518f6af4a8 gojq: Rebase fq fork
Upstream changes:
Many performance improvements
Error message improvments
Lots of refactoring

Most of the JQValue interface changes in gojq fork had to be reworked but
resultet in a much nicer and cleaner changeset.

fq changes:
Assignment to JQValue (like a decode value) now shallowly converts the value into
a jq value before assigning. Was a bit hacky as it was and this makes JQValue
behave more like real jq values. This also fixes some advanced indexing issues.

Actual custom path updates will be something for the future.
2022-04-11 19:23:15 +02:00
Mattias Wadman
6f03471d15 interp: Paths with a array as root was missing start dot 2022-04-08 16:47:40 +02:00
Mattias Wadman
f8fd6b7f48 mp4: Add more HEIF boxes
Add scalar.*ToDesceription mapper and refactor to use it
2022-04-07 19:11:49 +02:00
Mattias Wadman
5ff67e4cfe formats: Sym and field name cleanup to be more jq friendly 2022-04-05 13:59:57 +02:00
Mattias Wadman
e8dc7112b6 ipv6,icmpv6: Add decoder
Refactor to use groups between network layers to make them less coupled and reusable:
link_frame (ethernet etc)
inet_packet (ipv4,ipv6 etc)
ip_packet (tcp packet (not stream), udp segment etc)

Rename data to payload as i think it makes more sense for network data
2022-04-03 17:43:51 +02:00
Mattias Wadman
d8aaf30345 rtmp,amf0: Add decoders
Basic RTMP support, used via tcp_stream group (pcap etc) or manually.
Basic AMF0 support, mostly what is used in RTMP.
2022-04-01 13:07:20 +02:00
Mattias Wadman
e8678ca88e interp: Remove opts refactor leftover 2022-03-28 15:37:38 +02:00
Mattias Wadman
74978c9d08 hevc: Add hevc_vps, hevc_sps and hevc_pps decoders
Some extensions and other things still missing
2022-03-24 18:56:56 +01:00
Mattias Wadman
d376520f11 interp: Remove to*range pad argument and fix stdout padding issue
Padding could end up double.
Remove to*range($pad) as it probably just confusing to be able
to pad an existing range, what to show in hexdump etc? zero bits
that do not actuall exist at that range?

Add tests and binary stdout support to tests
2022-03-17 20:15:35 +01:00
Mattias Wadman
9cb4b57a45 interp,cli: Handle ctrl-c properly
Should supress cancel error message
Add CLI ctlr-c/ctrl-d tests and make them more robust
2022-03-15 22:38:12 +01:00
Mattias Wadman
41551de331 interp,repl: Improved eval and output interrupt
repl now rewrites query to do implicit display inside the sub eval.
This makes it possible to interrupt eval and output in a better and faster way.

Make JSON encoder fail early on errors.

Add more interrupt tests.
2022-03-11 16:22:30 +01:00
Mattias Wadman
6f10745aa5 interp: Fix interrupt regression after query rewrite refactor
Also add test for it
2022-03-11 12:41:49 +01:00
Mattias Wadman
dff7e7dadb interp: Cleanup binary regexp overloading and add explode
Add explode for binary that explode into an array of the binary unit tobits
Remove scan_toend as it feels a bit weird and one can use tobytes | .[match(...):] instead
Some general cleanup also
2022-03-09 20:17:12 +01:00
Mattias Wadman
56ae4a0c70 test: Make expect cli test more robust
Wait for prompt before sending ^D. Seems to fix issue with expect on ubuntu focal.

Thanks @KristianKarl for report
2022-03-07 16:22:41 +01:00
Mattias Wadman
eeb59152a6 interp: Make help output less wide 2022-03-03 22:02:33 +01:00
Mattias Wadman
9cb4205b1d repl: Correct error arrow position in color mode 2022-03-03 21:24:03 +01:00
Mattias Wadman
3f50bb90a6 interp: Rework formats and options help
Replace --formats with --help formats
Add --help options
2022-03-03 18:25:20 +01:00
Mattias Wadman
33efb02af0 interp,repl: Add path and value colors to prompt 2022-03-03 18:25:19 +01:00
Mattias Wadman
fe8183b500 interp: Color parse in jq 2022-03-03 17:55:24 +01:00
Mattias Wadman
be6f00935f gojq: Rebase fq fork and add support for non-10 base for tonumber
tonumber now works with non-10 number literals
Fix try precedences changes
Fix .[]? error handling changes
2022-03-02 23:46:20 +01:00
Mattias Wadman
0a043f9096 repl,interp: Refactor repl and slurp
Now repl, slurp and help implemented using same query rewrite.
Include filename context in error if possible.
Add spew function that does opposite of slurp.
Start of help infra, not done or documented yet.
Show error pointer on parse error.
Rename internal eval to _eval and make eval be wrapper that
does rewrite and has various eror handling etc.
Nicer repl, slupr and help errors.
2022-03-01 18:31:00 +01:00
Mattias Wadman
e0f493fa0b
Merge pull request #51 from Akaame/43_macho_support
[WIP] 43: Initial impl for macho support.
2022-02-28 10:22:50 +01:00
Mattias Wadman
f66f115e11 interp: Make _finally handle null, call fin once and last
null value from f did not call fin.
fin was not always called last
Now fin is onyl called once

Might be cause of some weird repl bugs.
2022-02-24 18:39:03 +01:00
Mattias Wadman
03f450f82e interp: Skip redundant includes
Speeds up interp quite a bit.
Also good as i've start to use more includes to make code easier to follow
where thigns come from and also makes jq-lsp happier.

Also rename evalContext to evalInstace to make it less confused with context.
2022-02-24 12:44:26 +01:00
siddik.acil
2021b05408 macho: make actual 2022-02-21 20:32:17 +01:00
siddik.acil
b78ed02fb3 macho: barebones decoder impl 2022-02-21 20:31:12 +01:00
Mattias Wadman
0bc1171914 interp: Move opts eval to options.jq
Also made _main a bit nicer
2022-02-20 21:48:01 +01:00
Mattias Wadman
ca8cdadbe3 repl: Add comments and query from/to helper 2022-02-18 20:59:21 +01:00
Mattias Wadman
e238f292af repl: Speedup multi input to sub-repl
Rewrite non-sub-repl queries as "q" -> ".[] | q" and pass in inputs as array.
Before each input did an eval.

Also fixup error message a bit, skip line:column when they dont make sense.
2022-02-18 01:13:45 +01:00
Mattias Wadman
cd2cbef6fe decode: Some cleanup
Fix PeekFind arg order
2022-02-17 00:25:24 +01:00
Mattias Wadman
9e4f264193 dev: Add .jq-lsp.jq to add additional builtins for jq-lsp
Fixes missing function errors for fq builtins
Add includes to fix some other missing function errors

Add COMPLETION_TIMEOUT env to increase comepletion timeout during test using -race
2022-02-16 19:52:42 +01:00
Mattias Wadman
9dc59e5d39 interp: Move _is_decode_value to jq
Make _extype work like type
2022-02-15 22:20:32 +01:00
Xentripetal
9636613ec6 Merge branch 'master' of https://github.com/wader/fq into avro 2022-02-12 22:16:50 -06:00
Mattias Wadman
b86da7aecc doc: Add inital decoder API documentation 2022-02-12 16:13:29 +01:00
Mattias Wadman
b55ca2cd5d gojq: Rebase fq branch
Add bin,hex,oct bigint number literal tests
2022-02-12 13:03:38 +01:00
Mattias Wadman
af053811cf repl,interp: Make stdio work during completion
Unbreaks completion using options
2022-02-11 20:04:07 +01:00
Mattias Wadman
37d07926c1
Merge pull request #144 from wader/repl-complete-extkeys-without-underscore
repl: Fix completion of non-underscore extkeys
2022-02-11 18:42:36 +01:00
Mattias Wadman
bd9be2c533 repl: Fix completion of non-underscore extkeys
For example .size for binary
2022-02-11 18:30:17 +01:00
Mattias Wadman
48a19cb82c interp: Add paste function to allow pasting text into REPL etc
Also refactor readline and eval args into option struct and partinally start
addressing some side effects during completion.
2022-02-11 17:59:06 +01:00
Mattias Wadman
77ab667bfa interp: Use absolute path in errors
Make it easier to find parse error in init.jq etc
2022-02-11 16:34:20 +01:00