Java Code Examples for com.intellij.lang.PsiBuilder

The following are top voted examples for showing how to use com.intellij.lang.PsiBuilder. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: reasonml-idea-plugin   File: CommonParser.java   View source code 6 votes vote down vote up
@Override
public void parseLight(IElementType elementType, PsiBuilder builder) {
    builder = adapt_builder_(elementType, builder, this, null);
    PsiBuilder.Marker m = enter_section_(builder, 0, _COLLAPSE_, null);


    ParserState parserState = new ParserState(new ParserScope(file, m_types.FILE_MODULE, null));
    parseFile(builder, parserState);

    // if we have a scope at last position in file, without SEMI, we need to handle it here
    if (!parserState.scopes.empty()) {
        ParserScope scope = parserState.scopes.pop();
        while (scope != null) {
            scope.end();
            scope = parserState.scopes.empty() ? null : parserState.scopes.pop();
        }
    }

    new ParserScope(file, m_types.FILE_MODULE, null).end();

    exit_section_(builder, 0, m, elementType, true, true, TRUE_CONDITION);
}
 
Example 2
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 6 votes vote down vote up
public static boolean withTimeoutStatement(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "withTimeoutStatement")) return false;
  if (!nextTokenIs(b, WITH)) return false;
  boolean r, p;
  Marker m = enter_section_(b, l, _NONE_, WITH_TIMEOUT_STATEMENT, null);
  r = consumeTokens(b, 2, WITH, TIMEOUT);
  p = r; // pin = 2
  r = r && report_error_(b, withTimeoutStatement_2(b, l + 1));
  r = p && report_error_(b, timeoutIntegerExpression(b, l + 1)) && r;
  r = p && report_error_(b, withTimeoutStatement_4(b, l + 1)) && r;
  r = p && report_error_(b, sep(b, l + 1)) && r;
  r = p && report_error_(b, withTimeoutStatement_6(b, l + 1)) && r;
  r = p && report_error_(b, consumeToken(b, END)) && r;
  r = p && withTimeoutStatement_8(b, l + 1) && r;
  exit_section_(b, l, m, r, p, null);
  return r || p;
}
 
Example 3
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 6 votes vote down vote up
public static boolean consideringStatement(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "consideringStatement")) return false;
  if (!nextTokenIs(b, CONSIDERING)) return false;
  boolean r, p;
  Marker m = enter_section_(b, l, _NONE_, CONSIDERING_STATEMENT, null);
  r = consumeToken(b, CONSIDERING);
  r = r && considerOrIgnoreAttr(b, l + 1);
  p = r; // pin = 2
  r = r && report_error_(b, consideringStatement_2(b, l + 1));
  r = p && report_error_(b, consideringStatement_3(b, l + 1)) && r;
  r = p && report_error_(b, sep(b, l + 1)) && r;
  r = p && report_error_(b, consideringStatement_5(b, l + 1)) && r;
  r = p && report_error_(b, consumeTokens(b, -1, END, CONSIDERING)) && r;
  exit_section_(b, l, m, r, p, null);
  return r || p;
}
 
Example 4
Project: reasonml-idea-plugin   File: RmlParser.java   View source code 6 votes vote down vote up
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();
}
 
Example 5
Project: idea-php-dotenv-plugin   File: DotEnvParser.java   View source code 6 votes vote down vote up
public void parseLight(IElementType t, PsiBuilder b) {
  boolean r;
  b = adapt_builder_(t, b, this, null);
  Marker m = enter_section_(b, 0, _COLLAPSE_, null);
  if (t == COMMENT) {
    r = comment(b, 0);
  }
  else if (t == EMPTY_LINE) {
    r = empty_line(b, 0);
  }
  else if (t == PROPERTY) {
    r = property(b, 0);
  }
  else {
    r = parse_root_(t, b, 0);
  }
  exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
}
 
Example 6
Project: hybris-integration-intellij-idea-plugin   File: FlexibleSearchParser.java   View source code 5 votes vote down vote up
private static boolean boolean_test_1_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "boolean_test_1_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, IS);
  r = r && boolean_test_1_0_1(b, l + 1);
  r = r && truth_value(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 7
Project: Goal-Intellij-Plugin   File: ModuleParser.java   View source code 5 votes vote down vote up
private static boolean goalQuery_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "goalQuery_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, GOAL);
  if (!r) r = consumeToken(b, AGOAL);
  if (!r) r = consumeToken(b, GOALA);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 8
Project: Goal-Intellij-Plugin   File: TestParser.java   View source code 5 votes vote down vote up
private static boolean nakedTerm_0_1(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "nakedTerm_0_1")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = nakedTerm_0_1_0(b, l + 1);
  int c = current_position_(b);
  while (r) {
    if (!nakedTerm_0_1_0(b, l + 1)) break;
    if (!empty_element_parsed_guard_(b, "nakedTerm_0_1", c)) break;
    c = current_position_(b);
  }
  exit_section_(b, m, null, r);
  return r;
}
 
Example 9
Project: greycat-idea-plugin   File: GCMParser.java   View source code 5 votes vote down vote up
private static boolean ACTION_PARAMS_B_1(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "ACTION_PARAMS_B_1")) return false;
  int c = current_position_(b);
  while (true) {
    if (!ACTION_PARAMS_B_1_0(b, l + 1)) break;
    if (!empty_element_parsed_guard_(b, "ACTION_PARAMS_B_1", c)) break;
    c = current_position_(b);
  }
  return true;
}
 
Example 10
Project: hybris-integration-intellij-idea-plugin   File: FlexibleSearchParser.java   View source code 5 votes vote down vote up
public static boolean select_sublist(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "select_sublist")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, SELECT_SUBLIST, "<select sublist>");
  r = derived_column(b, l + 1);
  if (!r) r = select_sublist_1(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 11
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
public static boolean rawClassExpression(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "rawClassExpression")) return false;
  if (!nextTokenIsFast(b, RAW_LBR)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokens(b, 0, RAW_LBR, CLASS);
  r = r && identifier(b, l + 1);
  r = r && consumeToken(b, RAW_RBR);
  exit_section_(b, m, RAW_CLASS_EXPRESSION, r);
  return r;
}
 
Example 12
Project: Goal-Intellij-Plugin   File: ModuleParser.java   View source code 5 votes vote down vote up
static boolean orderProperty(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "orderProperty")) return false;
  if (!nextTokenIs(b, ORDER)) return false;
  boolean r, p;
  Marker m = enter_section_(b, l, _NONE_);
  r = consumeTokens(b, 1, ORDER, EQ, ORDER_VAL, DOT);
  p = r; // pin = 1
  exit_section_(b, l, m, r, p, null);
  return r || p;
}
 
Example 13
Project: AppleScript-IDEA   File: AppleScriptGeneratedParserUtil.java   View source code 5 votes vote down vote up
/**
 * @param b PsiBuilder
 * @return Returns application name inside targeted to application blocks of
 * code: "tell"/"using terms from" statements. <br> If nothing found - returns available to all scripting
 * application CocoaStandard library name
 */
@NotNull
private static String getTargetApplicationName(PsiBuilder b) {
  String toldApplicationName = peekTargetApplicationName(b);
  // CocoaStandard library is always available for the scriptable application
  return toldApplicationName != null ? toldApplicationName : ApplicationDictionary.COCOA_STANDARD_LIBRARY;
}
 
Example 14
Project: hybris-integration-intellij-idea-plugin   File: FlexibleSearchParser.java   View source code 5 votes vote down vote up
private static boolean identifier_chain_1_0_0_1(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "identifier_chain_1_0_0_1")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, IDENTIFIER);
  if (!r) r = consumeToken(b, COLUMN_REFERENCE_IDENTIFIER);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 15
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
public static boolean builtInClassIdentifierPlural(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "builtInClassIdentifierPlural")) return false;
  if (!nextTokenIs(b, "<built in class identifier plural>", BUILT_IN_TYPE_S, SCRIPTS)) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, BUILT_IN_CLASS_IDENTIFIER_PLURAL, "<built in class identifier plural>");
  r = consumeToken(b, BUILT_IN_TYPE_S);
  if (!r) r = consumeToken(b, SCRIPTS);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 16
Project: AppleScript-IDEA   File: AppleScriptGeneratedParserUtil.java   View source code 5 votes vote down vote up
public static boolean parseAssignmentStatementInner(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "parseAssignmentStatementInner")) return false;
  boolean r;
  b.putUserData(PARSING_COMMAND_ASSIGNMENT_STATEMENT, true);
  r = AppleScriptParser.assignmentStatement(b, l + 1);
  b.putUserData(PARSING_COMMAND_ASSIGNMENT_STATEMENT, false);
  return r;
}
 
Example 17
Project: Goal-Intellij-Plugin   File: TestParser.java   View source code 5 votes vote down vote up
static boolean simpleQuery(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "simpleQuery")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = selectorQuery(b, l + 1);
  if (!r) r = predicate(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 18
Project: Goal-Intellij-Plugin   File: PrologParser.java   View source code 5 votes vote down vote up
public static boolean predicate(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "predicate")) return false;
  if (!nextTokenIs(b, ATOM)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, ATOM);
  r = r && predicate_1(b, l + 1);
  exit_section_(b, m, PREDICATE, r);
  return r;
}
 
Example 19
Project: hybris-integration-intellij-idea-plugin   File: FlexibleSearchParser.java   View source code 5 votes vote down vote up
public static boolean sort_specification_list(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "sort_specification_list")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, SORT_SPECIFICATION_LIST, "<sort specification list>");
  r = sort_specification(b, l + 1);
  r = r && sort_specification_list_1(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 20
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
static boolean objectPointer(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "objectPointer")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, OF);
  if (!r) r = consumeToken(b, IN);
  if (!r) r = consumeToken(b, APS);
  if (!r) r = isPossessivePpronoun(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 21
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
private static boolean countCommandExpression_0_1_0_2(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "countCommandExpression_0_1_0_2")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokenFast(b, IN);
  if (!r) r = consumeTokenFast(b, OF);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 22
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
private static boolean handlerLabeledParametersCallExpression_0_2_1_0_1_2_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "handlerLabeledParametersCallExpression_0_2_1_0_1_2_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokenFast(b, COMMA);
  r = r && labelForFalseParam(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 23
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
static boolean offendingObject(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "offendingObject")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = offendingObject_0(b, l + 1);
  if (!r) r = expression(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 24
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
private static boolean stopValue_0_1(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "stopValue_0_1")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _AND_);
  r = consumeToken(b, BY);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 25
Project: hybris-integration-intellij-idea-plugin   File: FlexibleSearchParser.java   View source code 5 votes vote down vote up
public static boolean table_expression(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "table_expression")) return false;
  if (!nextTokenIs(b, FROM)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = from_clause(b, l + 1);
  r = r && table_expression_1(b, l + 1);
  r = r && table_expression_2(b, l + 1);
  r = r && table_expression_3(b, l + 1);
  exit_section_(b, m, TABLE_EXPRESSION, r);
  return r;
}
 
Example 26
Project: greycat-idea-plugin   File: GCMParser.java   View source code 5 votes vote down vote up
public static boolean ACTION_DECLARATION(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "ACTION_DECLARATION")) return false;
  if (!nextTokenIs(b, IDENT)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, IDENT);
  r = r && ACTION_DECLARATION_1(b, l + 1);
  exit_section_(b, m, ACTION_DECLARATION, r);
  return r;
}
 
Example 27
Project: Goal-Intellij-Plugin   File: ModuleParser.java   View source code 5 votes vote down vote up
private static boolean termList_1_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "termList_1_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, COMMA);
  r = r && term(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 28
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
private static boolean ignoringStatement_3_0_3_0_1_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "ignoringStatement_3_0_3_0_1_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, LAND);
  r = r && considerOrIgnoreAttr(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 29
Project: hybris-integration-intellij-idea-plugin   File: FlexibleSearchParser.java   View source code 5 votes vote down vote up
static boolean column_reference_recover(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "column_reference_recover")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NOT_);
  r = !column_reference_recover_0(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 30
Project: Goal-Intellij-Plugin   File: MasParser.java   View source code 5 votes vote down vote up
private static boolean launchRule_0_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "launchRule_0_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, WHEN);
  r = r && entity(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 31
Project: Goal-Intellij-Plugin   File: TestParser.java   View source code 5 votes vote down vote up
public static boolean basicTerm(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "basicTerm")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, BASIC_TERM, "<term>");
  r = predicate(b, l + 1);
  if (!r) r = consumeToken(b, VARIABLE);
  if (!r) r = number(b, l + 1);
  if (!r) r = string(b, l + 1);
  if (!r) r = basicTerm_4(b, l + 1);
  if (!r) r = list(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 32
Project: Goal-Intellij-Plugin   File: MasParser.java   View source code 5 votes vote down vote up
private static boolean entity_2(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "entity_2")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokens(b, 0, NAME, EQ);
  r = r && simpleIdentifier(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 33
Project: hybris-integration-intellij-idea-plugin   File: ImpexParser.java   View source code 5 votes vote down vote up
private static boolean modifiers_1_1_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "modifiers_1_1_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, ATTRIBUTE_SEPARATOR);
  r = r && modifiers_1_1_0_1(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 34
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
private static boolean countCommandExpression_1(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "countCommandExpression_1")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeTokens(b, 0, NUMBER, OF);
  r = r && countCommandExpression_1_2(b, l + 1);
  r = r && composite_value(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 35
Project: Goal-Intellij-Plugin   File: MasParser.java   View source code 5 votes vote down vote up
private static boolean instruction_1_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "instruction_1_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, WITH);
  r = r && constraintList(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 36
Project: hybris-integration-intellij-idea-plugin   File: ImpexParser.java   View source code 5 votes vote down vote up
private static boolean any_attribute_value_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "any_attribute_value_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, ATTRIBUTE_VALUE);
  if (!r) r = consumeToken(b, BOOLEAN);
  if (!r) r = consumeToken(b, DIGIT);
  if (!r) r = string(b, l + 1);
  if (!r) r = macro_usage_dec(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 37
Project: Goal-Intellij-Plugin   File: MasParser.java   View source code 5 votes vote down vote up
public static boolean useClause(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "useClause")) return false;
  if (!nextTokenIs(b, USE)) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, USE);
  r = r && moduleId(b, l + 1);
  r = r && consumeToken(b, AS);
  r = r && useCase(b, l + 1);
  r = r && consumeToken(b, DOT);
  exit_section_(b, m, USE_CLAUSE, r);
  return r;
}
 
Example 38
Project: Goal-Intellij-Plugin   File: TestParser.java   View source code 5 votes vote down vote up
public static boolean rule(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "rule")) return false;
  boolean r;
  Marker m = enter_section_(b, l, _NONE_, RULE, "<rule>");
  r = leadstoRule(b, l + 1);
  if (!r) r = eventuallyRule(b, l + 1);
  exit_section_(b, l, m, r, false, null);
  return r;
}
 
Example 39
Project: greycat-idea-plugin   File: GCMParser.java   View source code 5 votes vote down vote up
private static boolean NTUPLE_VALUE_2_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "NTUPLE_VALUE_2_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, COMMA);
  r = r && NTUPLE_VALUE_2_0_1(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}
 
Example 40
Project: AppleScript-IDEA   File: AppleScriptParser.java   View source code 5 votes vote down vote up
private static boolean consideringStatement_2_0_1_0(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "consideringStatement_2_0_1_0")) return false;
  boolean r;
  Marker m = enter_section_(b);
  r = consumeToken(b, LAND);
  r = r && considerOrIgnoreAttr(b, l + 1);
  exit_section_(b, m, null, r);
  return r;
}