@@ -287,10 +287,6 @@ function initSearch(rawSearchIndex) {
287287 }
288288 }
289289
290- function isWhitespace ( c ) {
291- return " \t\n\r" . indexOf ( c ) !== - 1 ;
292- }
293-
294290 function isSpecialStartCharacter ( c ) {
295291 return "<\"" . indexOf ( c ) !== - 1 ;
296292 }
@@ -408,7 +404,7 @@ function initSearch(rawSearchIndex) {
408404 * @return {boolean }
409405 */
410406 function isPathSeparator ( c ) {
411- return c === ":" || isWhitespace ( c ) ;
407+ return c === ":" || c === " " ;
412408 }
413409
414410 /**
@@ -425,7 +421,7 @@ function initSearch(rawSearchIndex) {
425421 const c = parserState . userQuery [ pos - 1 ] ;
426422 if ( c === lookingFor ) {
427423 return true ;
428- } else if ( ! isWhitespace ( c ) ) {
424+ } else if ( c !== " " ) {
429425 break ;
430426 }
431427 pos -= 1 ;
@@ -454,7 +450,7 @@ function initSearch(rawSearchIndex) {
454450 function skipWhitespace ( parserState ) {
455451 while ( parserState . pos < parserState . userQuery . length ) {
456452 const c = parserState . userQuery [ parserState . pos ] ;
457- if ( ! isWhitespace ( c ) ) {
453+ if ( c !== " " ) {
458454 break ;
459455 }
460456 parserState . pos += 1 ;
@@ -473,8 +469,6 @@ function initSearch(rawSearchIndex) {
473469 const path = name . trim ( ) ;
474470 if ( path . length === 0 && generics . length === 0 ) {
475471 throw [ "Unexpected " , parserState . userQuery [ parserState . pos ] ] ;
476- } else if ( path === "*" ) {
477- throw [ "Unexpected " , "*" ] ;
478472 }
479473 if ( query . literalSearch && parserState . totalElems - parserState . genericsElems > 0 ) {
480474 throw [ "Cannot have more than one element if you use quotes" ] ;
@@ -512,18 +506,15 @@ function initSearch(rawSearchIndex) {
512506 bindingName,
513507 } ;
514508 }
509+ const quadcolon = / : : \s * : : / . exec ( path ) ;
515510 if ( path . startsWith ( "::" ) ) {
516511 throw [ "Paths cannot start with " , "::" ] ;
517512 } else if ( path . endsWith ( "::" ) ) {
518513 throw [ "Paths cannot end with " , "::" ] ;
519- } else if ( path . includes ( "::::" ) ) {
520- throw [ "Unexpected " , "::::" ] ;
521- } else if ( path . includes ( " ::" ) ) {
522- throw [ "Unexpected " , " ::" ] ;
523- } else if ( path . includes ( ":: " ) ) {
524- throw [ "Unexpected " , ":: " ] ;
525- }
526- const pathSegments = path . split ( / : : | \s + / ) ;
514+ } else if ( quadcolon !== null ) {
515+ throw [ "Unexpected " , quadcolon [ 0 ] ] ;
516+ }
517+ const pathSegments = path . split ( / (?: : : \s * ) | (?: \s + (?: : : \s * ) ? ) / ) ;
527518 // In case we only have something like `<p>`, there is no name.
528519 if ( pathSegments . length === 0 || ( pathSegments . length === 1 && pathSegments [ 0 ] === "" ) ) {
529520 if ( generics . length > 0 || prevIs ( parserState , ">" ) ) {
@@ -604,7 +595,7 @@ function initSearch(rawSearchIndex) {
604595 } else {
605596 while ( parserState . pos + 1 < parserState . length ) {
606597 const next_c = parserState . userQuery [ parserState . pos + 1 ] ;
607- if ( ! isWhitespace ( next_c ) ) {
598+ if ( next_c !== " " ) {
608599 break ;
609600 }
610601 parserState . pos += 1 ;
@@ -958,7 +949,7 @@ function initSearch(rawSearchIndex) {
958949 query . literalSearch = false ;
959950 foundStopChar = true ;
960951 continue ;
961- } else if ( isWhitespace ( c ) ) {
952+ } else if ( c === " " ) {
962953 skipWhitespace ( parserState ) ;
963954 continue ;
964955 }
@@ -1118,7 +1109,7 @@ function initSearch(rawSearchIndex) {
11181109 }
11191110 }
11201111 }
1121- userQuery = userQuery . trim ( ) ;
1112+ userQuery = userQuery . trim ( ) . replace ( / \r | \n | \t / g , " " ) ;
11221113 const parserState = {
11231114 length : userQuery . length ,
11241115 pos : 0 ,
0 commit comments