Quantifier (PsiElement element) { PsiElement nextSibling = element.getNextSibling(); while (nextSibling instanceof PsiWhiteSpace) { nextSibling = nextSibling.getNextSibling(); } if (nextSibling instanceof XmlToken) { IElementType tokenType = ((XmlToken)nextSibling).getTokenType(); if (tokenType == XML_PLUS) { return Quantifier.ONE_OR_MORE; } else if (tokenType == XML_STAR) { return Quantifier.ZERO_OR_MORE; } else if (tokenType == XML_QUESTION) { return Quantifier.OPTIONAL; } } return Quantifier.REQUIRED; }