本文整理匯總了Java中com.intellij.lang.PsiBuilder.Marker方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiBuilder.Marker方法的具體用法?Java PsiBuilder.Marker怎麽用?Java PsiBuilder.Marker使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.lang.PsiBuilder
的用法示例。
在下文中一共展示了PsiBuilder.Marker方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseExpressionStmtGroup
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
public static boolean parseExpressionStmtGroup(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "expr_stmt_group")) return false;
boolean r;
PsiBuilder.Marker m = enter_section_(b);
r = object_expr(b, l + 1);
//Need to do these first since they match with expr
if (!r) r = assign_ref_expr(b, l + 1);
if (!r) r = assign_ref_index_expr(b, l + 1);
if (!r) r = call_method_expr(b, l + 1);
//If none of those wonky rules succeed, do the decent ones
if (!r) r = assign_var_expr(b, l + 1);
if (!r) r = assign_index_expr(b, l + 1);
if (!r) r = call_global_expr(b, l + 1);
if (!r) r = call_global_ns_expr(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
示例2: assign_ref_expr
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private static boolean assign_ref_expr(PsiBuilder b, int l) {
//So this is rather wonky. What we do here is try to parse the incoming nodes as an expression,
// as assign_ref_expr (and the below rules) need an expression as the first argument, but
// you can chain them together. And calling expr will eat the assign_ref_expr when it parses.
//So to get to the point here:
// We run expr() and then see what it comes up with. If the last node (basically the expression
// that it parsed from the call) is of our type, then we successfully parsed it.
boolean r;
PsiBuilder.Marker m = enter_section_(b);
//Group -1 so we parse whatever expression is next
r = expr(b, l + 1, -1);
if (r) {
//If we parsed an expression, check if we parsed the type we'ere looking for
PsiBuilderImpl.ProductionMarker last = (PsiBuilderImpl.ProductionMarker) b.getLatestDoneMarker();
r = last != null && last.getTokenType().equals(ASSIGN_REF_EXPR);
}
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: parseApplicationHandlerDefinitionSignature
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
public static boolean parseApplicationHandlerDefinitionSignature(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "parseApplicationHandlerDefinitionSignature")) return false;
boolean r;
//application handled definition in script only makes sense inside <using terms of> statement
if (b.getUserData(IS_PARSING_USING_TERMS_FROM_STATEMENT) != Boolean.TRUE || b.getUserData(PARSING_TELL_COMPOUND_STATEMENT) == Boolean.TRUE) return false;
StringHolder parsedCommandName = new StringHolder();
String toldApplicationName = getTargetApplicationName(b);
PsiBuilder.Marker m2 = enter_section_(b, l, _COLLAPSE_, "<parse Application Handler Definition");
r = parseDictionaryCommandNameInner(b, l + 1, parsedCommandName, toldApplicationName, true, null);
exit_section_(b, l, m2, DICTIONARY_COMMAND_NAME, r, false, null);
if (!r) return false;
// TODO: 06/12/15 may be try to avoid creating PSI here!..
List<AppleScriptCommand> allCommandsWithName = getAllCommandsWithName(b, parsedCommandName.value, toldApplicationName, false, null);
for (AppleScriptCommand command : allCommandsWithName) {
r = parseParametersForCommand(b, l + 1, command);//custom parsing here
if (r) {
break;
}
}
boolean incompleteHandlerCall = !r && allCommandsWithName.size() > 0 && (b.getTokenType() == NLS || b.eof());
return r || incompleteHandlerCall;
}
示例5: parseExpression
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
/**
* If inside tell (only in a tell?) compound statement - first check it's terms
*/
public static boolean parseExpression(PsiBuilder b, int l, String dictionaryTermToken, Parser expression) {
if (!recursion_guard_(b, l, "parseExpression")) return false;
if (!nextTokenIsFast(b, dictionaryTermToken)) return false;
boolean r;
//check application terms first
if (b.getUserData(PARSING_TELL_COMPOUND_STATEMENT) == Boolean.TRUE) {
String toldAppName = peekTargetApplicationName(b);
if (!StringUtil.isEmpty(toldAppName)) {
StringHolder parsedName = new StringHolder();
PsiBuilder.Marker mComName = enter_section_(b, l, _AND_, "<parse Expression>");
r = parseCommandNameForApplication(b, l + 1, parsedName, toldAppName, true);
exit_section_(b, l, mComName, null, r, false, null);
if (r) return false;
if (ParsableScriptSuiteRegistryHelper.isPropertyWithPrefixExist(toldAppName, dictionaryTermToken)) {
return false;
// PsiBuilder.Marker m = enter_section_(b, l, _AND_, null, "<dictionary constant>");
// r = parseDictionaryConstant(b, l + 1);
// exit_section_(b, l, m, r, false, null);
// if (r) return false;
}
}
}
return expression.parse(b, l + 1);
}
示例6: 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;
}
示例7: 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;
}
示例8: parseDictionaryCommandName
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
public static boolean parseDictionaryCommandName(PsiBuilder b, int l) {
boolean r;
if (nextTokenIs(b, NLS)) {
return false;
}
StringHolder parsedCommandName = new StringHolder();
String toldApplicationName = getTargetApplicationName(b);
boolean areThereUseStatements = b.getUserData(WAS_USE_STATEMENT_USED) == Boolean.TRUE;
Set<String> applicationsToImport = null;
if (areThereUseStatements) {
applicationsToImport = b.getUserData(USED_APPLICATION_NAMES);
}
PsiBuilder.Marker m = enter_section_(b, l, _COLLAPSE_, "<parse ApplicationDictionary Command Name>");
r = parseDictionaryCommandNameInner(b, l + 1, parsedCommandName, toldApplicationName, areThereUseStatements, applicationsToImport);
exit_section_(b, l, m, DICTIONARY_COMMAND_NAME, r, false, null);
return r;
}
示例9: call_method_expr
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private static boolean call_method_expr(PsiBuilder b, int l) {
//See assign_ref_expr for explanation
boolean r;
PsiBuilder.Marker m = enter_section_(b);
r = expr(b, l + 1, -1);
if (r) {
PsiBuilderImpl.ProductionMarker last = (PsiBuilderImpl.ProductionMarker)b.getLatestDoneMarker();
r = last != null && last.getTokenType().equals(CALL_METHOD_EXPR);
}
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: 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;
}
示例12: parseApplicationName
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
/**
* @param b {@link PsiBuilder}
* @param l Level deep
* @param tellStatementStartCondition If this is the application reference of a <tell> or <using terms
* from> statements
* @return true if parsed
*/
public static boolean parseApplicationName(PsiBuilder b, int l, Parser tellStatementStartCondition) {
if (!recursion_guard_(b, l, "parseApplicationName")) return false;
boolean r;
consumeToken(b, THE_KW);
if (!nextTokenIs(b, "", APPLICATION, APP)) return false;
PsiBuilder.Marker mCls = enter_section_(b, l, _NONE_, "<parse application name>");
r = consumeToken(b, APPLICATION);
if (!r) r = consumeToken(b, APP);
exit_section_(b, l, mCls, DICTIONARY_CLASS_NAME, r, false, null);
if (!nextTokenIs(b, "", STRING_LITERAL, ID)) return false;
PsiBuilder.Marker mProp = enter_section_(b, l, _NONE_, "<parse application name>");
boolean idReference = consumeToken(b, ID);
exit_section_(b, l, mProp, DICTIONARY_PROPERTY_NAME, idReference, false, null);
PsiBuilder.Marker m = enter_section_(b);
String applicationNameString = b.getTokenText();
r = consumeToken(b, STRING_LITERAL);
// if this is start of <tell compound> or <tell simple> or <using terms from> statements, push the application name
// which dictionary will be consulted for terms parsing (only the last pushed application is queried)
if (r && applicationNameString != null) {
applicationNameString = applicationNameString.replace("\"", "");
if (!StringUtil.isEmptyOrSpaces(applicationNameString) && tellStatementStartCondition.parse(b, l + 1)) {
pushTargetApplicationName(b, applicationNameString);
}
}
exit_section_(b, m, null, r);
return r;
}
示例13: parseParameterForCommand
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private static boolean parseParameterForCommand(PsiBuilder b, int l, AppleScriptCommand command,
StringHolder parsedParameterSelector, boolean givenForm, boolean
first) {
if (!recursion_guard_(b, l, "parseParameterForCommand")) return false;
boolean r;
PsiBuilder.Marker m = enter_section_(b, l, _NONE_, "<parse Parameter For Command>");//todo check here if it works
r = parseGivenParameter(b, l + 1, command, parsedParameterSelector, givenForm, first);
//todo and here exit and enter once again if it is true??
if (!r) r = parseBooleanParameter(b, l + 1, command, parsedParameterSelector);
exit_section_(b, l, m, COMMAND_PARAMETER, r, false, null);
return r;
}
示例14: parseBooleanParameter
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private static boolean parseBooleanParameter(PsiBuilder b, int l, AppleScriptCommand command, StringHolder
parsedParameterSelector) {
if (!recursion_guard_(b, l, "parseBooleanParameter")) return false;
boolean r;
//need to rollback with/without if there is no match
PsiBuilder.Marker m = enter_section_(b, l, _NONE_, "<parse Boolean Parameter>");
b.putUserData(PARSING_COMMAND_HANDLER_BOOLEAN_PARAMETER, true);
r = consumeToken(b, WITH);
if (!r) r = consumeToken(b, WITHOUT);
if (!r) r = consumeToken(b, LAND); //for cases like: '...with regexp and all occurrences without case sensitive'
r = r && parseCommandParameterSelector(b, l + 1, command, parsedParameterSelector);
exit_section_(b, l, m, null, r, false, null);
b.putUserData(PARSING_COMMAND_HANDLER_BOOLEAN_PARAMETER, false);
return r;
}
示例15: parseGivenParameter
import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private static boolean parseGivenParameter(PsiBuilder b, int l, AppleScriptCommand command,
StringHolder parsedParameterSelector, boolean givenForm, boolean first) {
if (!recursion_guard_(b, l, "parseGivenParameter")) return false;
PsiBuilder.Marker m = enter_section_(b, l, _NONE_, "<parse Given Parameter>");
boolean r = !givenForm || first || consumeToken(b, COMMA);//if it is a given form and not the first parameter ->
// should be comma
r = r && parseCommandParameterSelector(b, l + 1, command, parsedParameterSelector);
final CommandParameter parameterDefinition = command.getParameterByName(parsedParameterSelector.value);
//todo: parameter value expression could be incorrectly parsed and needed to be rolled backed (__AND__ modifier?)
//as in example: mount volume "" in AppleTalk zone "" (in - parsed as range ref form)
if (givenForm) r = consumeToken(b, COLON);
r = r && parseCommandParameterValue(b, l + 1, parameterDefinition);
exit_section_(b, l, m, null, r, false, null);
return r;
}