mirror of
https://github.com/wader/fq.git
synced 2024-11-27 14:14:58 +03:00
0a043f9096
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.
25 lines
458 B
Plaintext
25 lines
458 B
Plaintext
include "assert";
|
|
include "query";
|
|
|
|
(
|
|
([
|
|
["", "."],
|
|
[".", "."],
|
|
["a", "a"],
|
|
["1, 2", "1, 2"],
|
|
["1 | 2", "2"],
|
|
["1 | 2 | 3", "3"],
|
|
["(1 | 2) | 3", "3"],
|
|
["1 | (2 | 3)", "(2 | 3)"],
|
|
["1 as $_ | 2", "2"],
|
|
["def f: 1; 1", "def f: 1; 1"],
|
|
["def f: 1; 1 | 2", "2"],
|
|
empty
|
|
][] | assert(
|
|
"\(.) | _query_pipe_last";
|
|
.[1];
|
|
.[0] | _query_fromstring | _query_pipe_last | _query_tostring
|
|
)
|
|
)
|
|
)
|