Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create real parser for search queries #90630

Merged
merged 28 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
be41750
Greatly improve rustdoc search
GuillaumeGomez Dec 20, 2021
3aeef67
Update search engine and parser to error when quotes are used on quer…
GuillaumeGomez Jan 3, 2022
0f51652
Update tests
GuillaumeGomez Aug 11, 2021
7cefee0
Add possibility to check parsed query
GuillaumeGomez Dec 20, 2021
f5833e7
Add parser tests
GuillaumeGomez Dec 20, 2021
bbcf176
Improve naming of "val" field
GuillaumeGomez Jan 3, 2022
51de26c
* If type filter is in quotes, throw an error.
GuillaumeGomez Jan 3, 2022
99c5394
Add query syntax for the parser
GuillaumeGomez Jan 2, 2022
264064d
* Greatly improve the rustdoc search parser source code
GuillaumeGomez Jan 4, 2022
99d5520
Make query parser more strict and improve display of errors
GuillaumeGomez Jan 9, 2022
4929733
Simplify parser syntax
GuillaumeGomez Feb 9, 2022
c7de1a1
Improve documentation and add some explanations in the code
GuillaumeGomez Feb 11, 2022
699ae36
Apply suggestions:
GuillaumeGomez Mar 20, 2022
f9251ee
Replace unneeded use of regex with a simple if
GuillaumeGomez Mar 22, 2022
8e29ed4
Add isIdentCharacter function to ensure that unexpected characters ar…
GuillaumeGomez Mar 23, 2022
1f5c4c2
Forbid rustdoc search query to end with ->
GuillaumeGomez Mar 28, 2022
da829d8
Improve the BNF description a bit and fix some issues
GuillaumeGomez Mar 28, 2022
e03a950
Handle separators in their own functions and fix missing handling of …
GuillaumeGomez Mar 30, 2022
51b4005
Update the eBNF to allow generics bracket to not be closed if it's EOF
GuillaumeGomez Mar 31, 2022
ab9cf32
Add tests for paths
GuillaumeGomez Apr 8, 2022
a6051c7
Remove unnecessary `elem.name.length === 0` since the rustdoc search …
GuillaumeGomez Apr 16, 2022
6f35475
Parse idents the same way in both quote string elements and "normal" …
GuillaumeGomez Apr 16, 2022
da363b2
Add more tests for quote errors
GuillaumeGomez Apr 16, 2022
d7d538a
Fix some corner cases
GuillaumeGomez Apr 16, 2022
299e8ee
Add an extra check over filter type
GuillaumeGomez Apr 17, 2022
5c6c1e1
Add test to ensure that keywords in path are working
GuillaumeGomez Apr 18, 2022
8d0e10c
Correctly handle single `:`
GuillaumeGomez Apr 18, 2022
4d26bde
Extend `handleSingleArg` documentation
GuillaumeGomez Apr 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 55 additions & 4 deletions src/librustdoc/html/static/js/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,34 @@ function initSearch(searchIndex){}

/**
* @typedef {{
* raw: string,
* query: string,
* type: string,
* id: string,
* name: string,
* fullPath: Array<string>,
* pathWithoutLast: Array<string>,
* pathLast: string,
jsha marked this conversation as resolved.
Show resolved Hide resolved
* generics: Array<QueryElement>,
* }}
*/
var QueryElement;

/**
* @typedef {{
* pos: number,
* totalElems: number,
* typeFilter: (null|string),
* userQuery: string,
* }}
*/
var ParserState;

/**
* @typedef {{
* original: string,
* userQuery: string,
* typeFilter: number,
* elems: Array<QueryElement>,
* args: Array<QueryElement>,
* returned: Array<QueryElement>,
* foundElems: number,
* }}
*/
var ParsedQuery;
Expand All @@ -30,3 +54,30 @@ var ParsedQuery;
* }}
*/
var Row;

/**
* @typedef {{
* in_args: Array<Object>,
* returned: Array<Object>,
* others: Array<Object>,
* query: ParsedQuery,
* }}
*/
var ResultsTable;

/**
* @typedef {{
* desc: string,
* displayPath: string,
* fullPath: string,
* href: string,
* id: number,
* lev: number,
* name: string,
* normalizedName: string,
* parent: (Object|undefined),
* path: string,
* ty: number,
* }}
*/
var Results;
Loading