diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-06-13 14:01:01 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-06-14 14:22:17 +0200 |
| commit | e4ee3298656b74dd6be810862b5dd4cb8d2825b8 (patch) | |
| tree | 0e7932afdea90ae0bb6098bd94c32b00d8cf3b95 /src | |
| parent | 4f0a9124bdfb84e71bde8e9d0b79d688baf7887f (diff) | |
| download | rust-e4ee3298656b74dd6be810862b5dd4cb8d2825b8.tar.gz rust-e4ee3298656b74dd6be810862b5dd4cb8d2825b8.zip | |
Fix eBNF and handling of whitespace characters when not in a path
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 35abce0903c..009775645f5 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -838,7 +838,13 @@ function initSearch(rawSearchIndex) { throw ["Unexpected ", c]; } else if (c === ":" && !isPathStart(parserState)) { if (parserState.typeFilter !== null) { - throw ["Unexpected ", ":"]; + throw [ + "Unexpected ", + ":", + " (expected path after type filter ", + parserState.typeFilter + ":", + ")", + ]; } else if (query.elems.length === 0) { throw ["Expected type filter before ", ":"]; } else if (query.literalSearch) { @@ -853,6 +859,9 @@ function initSearch(rawSearchIndex) { query.literalSearch = false; foundStopChar = true; continue; + } else if (isWhitespace(c)) { + skipWhitespace(parserState); + continue; } if (!foundStopChar) { let extra = ""; @@ -983,7 +992,7 @@ function initSearch(rawSearchIndex) { * path = ident *(DOUBLE-COLON/{WS} ident) [!] * slice = OPEN-SQUARE-BRACKET [ nonempty-arg-list ] CLOSE-SQUARE-BRACKET * arg = [type-filter *WS COLON *WS] (path [generics] / slice) - * type-sep = COMMA *(COMMA) + * type-sep = *WS COMMA *(COMMA) * nonempty-arg-list = *(type-sep) arg *(type-sep arg) *(type-sep) * generics = OPEN-ANGLE-BRACKET [ nonempty-arg-list ] *(type-sep) * CLOSE-ANGLE-BRACKET |
