void (@NotNull Lexer baseLexer) { final IElementType type = baseLexer.getTokenType(); if (type == XPath2TokenTypes.IF) { // "if" / "(" EXPRESSION if (replaceTokenNotFollowedBy(baseLexer, XPathTokenTypes.NCNAME, XPathTokenTypes.LPAREN)) { return; } } else if (type == XPathTokenTypes.NCNAME) { if (handleNCName(baseLexer, type)) return; } else if (type == XPathTokenTypes.RPAREN) { if (getState() == _XPathLexer.TYPE) { if (!lookingAt(baseLexer, XPath2TokenTypes.OCCURRENCE_OPS)) { setState(baseLexer, _XPathLexer.YYINITIAL); } } } else if (type == XPathTokenTypes.AXIS_NAME) { if (replaceTokenNotFollowedBy(baseLexer, XPathTokenTypes.NCNAME, XPathTokenTypes.COLCOL)) { // AXIS_NAME / "::" setState(baseLexer, _XPathLexer.YYINITIAL); return; } } else if (type == XPathTokenTypes.NODE_TYPE) { final String text = baseLexer.getTokenText(); // NODE_TYPE2 if ("attribute".equals(text) || "element".equals(text) || "schema-element".equals(text) || "schema-attribute".equals(text) || "document-node".equals(text)) { // "attribute::" vs. "attribute(" if ("attribute".equals(text)) { if (replaceTokenFollowedBy(baseLexer, XPathTokenTypes.AXIS_NAME, XPathTokenTypes.COLCOL)) { setState(baseLexer, _XPathLexer.S1); return; } } if (myXPath2Syntax) { if (!replaceTokenNotFollowedBy(baseLexer, XPathTokenTypes.NCNAME, XPathTokenTypes.LPAREN)) { advanceAs(baseLexer, type); } } else { handleNCName(baseLexer, XPathTokenTypes.NCNAME); } return; } else if (replaceTokenNotFollowedBy(baseLexer, XPathTokenTypes.NCNAME, XPathTokenTypes.LPAREN)) { // other NODE_TYPEs setState(baseLexer, _XPathLexer.YYINITIAL); return; } } else if (XPath2TokenTypes.QUANTIFIERS.contains(type) || type == XPath2TokenTypes.FOR) { // ("some" | "every" | "for") / "$" VARNAME if (replaceTokenNotFollowedBy(baseLexer, XPathTokenTypes.NCNAME, XPathTokenTypes.DOLLAR)) { return; } } advanceAs(baseLexer, type); }