# Copyright (C) 2016, 2017, 2018, 2019, 2020  Stefan Vargyas
# 
# This file is part of Json-Type.
# 
# Json-Type is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Json-Type is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Json-Type.  If not, see <http://www.gnu.org/licenses/>.

#
# json-litex gen def gcc test suite:
#

$ . ~/regtest2.sh
$ alias json-litex-gen-def-gcc-regtest='regtest2-selftest -f test-json-litex-gen-def-gcc.txt -a exec=pipe -B'

# output all test names:
$ json-litex-gen-def-gcc-regtest -N
...

# run all tests:
$ json-litex-gen-def-gcc-regtest -A
...

--[ prereq ]--------------------------------------------------------------------

$ [ -n "$JSON_LITEX_TEST_PCRE2_LIB" ] || JSON_LITEX_TEST_PCRE2_LIB="/usr/local/lib"
$ set -o pipefail
$ json-litex() {  LD_LIBRARY_PATH=../lib:"$JSON_LITEX_TEST_PCRE2_LIB" ../src/json --literal-value -VF -- ../lib/json-litex.so -D "$@"|sed -r $'1i\\\\\\#include "json-litex.h"\n'';s/^#/\\#/;/^\s*\/\//d;/^\s*$/d'|tee >(sed -r '/^static\s+const\s+uchar_t\s+__0\s*\[\s*\]\s*=\s*\{\s*$/{p;i'$'};\n''};/^static\s+const\s+uchar_t\s+__0\s*\[\s*\]\s*=\s*\{\s*$/,/^\}\s*;\s*$/d;/^\s+\.bytes\s*=\s*__0\s*,\s*$/!b;n;/^\s*\.size\s*=\s*[0-9]+\s*$/s/[0-9]+/0/' >&2)|sed -r 's/^\\//'|gcc -Wall -Wextra -std=gnu99 -DJSON_LITEX_MODULE -DUNUSED='__attribute__((unused))' -I ../lib -xc -c - -o /dev/null; }
$

--[ basic ]---------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="$v"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '"`foo`"'
\#include "json-litex.h"
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__2
};
$ json-litex -d '"/foo/"'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__5
};
$ json-litex -d '"'\''foo'\''"'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__5
};
$

--[ basic2 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="{\"bar\":$v}"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '{"bar":"`foo`"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __5[];
static const struct json_litex_node_t __6;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __5 + 0,
    .parent = &__6
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __3(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__2;
    return NULL;
}
static const struct json_litex_object_attr_t __4 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __3
};
static const struct json_litex_object_node_arg_t __5[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__2
    }
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_object_node_type,
    .attr.object = &__4,
    .node.object = {
        .args = __5,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__6
};
$ json-litex -d '{"bar":"/foo/"}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__9
};
$ json-litex -d '{"bar":"'\''foo'\''"}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__9
};
$

--[ basic3 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="{\"bar\":[$v]}"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '{"bar":["`foo`"]}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    },
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__9
};
$ json-litex -d '{"bar":["/foo/"]}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__12
};
$ json-litex -d '{"bar":["'\''foo'\''"]}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__12
};
$

--[ basic4 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[$v]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '["`foo`"]'
\#include "json-litex.h"
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__5
};
$ json-litex -d '["/foo/"]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__8
};
$ json-litex -d '["'\''foo'\''"]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__8
};
$

--[ basic5 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[{\"bar\":$v}]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '[{"bar":"`foo`"}]'
\#include "json-litex.h"
static const struct json_litex_node_t __9;
static const struct json_litex_object_node_arg_t __5[];
static const struct json_litex_node_t __6;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __5 + 0,
    .parent = &__6
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __3(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__2;
    return NULL;
}
static const struct json_litex_object_attr_t __4 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __3
};
static const struct json_litex_object_node_arg_t __5[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__2
    }
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_object_node_type,
    .attr.object = &__4,
    .node.object = {
        .args = __5,
        .size = 1
    },
    .parent = &__9
};
static const struct json_litex_array_attr_t __7 = {
    .object = &__6
};
static const struct json_litex_node_t* __8[] = {
    &__6,
    NULL
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_array_node_type,
    .attr.array = &__7,
    .node.array = {
        .args = __8,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__9
};
$ json-litex -d '[{"bar":"/foo/"}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__12
};
$ json-litex -d '[{"bar":"'\''foo'\''"}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__12
};
$

--[ basic6 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[{\"bar\":[$v]}]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '[{"bar":["`foo`"]}]'
\#include "json-litex.h"
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    },
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__12
};
$ json-litex -d '[{"bar":["/foo/"]}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .parent = &__15
};
static const struct json_litex_array_attr_t __13 = {
    .object = &__12
};
static const struct json_litex_node_t* __14[] = {
    &__12,
    NULL
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_array_node_type,
    .attr.array = &__13,
    .node.array = {
        .args = __14,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__15
};
$ json-litex -d '[{"bar":["'\''foo'\''"]}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .parent = &__15
};
static const struct json_litex_array_attr_t __13 = {
    .object = &__12
};
static const struct json_litex_node_t* __14[] = {
    &__12,
    NULL
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_array_node_type,
    .attr.array = &__13,
    .node.array = {
        .args = __14,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__15
};
$

--[ basic7 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="{\"baz\":{\"bar\":$v}}"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '{"baz":{"bar":"`foo`"}}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __9[];
static const struct json_litex_node_t __10;
static const struct json_litex_object_node_arg_t __5[];
static const struct json_litex_node_t __6;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __5 + 0,
    .parent = &__6
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __3(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__2;
    return NULL;
}
static const struct json_litex_object_attr_t __4 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __3
};
static const struct json_litex_object_node_arg_t __5[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__2
    }
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_object_node_type,
    .attr.object = &__4,
    .node.object = {
        .args = __5,
        .size = 1
    },
    .path = __9 + 0,
    .parent = &__10
};
static const struct json_litex_node_t* __7(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__6;
    return NULL;
}
static const struct json_litex_object_attr_t __8 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __7
};
static const struct json_litex_object_node_arg_t __9[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__6
    }
};
static const struct json_litex_node_t __10 = {
    .type = json_litex_object_node_type,
    .attr.object = &__8,
    .node.object = {
        .args = __9,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__10
};
$ json-litex -d '{"baz":{"bar":"/foo/"}}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__13
};
$ json-litex -d '{"baz":{"bar":"'\''foo'\''"}}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__13
};
$

--[ basic8 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="{\"baz\":{\"bar\":[$v]}}"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '{"baz":{"bar":["`foo`"]}}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    },
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__13
};
$ json-litex -d '{"baz":{"bar":["/foo/"]}}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__16
};
$ json-litex -d '{"baz":{"bar":["'\''foo'\''"]}}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__16
};
$

--[ basic9 ]--------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="{\"baz\":[{\"bar\":$v}]}"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '{"baz":[{"bar":"`foo`"}]}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_node_t __9;
static const struct json_litex_object_node_arg_t __5[];
static const struct json_litex_node_t __6;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __5 + 0,
    .parent = &__6
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __3(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__2;
    return NULL;
}
static const struct json_litex_object_attr_t __4 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __3
};
static const struct json_litex_object_node_arg_t __5[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__2
    }
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_object_node_type,
    .attr.object = &__4,
    .node.object = {
        .args = __5,
        .size = 1
    },
    .parent = &__9
};
static const struct json_litex_array_attr_t __7 = {
    .object = &__6
};
static const struct json_litex_node_t* __8[] = {
    &__6,
    NULL
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_array_node_type,
    .attr.array = &__7,
    .node.array = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__13
};
$ json-litex -d '{"baz":[{"bar":"/foo/"}]}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__16
};
$ json-litex -d '{"baz":[{"bar":"'\''foo'\''"}]}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__16
};
$

--[ basic10 ]-------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="{\"baz\":[{\"bar\":[$v]}]}"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '{"baz":[{"bar":["`foo`"]}]}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    },
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__16
};
$ json-litex -d '{"baz":[{"bar":["/foo/"]}]}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __18[];
static const struct json_litex_node_t __19;
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .parent = &__15
};
static const struct json_litex_array_attr_t __13 = {
    .object = &__12
};
static const struct json_litex_node_t* __14[] = {
    &__12,
    NULL
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_array_node_type,
    .attr.array = &__13,
    .node.array = {
        .args = __14,
        .size = 1
    },
    .path = __18 + 0,
    .parent = &__19
};
static const struct json_litex_node_t* __16(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__15;
    return NULL;
}
static const struct json_litex_object_attr_t __17 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __16
};
static const struct json_litex_object_node_arg_t __18[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__15
    }
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_object_node_type,
    .attr.object = &__17,
    .node.object = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__19
};
$ json-litex -d '{"baz":[{"bar":["'\''foo'\''"]}]}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __18[];
static const struct json_litex_node_t __19;
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .parent = &__15
};
static const struct json_litex_array_attr_t __13 = {
    .object = &__12
};
static const struct json_litex_node_t* __14[] = {
    &__12,
    NULL
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_array_node_type,
    .attr.array = &__13,
    .node.array = {
        .args = __14,
        .size = 1
    },
    .path = __18 + 0,
    .parent = &__19
};
static const struct json_litex_node_t* __16(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__15;
    return NULL;
}
static const struct json_litex_object_attr_t __17 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __16
};
static const struct json_litex_object_node_arg_t __18[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__15
    }
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_object_node_type,
    .attr.object = &__17,
    .node.object = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__19
};
$

--[ basic11 ]-------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[{\"baz\":{\"bar\":$v}}]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '[{"baz":{"bar":"`foo`"}}]'
\#include "json-litex.h"
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __9[];
static const struct json_litex_node_t __10;
static const struct json_litex_object_node_arg_t __5[];
static const struct json_litex_node_t __6;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __5 + 0,
    .parent = &__6
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __3(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__2;
    return NULL;
}
static const struct json_litex_object_attr_t __4 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __3
};
static const struct json_litex_object_node_arg_t __5[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__2
    }
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_object_node_type,
    .attr.object = &__4,
    .node.object = {
        .args = __5,
        .size = 1
    },
    .path = __9 + 0,
    .parent = &__10
};
static const struct json_litex_node_t* __7(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__6;
    return NULL;
}
static const struct json_litex_object_attr_t __8 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __7
};
static const struct json_litex_object_node_arg_t __9[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__6
    }
};
static const struct json_litex_node_t __10 = {
    .type = json_litex_object_node_type,
    .attr.object = &__8,
    .node.object = {
        .args = __9,
        .size = 1
    },
    .parent = &__13
};
static const struct json_litex_array_attr_t __11 = {
    .object = &__10
};
static const struct json_litex_node_t* __12[] = {
    &__10,
    NULL
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_array_node_type,
    .attr.array = &__11,
    .node.array = {
        .args = __12,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__13
};
$ json-litex -d '[{"baz":{"bar":"/foo/"}}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    },
    .parent = &__16
};
static const struct json_litex_array_attr_t __14 = {
    .object = &__13
};
static const struct json_litex_node_t* __15[] = {
    &__13,
    NULL
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_array_node_type,
    .attr.array = &__14,
    .node.array = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__16
};
$ json-litex -d '[{"baz":{"bar":"'\''foo'\''"}}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    },
    .parent = &__16
};
static const struct json_litex_array_attr_t __14 = {
    .object = &__13
};
static const struct json_litex_node_t* __15[] = {
    &__13,
    NULL
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_array_node_type,
    .attr.array = &__14,
    .node.array = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__16
};
$

--[ basic12 ]-------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[{\"baz\":{\"bar\":[$v]}}]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '[{"baz":{"bar":["`foo`"]}}]'
\#include "json-litex.h"
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    },
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    },
    .parent = &__16
};
static const struct json_litex_array_attr_t __14 = {
    .object = &__13
};
static const struct json_litex_node_t* __15[] = {
    &__13,
    NULL
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_array_node_type,
    .attr.array = &__14,
    .node.array = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__16
};
$ json-litex -d '[{"baz":{"bar":["/foo/"]}}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __19;
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    },
    .parent = &__19
};
static const struct json_litex_array_attr_t __17 = {
    .object = &__16
};
static const struct json_litex_node_t* __18[] = {
    &__16,
    NULL
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_array_node_type,
    .attr.array = &__17,
    .node.array = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__19
};
$ json-litex -d '[{"baz":{"bar":["'\''foo'\''"]}}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __19;
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    },
    .parent = &__19
};
static const struct json_litex_array_attr_t __17 = {
    .object = &__16
};
static const struct json_litex_node_t* __18[] = {
    &__16,
    NULL
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_array_node_type,
    .attr.array = &__17,
    .node.array = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__19
};
$

--[ basic13 ]-------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[{\"baz\":[{\"bar\":$v}]}]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '[{"baz":[{"bar":"`foo`"}]}]'
\#include "json-litex.h"
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __12[];
static const struct json_litex_node_t __13;
static const struct json_litex_node_t __9;
static const struct json_litex_object_node_arg_t __5[];
static const struct json_litex_node_t __6;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __5 + 0,
    .parent = &__6
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __3(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__2;
    return NULL;
}
static const struct json_litex_object_attr_t __4 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __3
};
static const struct json_litex_object_node_arg_t __5[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__2
    }
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_object_node_type,
    .attr.object = &__4,
    .node.object = {
        .args = __5,
        .size = 1
    },
    .parent = &__9
};
static const struct json_litex_array_attr_t __7 = {
    .object = &__6
};
static const struct json_litex_node_t* __8[] = {
    &__6,
    NULL
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_array_node_type,
    .attr.array = &__7,
    .node.array = {
        .args = __8,
        .size = 1
    },
    .path = __12 + 0,
    .parent = &__13
};
static const struct json_litex_node_t* __10(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__9;
    return NULL;
}
static const struct json_litex_object_attr_t __11 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __10
};
static const struct json_litex_object_node_arg_t __12[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__9
    }
};
static const struct json_litex_node_t __13 = {
    .type = json_litex_object_node_type,
    .attr.object = &__11,
    .node.object = {
        .args = __12,
        .size = 1
    },
    .parent = &__16
};
static const struct json_litex_array_attr_t __14 = {
    .object = &__13
};
static const struct json_litex_node_t* __15[] = {
    &__13,
    NULL
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_array_node_type,
    .attr.array = &__14,
    .node.array = {
        .args = __15,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__16
};
$ json-litex -d '[{"baz":[{"bar":"/foo/"}]}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __19;
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    },
    .parent = &__19
};
static const struct json_litex_array_attr_t __17 = {
    .object = &__16
};
static const struct json_litex_node_t* __18[] = {
    &__16,
    NULL
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_array_node_type,
    .attr.array = &__17,
    .node.array = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__19
};
$ json-litex -d '[{"baz":[{"bar":"'\''foo'\''"}]}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __19;
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    },
    .parent = &__19
};
static const struct json_litex_array_attr_t __17 = {
    .object = &__16
};
static const struct json_litex_node_t* __18[] = {
    &__16,
    NULL
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_array_node_type,
    .attr.array = &__17,
    .node.array = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__19
};
$

--[ basic14 ]-------------------------------------------------------------------

#
# # meta command:
# $ for v in '"`foo`"' '"/foo/"' '"'\'foo\''"'; do L="[{\"baz\":[{\"bar\":[$v]}]}]"; quote2 L; c="json-litex -d $L"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done
#
$ json-litex -d '[{"baz":[{"bar":["`foo`"]}]}]'
\#include "json-litex.h"
static const struct json_litex_node_t __19;
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_node_t __12;
static const struct json_litex_object_node_arg_t __8[];
static const struct json_litex_node_t __9;
static const struct json_litex_node_t __5;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .parent = &__5
};
static const struct json_litex_array_attr_t __3 = {
    .string = &__2
};
static const struct json_litex_node_t* __4[] = {
    &__2,
    NULL
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_array_node_type,
    .attr.array = &__3,
    .node.array = {
        .args = __4,
        .size = 1
    },
    .path = __8 + 0,
    .parent = &__9
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __6(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__5;
    return NULL;
}
static const struct json_litex_object_attr_t __7 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __6
};
static const struct json_litex_object_node_arg_t __8[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__5
    }
};
static const struct json_litex_node_t __9 = {
    .type = json_litex_object_node_type,
    .attr.object = &__7,
    .node.object = {
        .args = __8,
        .size = 1
    },
    .parent = &__12
};
static const struct json_litex_array_attr_t __10 = {
    .object = &__9
};
static const struct json_litex_node_t* __11[] = {
    &__9,
    NULL
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_array_node_type,
    .attr.array = &__10,
    .node.array = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    },
    .parent = &__19
};
static const struct json_litex_array_attr_t __17 = {
    .object = &__16
};
static const struct json_litex_node_t* __18[] = {
    &__16,
    NULL
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_array_node_type,
    .attr.array = &__17,
    .node.array = {
        .args = __18,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__19
};
$ json-litex -d '[{"baz":[{"bar":["/foo/"]}]}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __22;
static const struct json_litex_object_node_arg_t __18[];
static const struct json_litex_node_t __19;
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .parent = &__15
};
static const struct json_litex_array_attr_t __13 = {
    .object = &__12
};
static const struct json_litex_node_t* __14[] = {
    &__12,
    NULL
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_array_node_type,
    .attr.array = &__13,
    .node.array = {
        .args = __14,
        .size = 1
    },
    .path = __18 + 0,
    .parent = &__19
};
static const struct json_litex_node_t* __16(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__15;
    return NULL;
}
static const struct json_litex_object_attr_t __17 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __16
};
static const struct json_litex_object_node_arg_t __18[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__15
    }
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_object_node_type,
    .attr.object = &__17,
    .node.object = {
        .args = __18,
        .size = 1
    },
    .parent = &__22
};
static const struct json_litex_array_attr_t __20 = {
    .object = &__19
};
static const struct json_litex_node_t* __21[] = {
    &__19,
    NULL
};
static const struct json_litex_node_t __22 = {
    .type = json_litex_array_node_type,
    .attr.array = &__20,
    .node.array = {
        .args = __21,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__22
};
$ json-litex -d '[{"baz":[{"bar":["'\''foo'\''"]}]}]'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_node_t __22;
static const struct json_litex_object_node_arg_t __18[];
static const struct json_litex_node_t __19;
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_node_t __8;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "'foo'"
    },
    .attr.string = &__4,
    .parent = &__8
};
static const struct json_litex_array_attr_t __6 = {
    .string = &__5
};
static const struct json_litex_node_t* __7[] = {
    &__5,
    NULL
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_array_node_type,
    .attr.array = &__6,
    .node.array = {
        .args = __7,
        .size = 1
    },
    .path = __11 + 0,
    .parent = &__12
};
static inline bool equal(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == *q;
}
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "bar"))
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .parent = &__15
};
static const struct json_litex_array_attr_t __13 = {
    .object = &__12
};
static const struct json_litex_node_t* __14[] = {
    &__12,
    NULL
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_array_node_type,
    .attr.array = &__13,
    .node.array = {
        .args = __14,
        .size = 1
    },
    .path = __18 + 0,
    .parent = &__19
};
static const struct json_litex_node_t* __16(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (equal(p, "baz"))
        return &__15;
    return NULL;
}
static const struct json_litex_object_attr_t __17 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __16
};
static const struct json_litex_object_node_arg_t __18[] = {
    {
        .key = {
            .val = (const uchar_t*) "baz"
        },
        .val = &__15
    }
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_object_node_type,
    .attr.object = &__17,
    .node.object = {
        .args = __18,
        .size = 1
    },
    .parent = &__22
};
static const struct json_litex_array_attr_t __20 = {
    .object = &__19
};
static const struct json_litex_node_t* __21[] = {
    &__19,
    NULL
};
static const struct json_litex_node_t __22 = {
    .type = json_litex_array_node_type,
    .attr.array = &__20,
    .node.array = {
        .args = __21,
        .size = 1
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__22
};
$

--[ expr-dup ]------------------------------------------------------------------

#
# # meta command:
# $ for v in 'date(long_iso)' 'int(8)' 'date(`%Y`)' '#`foo`' '#/foo/' '`foo`' '/foo/' 'null||string' 'null&&string' 'str&&len' 'len>0' '!len'; do for l in '{"bar1":"%s","bar2":"%s"}'; do printf -v L "$l" "$v" "$v"; c="json-litex -d '$L'"; echo "$ $c"; eval "$c 2>&1" || echo "command failed: $c"; done; done
#
$ json-litex -d '{"bar1":"date(long_iso)","bar2":"date(long_iso)"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    const_id(long_iso),
    call_builtin(date)
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 2
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "date(long_iso)"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "date(long_iso)"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"int(8)","bar2":"int(8)"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    const_num(8),
    call_builtin(int)
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 2
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "int(8)"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "int(8)"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"date(`%Y`)","bar2":"date(`%Y`)"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    const_str("%Y"),
    call_builtin(date)
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 2
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "date(`%Y`)"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "date(`%Y`)"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"#`foo`","bar2":"#`foo`"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    count_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "#`foo`"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "#`foo`"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"#/foo/","bar2":"#/foo/"}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __9[];
static const struct json_litex_node_t __10;
static const struct json_litex_expr_node_t __3[] = {
    count_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "#/foo/"
    },
    .attr.string = &__4,
    .path = __9 + 0,
    .parent = &__10
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "#/foo/"
    },
    .attr.string = &__4,
    .path = __9 + 1,
    .parent = &__10
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __7(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__5;
            return NULL;
        case '2':
            if (*p == 0)
                return &__6;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __8 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __7
};
static const struct json_litex_object_node_arg_t __9[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__5
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__6
    }
};
static const struct json_litex_node_t __10 = {
    .type = json_litex_object_node_type,
    .attr.object = &__8,
    .node.object = {
        .args = __9,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__10
};
$ json-litex -d '{"bar1":"`foo`","bar2":"`foo`"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    match_str("foo")
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 1
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "`foo`"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"/foo/","bar2":"/foo/"}'
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "foo"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 1
};
static const struct json_litex_object_node_arg_t __9[];
static const struct json_litex_node_t __10;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 1
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __9 + 0,
    .parent = &__10
};
static const struct json_litex_node_t __6 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/foo/"
    },
    .attr.string = &__4,
    .path = __9 + 1,
    .parent = &__10
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __7(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__5;
            return NULL;
        case '2':
            if (*p == 0)
                return &__6;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __8 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __7
};
static const struct json_litex_object_node_arg_t __9[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__5
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__6
    }
};
static const struct json_litex_node_t __10 = {
    .type = json_litex_object_node_type,
    .attr.object = &__8,
    .node.object = {
        .args = __9,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__10
};
$ json-litex -d '{"bar1":"null||string","bar2":"null||string"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    call_builtin(null),
    jump_true(2, false),
    call_builtin(string)
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 3
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null||string"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null||string"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"null&&string","bar2":"null&&string"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    call_builtin(null),
    jump_false(2, false),
    call_builtin(string)
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 3
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null&&string"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null&&string"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"str&&len","bar2":"str&&len"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    call_builtin(string),
    jump_false(3, false),
    call_builtin(len),
    make_bool()
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 4
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "str&&len"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "str&&len"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"len>0","bar2":"len>0"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    call_builtin(len),
    const_num(0),
    cmp_op(gt)
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 3
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "len>0"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "len>0"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$ json-litex -d '{"bar1":"!len","bar2":"!len"}'
\#include "json-litex.h"
static const struct json_litex_object_node_arg_t __6[];
static const struct json_litex_node_t __7;
static const struct json_litex_expr_node_t __0[] = {
    call_builtin(len),
    not_op()
};
static const struct json_litex_expr_def_t __1 = {
    .nodes = __0,
    .size = 2
};
static const struct json_litex_node_t __2 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "!len"
    },
    .attr.string = &__1,
    .path = __6 + 0,
    .parent = &__7
};
static const struct json_litex_node_t __3 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "!len"
    },
    .attr.string = &__1,
    .path = __6 + 1,
    .parent = &__7
};
static inline bool prefix(
    const char* p, const char* q)
{
    while (*p && *p == *q)
         ++ p, ++ q;
    return *p == 0;
}
static const struct json_litex_node_t* __4(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (prefix("bar", p)) {
        p += 3;
        switch (*p ++) {
        case '1':
            if (*p == 0)
                return &__2;
            return NULL;
        case '2':
            if (*p == 0)
                return &__3;
        }
    }
    return NULL;
}
static const struct json_litex_object_attr_t __5 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __4
};
static const struct json_litex_object_node_arg_t __6[] = {
    {
        .key = {
            .val = (const uchar_t*) "bar1"
        },
        .val = &__2
    },
    {
        .key = {
            .val = (const uchar_t*) "bar2"
        },
        .val = &__3
    }
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_object_node_type,
    .attr.object = &__5,
    .node.object = {
        .args = __6,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .node = &__7
};
$

--[ text-litex-lib ]------------------------------------------------------------

$ json-litex ../lib/test-litex.json
\#include "json-litex.h"
\#if 0
enum {
  I = SZ(1) << json_litex_expr_rex_opt_ignore_case,
  S = SZ(1) << json_litex_expr_rex_opt_dot_match_all,
  U = SZ(1) << json_litex_expr_rex_opt_no_utf8_check,
  X = SZ(1) << json_litex_expr_rex_opt_extended_pat,
};
\#endif
static const uchar_t __0[] = {
};
\#if 0
static const struct json_litex_expr_rex_t __1[] = {
    {
        .text = (const uchar_t*) "^[[:ascii:]]*$"
    },
    {
        .text = (const uchar_t*) "^x+y+$"
    }
};
\#endif
static const struct json_litex_expr_rex_def_t __2 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
\#if 0
    .elems = __1,
\#endif
    .size = 2
};
static const struct json_litex_object_node_arg_t __33[];
static const struct json_litex_node_t __34;
static const struct json_litex_object_node_arg_t __22[];
static const struct json_litex_node_t __23;
static const struct json_litex_node_t __19;
static const struct json_litex_expr_node_t __3[] = {
    match_rex(0),
    jump_false(4, false),
    const_num(1),
    count_str("\n"),
    cmp_op(ge)
};
static const struct json_litex_expr_def_t __4 = {
    .nodes = __3,
    .size = 5
};
static const struct json_litex_node_t __5 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/^[[:ascii:]]*$/ && #`\n` <= 1"
    },
    .attr.string = &__4,
    .parent = &__19
};
static const struct json_litex_object_node_arg_t __15[];
static const struct json_litex_node_t __16;
static const struct json_litex_object_node_arg_t __11[];
static const struct json_litex_node_t __12;
static const struct json_litex_expr_node_t __6[] = {
    call_builtin(null),
    jump_true(6, false),
    match_rex(1),
    jump_false(4, false),
    count_str("x"),
    count_str("y"),
    cmp_op(lt)
};
static const struct json_litex_expr_def_t __7 = {
    .nodes = __6,
    .size = 7
};
static const struct json_litex_node_t __8 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null || /^x+y+$/ && #`x` < #`y`"
    },
    .attr.string = &__7,
    .path = __11 + 0,
    .parent = &__12
};
static const struct json_litex_node_t* __9(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'd' &&
        *p == 0)
        return &__8;
    return NULL;
}
static const struct json_litex_object_attr_t __10 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __9
};
static const struct json_litex_object_node_arg_t __11[] = {
    {
        .key = {
            .val = (const uchar_t*) "d"
        },
        .val = &__8
    }
};
static const struct json_litex_node_t __12 = {
    .type = json_litex_object_node_type,
    .attr.object = &__10,
    .node.object = {
        .args = __11,
        .size = 1
    },
    .path = __15 + 0,
    .parent = &__16
};
static const struct json_litex_node_t* __13(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'c' &&
        *p == 0)
        return &__12;
    return NULL;
}
static const struct json_litex_object_attr_t __14 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __13
};
static const struct json_litex_object_node_arg_t __15[] = {
    {
        .key = {
            .val = (const uchar_t*) "c"
        },
        .val = &__12
    }
};
static const struct json_litex_node_t __16 = {
    .type = json_litex_object_node_type,
    .attr.object = &__14,
    .node.object = {
        .args = __15,
        .size = 1
    },
    .parent = &__19
};
static const struct json_litex_array_attr_t __17 = {
    .string = &__5,
    .object = &__16
};
static const struct json_litex_node_t* __18[] = {
    &__5,
    &__16,
    NULL
};
static const struct json_litex_node_t __19 = {
    .type = json_litex_array_node_type,
    .attr.array = &__17,
    .node.array = {
        .args = __18,
        .size = 2
    },
    .path = __22 + 0,
    .parent = &__23
};
static const struct json_litex_node_t* __20(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'b' &&
        *p == 0)
        return &__19;
    return NULL;
}
static const struct json_litex_object_attr_t __21 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __20
};
static const struct json_litex_object_node_arg_t __22[] = {
    {
        .key = {
            .val = (const uchar_t*) "b"
        },
        .val = &__19
    }
};
static const struct json_litex_node_t __23 = {
    .type = json_litex_object_node_type,
    .attr.object = &__21,
    .node.object = {
        .args = __22,
        .size = 1
    },
    .path = __33 + 0,
    .parent = &__34
};
static const struct json_litex_object_node_arg_t __29[];
static const struct json_litex_node_t __30;
static const struct json_litex_expr_node_t __24[] = {
    call_builtin(null),
    jump_true(3, false),
    const_str("%Y-%m-%d"),
    call_builtin(date)
};
static const struct json_litex_expr_def_t __25 = {
    .nodes = __24,
    .size = 4
};
static const struct json_litex_node_t __26 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null || date(`%Y-%m-%d`)"
    },
    .attr.string = &__25,
    .path = __29 + 0,
    .parent = &__30
};
static const struct json_litex_node_t* __27(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'd' &&
        *p == 0)
        return &__26;
    return NULL;
}
static const struct json_litex_object_attr_t __28 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __27
};
static const struct json_litex_object_node_arg_t __29[] = {
    {
        .key = {
            .val = (const uchar_t*) "d"
        },
        .val = &__26
    }
};
static const struct json_litex_node_t __30 = {
    .type = json_litex_object_node_type,
    .attr.object = &__28,
    .node.object = {
        .args = __29,
        .size = 1
    },
    .path = __33 + 1,
    .parent = &__34
};
static const struct json_litex_node_t* __31(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    switch (*p ++) {
    case 'a':
        if (*p == 0)
            return &__23;
        return NULL;
    case 'c':
        if (*p == 0)
            return &__30;
    }
    return NULL;
}
static const struct json_litex_object_attr_t __32 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __31
};
static const struct json_litex_object_node_arg_t __33[] = {
    {
        .key = {
            .val = (const uchar_t*) "a"
        },
        .val = &__23
    },
    {
        .key = {
            .val = (const uchar_t*) "c"
        },
        .val = &__30
    }
};
static const struct json_litex_node_t __34 = {
    .type = json_litex_object_node_type,
    .attr.object = &__32,
    .node.object = {
        .args = __33,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__2,
    .node = &__34
};
$

--[ sobj-litex-lib ]------------------------------------------------------------

$ json-litex ../lib/test-litex.so
\#include "json-litex.h"
static const uchar_t __0[] = {
};
static const struct json_litex_expr_rex_def_t __1 = {
    .codes = {
        .type = json_litex_expr_rex_codes_streams,
        .code.streams = {
            .bytes = __0,
            .size = 0
        }
    },
    .size = 2
};
static const struct json_litex_object_node_arg_t __32[];
static const struct json_litex_node_t __33;
static const struct json_litex_object_node_arg_t __21[];
static const struct json_litex_node_t __22;
static const struct json_litex_node_t __18;
static const struct json_litex_expr_node_t __2[] = {
    match_rex(0),
    jump_false(4, false),
    const_num(1),
    count_str("\n"),
    cmp_op(ge)
};
static const struct json_litex_expr_def_t __3 = {
    .nodes = __2,
    .size = 5
};
static const struct json_litex_node_t __4 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "/^[[:ascii:]]*$/ && #`\n` <= 1"
    },
    .attr.string = &__3,
    .parent = &__18
};
static const struct json_litex_object_node_arg_t __14[];
static const struct json_litex_node_t __15;
static const struct json_litex_object_node_arg_t __10[];
static const struct json_litex_node_t __11;
static const struct json_litex_expr_node_t __5[] = {
    call_builtin(null),
    jump_true(6, false),
    match_rex(1),
    jump_false(4, false),
    count_str("x"),
    count_str("y"),
    cmp_op(lt)
};
static const struct json_litex_expr_def_t __6 = {
    .nodes = __5,
    .size = 7
};
static const struct json_litex_node_t __7 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null || /^x+y+$/ && #`x` < #`y`"
    },
    .attr.string = &__6,
    .path = __10 + 0,
    .parent = &__11
};
static const struct json_litex_node_t* __8(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'd' &&
        *p == 0)
        return &__7;
    return NULL;
}
static const struct json_litex_object_attr_t __9 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __8
};
static const struct json_litex_object_node_arg_t __10[] = {
    {
        .key = {
            .val = (const uchar_t*) "d"
        },
        .val = &__7
    }
};
static const struct json_litex_node_t __11 = {
    .type = json_litex_object_node_type,
    .attr.object = &__9,
    .node.object = {
        .args = __10,
        .size = 1
    },
    .path = __14 + 0,
    .parent = &__15
};
static const struct json_litex_node_t* __12(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'c' &&
        *p == 0)
        return &__11;
    return NULL;
}
static const struct json_litex_object_attr_t __13 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __12
};
static const struct json_litex_object_node_arg_t __14[] = {
    {
        .key = {
            .val = (const uchar_t*) "c"
        },
        .val = &__11
    }
};
static const struct json_litex_node_t __15 = {
    .type = json_litex_object_node_type,
    .attr.object = &__13,
    .node.object = {
        .args = __14,
        .size = 1
    },
    .parent = &__18
};
static const struct json_litex_array_attr_t __16 = {
    .string = &__4,
    .object = &__15
};
static const struct json_litex_node_t* __17[] = {
    &__4,
    &__15,
    NULL
};
static const struct json_litex_node_t __18 = {
    .type = json_litex_array_node_type,
    .attr.array = &__16,
    .node.array = {
        .args = __17,
        .size = 2
    },
    .path = __21 + 0,
    .parent = &__22
};
static const struct json_litex_node_t* __19(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'b' &&
        *p == 0)
        return &__18;
    return NULL;
}
static const struct json_litex_object_attr_t __20 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __19
};
static const struct json_litex_object_node_arg_t __21[] = {
    {
        .key = {
            .val = (const uchar_t*) "b"
        },
        .val = &__18
    }
};
static const struct json_litex_node_t __22 = {
    .type = json_litex_object_node_type,
    .attr.object = &__20,
    .node.object = {
        .args = __21,
        .size = 1
    },
    .path = __32 + 0,
    .parent = &__33
};
static const struct json_litex_object_node_arg_t __28[];
static const struct json_litex_node_t __29;
static const struct json_litex_expr_node_t __23[] = {
    call_builtin(null),
    jump_true(3, false),
    const_str("%Y-%m-%d"),
    call_builtin(date)
};
static const struct json_litex_expr_def_t __24 = {
    .nodes = __23,
    .size = 4
};
static const struct json_litex_node_t __25 = {
    .type = json_litex_string_node_type,
    .node.string = {
        .val = (const uchar_t*) "null || date(`%Y-%m-%d`)"
    },
    .attr.string = &__24,
    .path = __28 + 0,
    .parent = &__29
};
static const struct json_litex_node_t* __26(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    if (*p ++ == 'd' &&
        *p == 0)
        return &__25;
    return NULL;
}
static const struct json_litex_object_attr_t __27 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __26
};
static const struct json_litex_object_node_arg_t __28[] = {
    {
        .key = {
            .val = (const uchar_t*) "d"
        },
        .val = &__25
    }
};
static const struct json_litex_node_t __29 = {
    .type = json_litex_object_node_type,
    .attr.object = &__27,
    .node.object = {
        .args = __28,
        .size = 1
    },
    .path = __32 + 1,
    .parent = &__33
};
static const struct json_litex_node_t* __30(
    const struct json_litex_trie_node_t* n UNUSED,
    const char* p)
{
    switch (*p ++) {
    case 'a':
        if (*p == 0)
            return &__22;
        return NULL;
    case 'c':
        if (*p == 0)
            return &__29;
    }
    return NULL;
}
static const struct json_litex_object_attr_t __31 = {
    .lookup = (json_litex_object_attr_lookup_func_t) __30
};
static const struct json_litex_object_node_arg_t __32[] = {
    {
        .key = {
            .val = (const uchar_t*) "a"
        },
        .val = &__22
    },
    {
        .key = {
            .val = (const uchar_t*) "c"
        },
        .val = &__29
    }
};
static const struct json_litex_node_t __33 = {
    .type = json_litex_object_node_type,
    .attr.object = &__31,
    .node.object = {
        .args = __32,
        .size = 2
    }
};
static const struct json_litex_def_t MODULE_LITEX_DEF = {
    .rexes = &__1,
    .node = &__33
};
$


