2022-01-09 08:12:46 -06:00
|
|
|
const QUERY = [
|
2022-03-20 09:03:17 -05:00
|
|
|
'<P>',
|
|
|
|
'-> <P>',
|
2022-03-28 09:14:00 -05:00
|
|
|
'a<"P">',
|
2022-01-09 08:12:46 -06:00
|
|
|
'"P" "P"',
|
|
|
|
'P "P"',
|
|
|
|
'"p" p',
|
|
|
|
'"const": p',
|
2022-03-28 09:14:00 -05:00
|
|
|
"a<:a>",
|
|
|
|
"a<::a>",
|
2022-01-09 08:12:46 -06:00
|
|
|
"((a))",
|
|
|
|
"(p -> p",
|
|
|
|
"::a::b",
|
|
|
|
"a::::b",
|
|
|
|
"a::b::",
|
|
|
|
":a",
|
|
|
|
"a b:",
|
|
|
|
"a (b:",
|
2022-03-23 11:26:32 -05:00
|
|
|
"_:",
|
2023-02-28 19:17:59 -06:00
|
|
|
"_:a",
|
2022-03-20 09:03:17 -05:00
|
|
|
"a-bb",
|
|
|
|
"a>bb",
|
2022-03-23 11:26:32 -05:00
|
|
|
"ab'",
|
2022-03-28 08:08:47 -05:00
|
|
|
"a->",
|
2022-03-28 09:14:00 -05:00
|
|
|
'"p" <a>',
|
|
|
|
'"p" a<a>',
|
|
|
|
"a,<",
|
|
|
|
"aaaaa<>b",
|
|
|
|
"fn:aaaaa<>b",
|
|
|
|
"->a<>b",
|
2022-03-30 04:32:03 -05:00
|
|
|
"a<->",
|
2022-04-08 07:35:45 -05:00
|
|
|
"a:: a",
|
|
|
|
"a ::a",
|
2022-04-17 05:05:31 -05:00
|
|
|
"a<a>:",
|
|
|
|
"a<>:",
|
|
|
|
"a,:",
|
|
|
|
" a<> :",
|
2022-04-18 16:11:42 -05:00
|
|
|
"mod : :",
|
2022-04-26 06:58:43 -05:00
|
|
|
"a!a",
|
|
|
|
"a!!",
|
2023-02-16 16:32:38 -06:00
|
|
|
"mod:a!",
|
|
|
|
"a!::a",
|
2023-03-02 07:28:15 -06:00
|
|
|
"a<",
|
2022-01-09 08:12:46 -06:00
|
|
|
];
|
2021-12-20 10:45:52 -06:00
|
|
|
|
|
|
|
const PARSED = [
|
2022-03-20 09:03:17 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "<P>",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "<p>",
|
|
|
|
error: "Found generics without a path",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "-> <P>",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "-> <p>",
|
|
|
|
error: "Found generics without a path",
|
|
|
|
},
|
2021-12-20 10:45:52 -06:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
2022-03-28 09:14:00 -05:00
|
|
|
original: "a<\"P\">",
|
2021-12-20 10:45:52 -06:00
|
|
|
returned: [],
|
2022-03-28 09:14:00 -05:00
|
|
|
userQuery: "a<\"p\">",
|
2023-02-28 15:54:09 -06:00
|
|
|
error: "Unexpected `\"` in generics",
|
2021-12-20 10:45:52 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "\"P\" \"P\"",
|
|
|
|
returned: [],
|
2022-01-03 09:43:30 -06:00
|
|
|
userQuery: "\"p\" \"p\"",
|
2021-12-20 10:45:52 -06:00
|
|
|
error: "Cannot have more than one literal search element",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "P \"P\"",
|
|
|
|
returned: [],
|
2022-01-03 09:43:30 -06:00
|
|
|
userQuery: "p \"p\"",
|
2021-12-20 10:45:52 -06:00
|
|
|
error: "Cannot use literal search when there is more than one element",
|
|
|
|
},
|
2022-01-03 16:51:20 -06:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "\"p\" p",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "\"p\" p",
|
|
|
|
error: "You cannot have more than one element if you use quotes",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "\"const\": p",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "\"const\": p",
|
|
|
|
error: "You cannot use quotes on type filter",
|
|
|
|
},
|
2022-01-09 08:12:46 -06:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
2022-03-28 09:14:00 -05:00
|
|
|
original: "a<:a>",
|
2022-01-09 08:12:46 -06:00
|
|
|
returned: [],
|
2022-03-28 09:14:00 -05:00
|
|
|
userQuery: "a<:a>",
|
2023-02-28 19:17:59 -06:00
|
|
|
error: "Expected type filter before `:`",
|
2022-01-09 08:12:46 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
2022-03-28 09:14:00 -05:00
|
|
|
original: "a<::a>",
|
2022-01-09 08:12:46 -06:00
|
|
|
returned: [],
|
2022-03-28 09:14:00 -05:00
|
|
|
userQuery: "a<::a>",
|
2022-01-09 08:12:46 -06:00
|
|
|
error: "Unexpected `::`: paths cannot start with `::`",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "((a))",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "((a))",
|
2022-02-09 13:56:37 -06:00
|
|
|
error: "Unexpected `(`",
|
2022-01-09 08:12:46 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "(p -> p",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "(p -> p",
|
2022-02-09 13:56:37 -06:00
|
|
|
error: "Unexpected `(`",
|
2022-01-09 08:12:46 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "::a::b",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "::a::b",
|
|
|
|
error: "Paths cannot start with `::`",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a::::b",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a::::b",
|
|
|
|
error: "Unexpected `::::`",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a::b::",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a::b::",
|
|
|
|
error: "Paths cannot end with `::`",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: ":a",
|
|
|
|
returned: [],
|
|
|
|
userQuery: ":a",
|
|
|
|
error: "Expected type filter before `:`",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a b:",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a b:",
|
2023-02-28 19:17:59 -06:00
|
|
|
error: "Unexpected `:` (expected path after type filter)",
|
2022-01-09 08:12:46 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a (b:",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a (b:",
|
2022-02-09 13:56:37 -06:00
|
|
|
error: "Unexpected `(`",
|
2022-01-09 08:12:46 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
2022-03-23 11:26:32 -05:00
|
|
|
original: "_:",
|
2022-01-09 08:12:46 -06:00
|
|
|
returned: [],
|
2022-03-23 11:26:32 -05:00
|
|
|
userQuery: "_:",
|
2023-02-28 19:17:59 -06:00
|
|
|
error: "Unexpected `:` (expected path after type filter)",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "_:a",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "_:a",
|
2022-03-23 11:26:32 -05:00
|
|
|
error: "Unknown type filter `_`",
|
2022-01-09 08:12:46 -06:00
|
|
|
},
|
2022-03-20 09:03:17 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a-bb",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a-bb",
|
|
|
|
error: "Unexpected `-` (did you mean `->`?)",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a>bb",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a>bb",
|
|
|
|
error: "Unexpected `>` (did you mean `->`?)",
|
|
|
|
},
|
2022-03-23 11:26:32 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "ab'",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "ab'",
|
|
|
|
error: "Unexpected `'`",
|
|
|
|
},
|
2022-03-28 08:08:47 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a->",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a->",
|
|
|
|
error: "Expected at least one item after `->`",
|
|
|
|
},
|
2022-03-28 09:14:00 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: '"p" <a>',
|
|
|
|
returned: [],
|
|
|
|
userQuery: '"p" <a>',
|
|
|
|
error: "Found generics without a path",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: '"p" a<a>',
|
|
|
|
returned: [],
|
|
|
|
userQuery: '"p" a<a>',
|
|
|
|
error: "You cannot have more than one element if you use quotes",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: 'a,<',
|
|
|
|
returned: [],
|
|
|
|
userQuery: 'a,<',
|
|
|
|
error: 'Found generics without a path',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: 'aaaaa<>b',
|
|
|
|
returned: [],
|
|
|
|
userQuery: 'aaaaa<>b',
|
|
|
|
error: 'Expected `,`, ` `, `:` or `->`, found `b`',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: 'fn:aaaaa<>b',
|
|
|
|
returned: [],
|
|
|
|
userQuery: 'fn:aaaaa<>b',
|
2023-02-28 19:17:59 -06:00
|
|
|
error: 'Expected `,`, ` `, `:` or `->`, found `b`',
|
2022-03-28 09:14:00 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: '->a<>b',
|
|
|
|
returned: [],
|
|
|
|
userQuery: '->a<>b',
|
|
|
|
error: 'Expected `,` or ` `, found `b`',
|
|
|
|
},
|
2022-03-30 04:32:03 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: 'a<->',
|
|
|
|
returned: [],
|
|
|
|
userQuery: 'a<->',
|
|
|
|
error: 'Unexpected `-` after `<`',
|
|
|
|
},
|
2022-04-08 07:35:45 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: 'a:: a',
|
|
|
|
returned: [],
|
|
|
|
userQuery: 'a:: a',
|
|
|
|
error: 'Paths cannot end with `::`',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: 'a ::a',
|
|
|
|
returned: [],
|
|
|
|
userQuery: 'a ::a',
|
|
|
|
error: 'Paths cannot start with `::`',
|
|
|
|
},
|
2022-04-17 05:05:31 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a<a>:",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a<a>:",
|
2023-02-28 19:17:59 -06:00
|
|
|
error: 'Unexpected `<` in type filter',
|
2022-04-17 05:05:31 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a<>:",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a<>:",
|
|
|
|
error: 'Unexpected `<` in type filter',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a,:",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a,:",
|
|
|
|
error: 'Unexpected `,` in type filter',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a<> :",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a<> :",
|
|
|
|
error: 'Unexpected `<` in type filter',
|
|
|
|
},
|
2022-04-18 16:11:42 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "mod : :",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "mod : :",
|
|
|
|
error: 'Unexpected `:`',
|
|
|
|
},
|
2022-04-26 06:58:43 -05:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a!a",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a!a",
|
2023-02-28 15:54:09 -06:00
|
|
|
error: 'Unexpected `!`: it can only be at the end of an ident',
|
2022-04-26 06:58:43 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a!!",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a!!",
|
|
|
|
error: 'Cannot have more than one `!` in an ident',
|
|
|
|
},
|
2023-02-16 16:32:38 -06:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "mod:a!",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "mod:a!",
|
|
|
|
error: 'Invalid search type: macro `!` and `mod` both specified',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a!::a",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a!::a",
|
|
|
|
error: 'Cannot have associated items in macros',
|
|
|
|
},
|
2023-03-02 07:28:15 -06:00
|
|
|
{
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
original: "a<",
|
|
|
|
returned: [],
|
|
|
|
userQuery: "a<",
|
|
|
|
error: "Unclosed `<`",
|
|
|
|
},
|
2021-12-20 10:45:52 -06:00
|
|
|
];
|