Rollup merge of #118856 - notriddle:notriddle/search-js, r=GuillaumeGomez
rustdoc-search: clean up parser The `c === "="` was redundant when `isSeparatorCharacter` already checks that. The function `isStopCharacter` and `isEndCharacter` functions did exactly the same thing and have synonymous names. There doesn't seem much point in having both.
This commit is contained in:
commit
6459121a6c
@ -298,10 +298,6 @@ function initSearch(rawSearchIndex) {
|
|||||||
return "=,>-]".indexOf(c) !== -1;
|
return "=,>-]".indexOf(c) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isStopCharacter(c) {
|
|
||||||
return isEndCharacter(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isErrorCharacter(c) {
|
function isErrorCharacter(c) {
|
||||||
return "()".indexOf(c) !== -1;
|
return "()".indexOf(c) !== -1;
|
||||||
}
|
}
|
||||||
@ -617,8 +613,7 @@ function initSearch(rawSearchIndex) {
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
c === "[" ||
|
c === "[" ||
|
||||||
c === "=" ||
|
isEndCharacter(c) ||
|
||||||
isStopCharacter(c) ||
|
|
||||||
isSpecialStartCharacter(c) ||
|
isSpecialStartCharacter(c) ||
|
||||||
isSeparatorCharacter(c)
|
isSeparatorCharacter(c)
|
||||||
) {
|
) {
|
||||||
@ -917,7 +912,7 @@ function initSearch(rawSearchIndex) {
|
|||||||
|
|
||||||
while (parserState.pos < parserState.length) {
|
while (parserState.pos < parserState.length) {
|
||||||
const c = parserState.userQuery[parserState.pos];
|
const c = parserState.userQuery[parserState.pos];
|
||||||
if (isStopCharacter(c)) {
|
if (isEndCharacter(c)) {
|
||||||
foundStopChar = true;
|
foundStopChar = true;
|
||||||
if (isSeparatorCharacter(c)) {
|
if (isSeparatorCharacter(c)) {
|
||||||
parserState.pos += 1;
|
parserState.pos += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user