@@ -310,10 +310,20 @@ window.initSearch = function(rawSearchIndex) {
310310 */
311311 function getIdentEndPosition ( parserState ) {
312312 let end = parserState . pos ;
313+ let foundExclamation = false ;
313314 while ( parserState . pos < parserState . length ) {
314315 const c = parserState . userQuery [ parserState . pos ] ;
315316 if ( ! isIdentCharacter ( c ) ) {
316- if ( isErrorCharacter ( c ) ) {
317+ if ( c === "!" ) {
318+ if ( foundExclamation ) {
319+ throw new Error ( "Cannot have more than one `!` in an ident" ) ;
320+ } else if ( parserState . pos + 1 < parserState . length &&
321+ isIdentCharacter ( parserState . userQuery [ parserState . pos + 1 ] ) )
322+ {
323+ throw new Error ( "`!` can only be at the end of an ident" ) ;
324+ }
325+ foundExclamation = true ;
326+ } else if ( isErrorCharacter ( c ) ) {
317327 throw new Error ( `Unexpected \`${ c } \`` ) ;
318328 } else if (
319329 isStopCharacter ( c ) ||
@@ -329,6 +339,7 @@ window.initSearch = function(rawSearchIndex) {
329339 }
330340 // Skip current ":".
331341 parserState . pos += 1 ;
342+ foundExclamation = false ;
332343 } else {
333344 throw new Error ( `Unexpected \`${ c } \`` ) ;
334345 }
@@ -591,7 +602,7 @@ window.initSearch = function(rawSearchIndex) {
591602 *
592603 * The supported syntax by this parser is as follow:
593604 *
594- * ident = *(ALPHA / DIGIT / "_")
605+ * ident = *(ALPHA / DIGIT / "_") [!]
595606 * path = ident *(DOUBLE-COLON ident)
596607 * arg = path [generics]
597608 * arg-without-generic = path
0 commit comments