本文整理汇总了Java中com.intellij.lang.PsiBuilder.advanceLexer方法的典型用法代码示例。如果您正苦于以下问题:Java PsiBuilder.advanceLexer方法的具体用法?Java PsiBuilder.advanceLexer怎么用?Java PsiBuilder.advanceLexer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.lang.PsiBuilder
的用法示例。
在下文中一共展示了PsiBuilder.advanceLexer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseCommandParameterSelector
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private static boolean parseCommandParameterSelector(PsiBuilder b, int l, AppleScriptCommand command,
StringHolder parsedParameterSelector) {
if (!recursion_guard_(b, l, "parseCommandParameterSelector")) return false;
boolean r = false;
PsiBuilder.Marker m = enter_section_(b, l, _NONE_, "<parse Command Parameter Selector>");//todo check this _AND_
parsedParameterSelector.value = b.getTokenText() == null ? "" : b.getTokenText();
while (!b.eof() && b.getTokenType() != NLS && b.getTokenType() != COMMENT) {
b.advanceLexer();
if (command.getParameterByName(parsedParameterSelector.value) != null) {
r = true;
break;
}
parsedParameterSelector.value += " " + b.getTokenText();
}
exit_section_(b, l, m, COMMAND_PARAMETER_SELECTOR, r, false, null);
return r;
}
示例2: parseStdLibCommandName
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private static boolean parseStdLibCommandName(PsiBuilder b, int l, StringHolder parsedName) {
if (!recursion_guard_(b, l, "parseStdLibCommandName")) return false;
boolean r = false;
parsedName.value = "";
parsedName.value = b.getTokenText() == null ? "" : b.getTokenText();
PsiBuilder.Marker m = enter_section_(b);
boolean commandWithPrefixExists = ParsableScriptSuiteRegistryHelper.isStdCommandWithPrefixExist(parsedName.value);
String nextTokenText = parsedName.value;
while (b.getTokenText() != null && commandWithPrefixExists) {
b.advanceLexer(); //advance lexer in any case
nextTokenText += " " + b.getTokenText();
commandWithPrefixExists = ParsableScriptSuiteRegistryHelper.isStdCommandWithPrefixExist(nextTokenText);
if (commandWithPrefixExists) {
parsedName.value = nextTokenText;
} else if (ParsableScriptSuiteRegistryHelper.isStdCommand(parsedName.value)) {
r = true;
break;
}
}
exit_section_(b, m, null, r);
return r;
}
示例3: tryToParseStdProperty
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
/**
* @param b {@link PsiBuilder}
* @param l level deep
* @return true if parsed token(s) is the property of the scripting additions library
*/
private static boolean tryToParseStdProperty(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "tryToParseStdProperty")) return false;
boolean r = false;
PsiBuilder.Marker m = enter_section_(b);
StringHolder currentTokenText = new StringHolder();
currentTokenText.value = b.getTokenText() == null ? "" : b.getTokenText();
boolean propertyWithPrefixExists = ParsableScriptSuiteRegistryHelper
.isStdPropertyWithPrefixExist(currentTokenText.value);
String nextTokenText = currentTokenText.value;
while (b.getTokenText() != null && propertyWithPrefixExists) {
b.advanceLexer(); //advance lexer in any case
nextTokenText += " " + b.getTokenText();
propertyWithPrefixExists = ParsableScriptSuiteRegistryHelper.isStdPropertyWithPrefixExist(nextTokenText);
if (propertyWithPrefixExists) {
currentTokenText.value = nextTokenText;
} else if (ParsableScriptSuiteRegistryHelper.isStdProperty(currentTokenText.value)) {
r = true;
break;
}
}
exit_section_(b, m, null, r);
return r;
}
示例4: tryToParseApplicationProperty
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
/**
* @param b {@link PsiBuilder}
* @param l level deep
* @param applicationName name of the application
* @return true if parsed token(s) is the property of the specified application
*/
private static boolean tryToParseApplicationProperty(PsiBuilder b, int l, @NotNull String applicationName) {
if (!recursion_guard_(b, l, "tryToParseApplicationProperty")) return false;
boolean r = false;
PsiBuilder.Marker m = enter_section_(b);
StringHolder currentTokenText = new StringHolder();
currentTokenText.value = b.getTokenText() == null ? "" : b.getTokenText();
boolean propertyWithPrefixExist = ParsableScriptSuiteRegistryHelper.isPropertyWithPrefixExist(applicationName,
currentTokenText.value);
//find the longest lexeme
String nextTokenText = currentTokenText.value;
while (b.getTokenText() != null && propertyWithPrefixExist) {
b.advanceLexer(); //advance lexer in any case
nextTokenText += " " + b.getTokenText();
propertyWithPrefixExist = ParsableScriptSuiteRegistryHelper.isPropertyWithPrefixExist(applicationName,
nextTokenText);
if (propertyWithPrefixExist) {
currentTokenText.value = nextTokenText;
} else if (ParsableScriptSuiteRegistryHelper.isApplicationProperty(applicationName, currentTokenText.value)) {
r = true;
break;
}
}
exit_section_(b, m, null, r);
return r;
}
示例5: parseGtAutoClose
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseGtAutoClose(PsiBuilder builder, ParserState parserState) {
if (parserState.currentScope.tokenType == m_types.TAG_PROPERTY) {
parserState.currentScope.end();
parserState.scopes.pop();
parserState.currentScope = parserState.scopes.empty() ? parserState.fileScope : parserState.scopes.peek();
}
if (parserState.currentScope.resolution == startTag || parserState.currentScope.resolution == closeTag) {
builder.remapCurrentToken(m_types.TAG_GT);
builder.advanceLexer();
parserState.dontMove = true;
parserState.currentScope.end();
parserState.scopes.pop();
parserState.currentScope = parserState.scopes.empty() ? parserState.fileScope : parserState.scopes.peek();
}
}
示例6: parseLt
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseLt(PsiBuilder builder, ParserState parserState) {
// Can be a symbol or a JSX tag
IElementType nextTokenType = builder.rawLookup(1);
if (nextTokenType == m_types.LIDENT || nextTokenType == m_types.UIDENT) {
// Surely a tag
builder.remapCurrentToken(m_types.TAG_LT);
parserState.currentScope = markScope(builder, parserState.scopes, startTag, m_types.TAG_START, groupExpression, m_types.TAG_LT);
parserState.currentScope.complete = true;
builder.advanceLexer();
parserState.dontMove = true;
builder.remapCurrentToken(m_types.TAG_NAME);
} else if (nextTokenType == m_types.SLASH) {
builder.remapCurrentToken(m_types.TAG_LT);
parserState.currentScope = markScope(builder, parserState.scopes, closeTag, m_types.TAG_CLOSE, any, m_types.TAG_LT);
parserState.currentScope.complete = true;
}
}
示例7: parseRParen
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseRParen(PsiBuilder builder, ParserState parserState) {
ParserScope scope = parserState.endUntilScopeExpression(m_types.LPAREN);
builder.advanceLexer();
parserState.dontMove = true;
if (scope != null) {
scope.complete = true;
parserState.scopes.pop().end();
scope = parserState.getLatestScope();
if (scope != null && scope.resolution == letNamedEq) {
scope.resolution = letNamedEqParameters;
}
}
parserState.updateCurrentScope();
}
示例8: parseEq
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseEq(PsiBuilder builder, ParserState parserState) {
if (parserState.isCurrentResolution(typeNamed)) {
parserState.currentScope.resolution = typeNamedEq;
} else if (parserState.isCurrentResolution(letNamed)) {
parserState.currentScope.resolution = letNamedEq;
builder.advanceLexer();
parserState.dontMove = true;
parserState.currentScope = markScope(builder, parserState.scopes, letNamedEq, m_types.LET_BINDING, groupExpression, m_types.EQ);
parserState.currentScope.complete = true;
} else if (parserState.isCurrentResolution(tagProperty)) {
parserState.currentScope.resolution = tagPropertyEq;
} else if (parserState.isCurrentResolution(moduleNamed)) {
parserState.currentScope.resolution = moduleNamedEq;
parserState.currentScope.complete = true;
}
}
示例9: tryToParseStdConstant
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private static boolean tryToParseStdConstant(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "tryToParseStdConstant")) return false;
StringHolder currentTokenText = new StringHolder();
currentTokenText.value = b.getTokenText() == null ? "" : b.getTokenText();
boolean r = false, propertyOrClassExists = false, constantWithPrefixExists = ParsableScriptSuiteRegistryHelper
.isStdConstantWithPrefixExist(currentTokenText.value);
String nextTokenText = currentTokenText.value;
PsiBuilder.Marker m = enter_section_(b);
while (b.getTokenText() != null && constantWithPrefixExists) {
b.advanceLexer();
nextTokenText += " " + b.getTokenText();
constantWithPrefixExists = ParsableScriptSuiteRegistryHelper.isStdConstantWithPrefixExist(nextTokenText);
if (constantWithPrefixExists) {
currentTokenText.value = nextTokenText;
} else if (ParsableScriptSuiteRegistryHelper.isStdConstant(currentTokenText.value)) {
r = true;
break;
}
}
if (r) {
// grammar allows className and propertyName as primaryExpression, so we should match the longest token between
// className or propertyName tokens. We check and return false if the property or class with the longer name
// exists, as it will be parsed later
currentTokenText.value += " " + b.getTokenText();
propertyOrClassExists = ParsableScriptSuiteRegistryHelper
.isStdPropertyWithPrefixExist(currentTokenText.value) ||
ParsableScriptSuiteRegistryHelper
.isStdClassWithPrefixExist(currentTokenText.value);
}
r = r && !propertyOrClassExists;
exit_section_(b, m, null, r);
return r;
}
示例10: tryToParseApplicationConstant
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private static boolean tryToParseApplicationConstant(PsiBuilder b, int l, @NotNull String applicationName) {
if (!recursion_guard_(b, l, "tryToParseApplicationConstant")) return false;
StringHolder currentTokenText = new StringHolder();
currentTokenText.value = b.getTokenText() == null ? "" : b.getTokenText();
boolean r = false, propertyOrClassExists = false, constantWithPrefixExists = ParsableScriptSuiteRegistryHelper
.isConstantWithPrefixExist(applicationName, currentTokenText.value);
String nextTokenText = currentTokenText.value;
PsiBuilder.Marker m = enter_section_(b);
while (b.getTokenText() != null && constantWithPrefixExists) {
b.advanceLexer();
nextTokenText += " " + b.getTokenText();
constantWithPrefixExists = ParsableScriptSuiteRegistryHelper
.isConstantWithPrefixExist(applicationName, nextTokenText);
if (constantWithPrefixExists) {
currentTokenText.value = nextTokenText;
} else if (ParsableScriptSuiteRegistryHelper.isApplicationConstant(applicationName, currentTokenText.value)) {
r = true;
break;
}
}
if (r) {
// grammar allows className and propertyName as primaryExpression, so we should match the longest token between
// className or propertyName tokens. We check and return false if the property or class with the longer name
// exists, as it will be parsed later
propertyOrClassExists = ParsableScriptSuiteRegistryHelper
.isPropertyWithPrefixExist(applicationName, currentTokenText.value) ||
ParsableScriptSuiteRegistryHelper
.isClassWithPrefixExist(applicationName, currentTokenText.value);
if (propertyOrClassExists) {
currentTokenText.value += " " + b.getTokenText();
propertyOrClassExists = ParsableScriptSuiteRegistryHelper
.isPropertyWithPrefixExist(applicationName, currentTokenText.value) ||
ParsableScriptSuiteRegistryHelper
.isClassWithPrefixExist(applicationName, currentTokenText.value);
}
}
r = r && !propertyOrClassExists;
exit_section_(b, m, null, r);
return r;
}
示例11: parseRBracket
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseRBracket(PsiBuilder builder, ParserState parserState) {
ParserScope scope = parserState.endUntilScopeExpression(m_types.LBRACKET);
builder.advanceLexer();
parserState.dontMove = true;
if (scope != null) {
if (scope.resolution != annotation) {
scope.complete = true;
}
parserState.scopes.pop().end();
}
parserState.updateCurrentScope();
}
示例12: parseRBrace
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseRBrace(PsiBuilder builder, ParserState parserState) {
ParserScope scope = parserState.endUntilScopeExpression(m_types.LBRACE);
builder.advanceLexer();
parserState.dontMove = true;
if (scope != null) {
scope.complete = true;
parserState.scopes.pop().end();
}
parserState.updateCurrentScope();
}
示例13: parseSemi
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseSemi(PsiBuilder builder, ParserState parserState) {
// End current start-expression scope
ParserScope scope = parserState.endUntilStart();
if (scope != null && scope.scopeType == startExpression) {
builder.advanceLexer();
parserState.dontMove = true;
parserState.scopes.pop();
scope.end();
}
parserState.updateCurrentScope();
}
示例14: parseEnd
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseEnd(PsiBuilder builder, ParserState parserState) {
ParserScope scope = parserState.endUntilScopeExpression(null);
builder.advanceLexer();
parserState.dontMove = true;
if (scope != null) {
scope.complete = true;
parserState.scopes.pop().end();
}
parserState.updateCurrentScope();
}
示例15: parseRParen
import com.intellij.lang.PsiBuilder; //导入方法依赖的package包/类
private void parseRParen(PsiBuilder builder, ParserState parserState) {
ParserScope scope = parserState.endUntilScopeExpression(m_types.LPAREN);
builder.advanceLexer();
parserState.dontMove = true;
if (scope != null) {
scope.complete = true;
parserState.scopes.pop().end();
parserState.getLatestScope();
}
parserState.updateCurrentScope();
}