本文整理汇总了Java中org.intellij.lang.xpath.XPathTokenTypes.RBRACE属性的典型用法代码示例。如果您正苦于以下问题:Java XPathTokenTypes.RBRACE属性的具体用法?Java XPathTokenTypes.RBRACE怎么用?Java XPathTokenTypes.RBRACE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.intellij.lang.xpath.XPathTokenTypes
的用法示例。
在下文中一共展示了XPathTokenTypes.RBRACE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInjectionRanges
@NotNull
private synchronized TextRange[] getInjectionRanges(final XmlAttribute attribute, XsltChecker.LanguageLevel languageLevel) {
final TextRange[] cachedFiles = getCachedRanges(attribute);
if (cachedFiles != null) {
return cachedFiles;
}
final String value = attribute.getDisplayValue();
if (value == null) return EMPTY_ARRAY;
final TextRange[] ranges;
if (XsltSupport.mayBeAVT(attribute)) {
final List<TextRange> avtRanges = new SmartList<TextRange>();
int i;
int j = 0;
Lexer lexer = null;
while ((i = XsltSupport.getAVTOffset(value, j)) != -1) {
if (lexer == null) {
lexer = LanguageParserDefinitions.INSTANCE.forLanguage(languageLevel.getXPathVersion().getLanguage())
.createLexer(attribute.getProject());
}
// "A right curly brace inside a Literal in an expression is not recognized as terminating the expression."
lexer.start(value, i, value.length());
j = -1;
while (lexer.getTokenType() != null) {
if (lexer.getTokenType() == XPathTokenTypes.RBRACE) {
j = lexer.getTokenStart();
break;
}
lexer.advance();
}
if (j != -1) {
avtRanges.add(AVTRange.create(attribute, i, j + 1, j > i + 1));
} else {
// missing '}' error will be flagged by xpath parser
avtRanges.add(AVTRange.create(attribute, i, value.length(), false));
break;
}
}
if (avtRanges.size() > 0) {
ranges = avtRanges.toArray(new TextRange[avtRanges.size()]);
} else {
ranges = EMPTY_ARRAY;
}
} else {
ranges = new TextRange[]{ attribute.getValueTextRange() };
}
attribute.putUserData(CACHED_FILES, Pair.create(attribute.getValue(), ranges));
return ranges;
}
示例2: getInjectionRanges
@NotNull
private synchronized TextRange[] getInjectionRanges(final XmlAttribute attribute, XsltChecker.LanguageLevel languageLevel)
{
final TextRange[] cachedFiles = getCachedRanges(attribute);
if(cachedFiles != null)
{
return cachedFiles;
}
final String value = attribute.getDisplayValue();
if(value == null)
{
return EMPTY_ARRAY;
}
final TextRange[] ranges;
if(XsltSupport.mayBeAVT(attribute))
{
final List<TextRange> avtRanges = new SmartList<TextRange>();
int i;
int j = 0;
Lexer lexer = null;
while((i = XsltSupport.getAVTOffset(value, j)) != -1)
{
if(lexer == null)
{
Language language = languageLevel.getXPathVersion().getLanguage();
lexer = LanguageParserDefinitions.INSTANCE.forLanguage(language).createLexer(LanguageVersionUtil.findDefaultVersion(language));
}
// "A right curly brace inside a Literal in an expression is not recognized as terminating the expression."
lexer.start(value, i, value.length());
j = -1;
while(lexer.getTokenType() != null)
{
if(lexer.getTokenType() == XPathTokenTypes.RBRACE)
{
j = lexer.getTokenStart();
break;
}
lexer.advance();
}
if(j != -1)
{
avtRanges.add(AVTRange.create(attribute, i, j + 1, j > i + 1));
}
else
{
// missing '}' error will be flagged by xpath parser
avtRanges.add(AVTRange.create(attribute, i, value.length(), false));
break;
}
}
if(avtRanges.size() > 0)
{
ranges = avtRanges.toArray(new TextRange[avtRanges.size()]);
}
else
{
ranges = EMPTY_ARRAY;
}
}
else
{
ranges = new TextRange[]{attribute.getValueTextRange()};
}
attribute.putUserData(CACHED_FILES, Pair.create(attribute.getValue(), ranges));
return ranges;
}