rustdoc-search: add parser for &
syntax
This commit is contained in:
parent
8b47f67817
commit
3c4e180e68
3 changed files with 659 additions and 0 deletions
527
tests/rustdoc-js-std/parser-reference.js
Normal file
527
tests/rustdoc-js-std/parser-reference.js
Normal file
|
@ -0,0 +1,527 @@
|
|||
const PARSED = [
|
||||
{
|
||||
query: '&[',
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '&[',
|
||||
returned: [],
|
||||
userQuery: '&[',
|
||||
error: 'Unclosed `[`',
|
||||
},
|
||||
{
|
||||
query: '[&',
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '[&',
|
||||
returned: [],
|
||||
userQuery: '[&',
|
||||
error: 'Unclosed `[`',
|
||||
},
|
||||
{
|
||||
query: '&&&D, []',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "d",
|
||||
fullPath: ["d"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "d",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
{
|
||||
name: "[]",
|
||||
fullPath: ["[]"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "[]",
|
||||
generics: [],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: '&&&D, []',
|
||||
returned: [],
|
||||
userQuery: '&&&d, []',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&&&[D]',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "[]",
|
||||
fullPath: ["[]"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "[]",
|
||||
generics: [
|
||||
{
|
||||
name: "d",
|
||||
fullPath: ["d"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "d",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: '&&&[D]',
|
||||
returned: [],
|
||||
userQuery: '&&&[d]',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: '&',
|
||||
returned: [],
|
||||
userQuery: '&',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&mut',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "mut",
|
||||
fullPath: ["mut"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "mut",
|
||||
generics: [],
|
||||
typeFilter: 0,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: '&mut',
|
||||
returned: [],
|
||||
userQuery: '&mut',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&,u8',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [],
|
||||
typeFilter: 1,
|
||||
},
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "&,u8",
|
||||
returned: [],
|
||||
userQuery: "&,u8",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&mut,u8',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "mut",
|
||||
fullPath: ["mut"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "mut",
|
||||
generics: [],
|
||||
typeFilter: 0,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "&mut,u8",
|
||||
returned: [],
|
||||
userQuery: "&mut,u8",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&u8',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "&u8",
|
||||
returned: [],
|
||||
userQuery: "&u8",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: '&u8<u8>',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "&u8<u8>",
|
||||
returned: [],
|
||||
userQuery: "&u8<u8>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: 'u8<&u8>',
|
||||
elems: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "u8<&u8>",
|
||||
returned: [],
|
||||
userQuery: "u8<&u8>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: 'u8<&u8, u8>',
|
||||
elems: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "u8<&u8, u8>",
|
||||
returned: [],
|
||||
userQuery: "u8<&u8, u8>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: 'u8<&u8>',
|
||||
elems: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "u8<&u8>",
|
||||
returned: [],
|
||||
userQuery: "u8<&u8>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: 'u8<&mut u8, u8>',
|
||||
elems: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "mut",
|
||||
fullPath: ["mut"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "mut",
|
||||
generics: [],
|
||||
typeFilter: 0,
|
||||
},
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "u8<&mut u8, u8>",
|
||||
returned: [],
|
||||
userQuery: "u8<&mut u8, u8>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: 'primitive:&u8',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: -1,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "primitive:&u8",
|
||||
returned: [],
|
||||
userQuery: "primitive:&u8",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
query: 'macro:&u8',
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "macro:&u8",
|
||||
returned: [],
|
||||
userQuery: "macro:&u8",
|
||||
error: "Invalid search type: primitive `&` and `macro` both specified",
|
||||
},
|
||||
{
|
||||
query: '¯o:u8',
|
||||
elems: [
|
||||
{
|
||||
name: "reference",
|
||||
fullPath: ["reference"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "reference",
|
||||
generics: [
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
typeFilter: 16,
|
||||
},
|
||||
],
|
||||
typeFilter: 1,
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "¯o:u8",
|
||||
returned: [],
|
||||
userQuery: "¯o:u8",
|
||||
error: null,
|
||||
},
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue