Find deep nesting
Find deep nesting
Find the tokens sitting deepest inside paired brackets, in code or in data, and read how deep an input nests (stress).
$ cat deep.json
{"a": {"b": {"c": {"d": 1}}}, "e": 2}
The tokens past a depth
@nested>=4 holds on a token inside at least four paired brackets:
$ trex scan '@nested>=4 .' deep.json
[19..22] "\"d\""
[22..23] ":"
[24..25] "1"
An unpaired bracket is a character of the text and opens no level.
How deep an input goes
$ trex stress --text 'f(g(h(x))) and y(z)'
trex stress: 19 bytes, 15 tokens, max depth 3, 2 peak(s), 1 fracture(s)
peak load: 10 (depth 2, strain 4)
--peaks lists where the depth peaks and --fractures where it starts to fall.