com.intellij.lang.PsiBuilder Java Examples
The following examples show how to use
com.intellij.lang.PsiBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RTJSParser.java From react-templates-plugin with MIT License | 6 votes |
@Override protected boolean parseUnaryExpression() { final IElementType tokenType = builder.getTokenType(); if (tokenType == JSTokenTypes.OR) { builder.advanceLexer(); if (!parseFilter()) { builder.error("expected filter"); } return true; } if (tokenType == RTTokenTypes.ONE_TIME_BINDING) { final PsiBuilder.Marker expr = builder.mark(); builder.advanceLexer(); if (!super.parseUnaryExpression()) { builder.error(JSBundle.message("javascript.parser.message.expected.expression")); } expr.done(JSElementTypes.PREFIX_EXPRESSION); return true; } return super.parseUnaryExpression(); }
Example #2
Source File: ExpressionParsing.java From intellij with Apache License 2.0 | 6 votes |
/** funcall_suffix ::= '(' arg_list? ')' arg_list ::= ((arg ',')* arg ','? )? */ private void parseFuncallSuffix() { PsiBuilder.Marker mark = builder.mark(); expect(TokenKind.LPAREN, true); if (matches(TokenKind.RPAREN)) { mark.done(BuildElementTypes.ARGUMENT_LIST); return; } parseFuncallArgument(); while (!atAnyOfTokens(FUNCALL_TERMINATOR_SET)) { expect(TokenKind.COMMA); if (atAnyOfTokens(FUNCALL_TERMINATOR_SET)) { break; } parseFuncallArgument(); } expect(TokenKind.RPAREN, true); mark.done(BuildElementTypes.ARGUMENT_LIST); }
Example #3
Source File: ExpressionParsing.java From consulo-csharp with Apache License 2.0 | 6 votes |
private static PsiBuilder.Marker parseExpressionWithTypeInLParRPar(CSharpBuilderWrapper builder, int flags, PsiBuilder.Marker mark, IElementType to) { PsiBuilder.Marker newMarker = mark == null ? builder.mark() : mark.precede(); builder.advanceLexer(); if(expect(builder, LPAR, "'(' expected")) { if(parseType(builder, flags, TokenSet.EMPTY) == null) { builder.error("Type expected"); } expect(builder, RPAR, "')' expected"); } newMarker.done(to); return newMarker; }
Example #4
Source File: GLSLParsing.java From glsl4idea with GNU Lesser General Public License v3.0 | 6 votes |
/** * Parse type specifier. * onlyBuildIn can be used to accept as types only tokens in TYPE_SPECIFIER_NONARRAY_TOKENS. * This can be used in for example parsing constructors. * * @param onlyBuiltIn if true, only build-in type specifiers are considered valid */ private boolean parseTypeSpecifier(boolean onlyBuiltIn) { // type_specifier_noarray // type_specifier_noarray "[" const_expr "]" final PsiBuilder.Marker mark = b.mark(); if (!parseTypeSpecifierNoArray(onlyBuiltIn)) { mark.drop(); return false; } if (b.getTokenType() == LEFT_BRACKET) { parseArrayDeclarator(); } mark.done(TYPE_SPECIFIER); return true; }
Example #5
Source File: GLSLParsing.java From glsl4idea with GNU Lesser General Public License v3.0 | 6 votes |
private void parseParameterDeclaration() { // parameter_declaration: [parameter_qualifier] [type_qualifier] IDENTIFIER [array_declarator] final PsiBuilder.Marker mark = b.mark(); parseQualifiedTypeSpecifier(); if (b.getTokenType() == IDENTIFIER) { parseStructOrParameterDeclarator(PARAMETER_DECLARATOR); } else { // Fake a declarator. PsiBuilder.Marker mark2 = b.mark(); mark2.done(PARAMETER_DECLARATOR); } mark.done(PARAMETER_DECLARATION); }
Example #6
Source File: HaskellParser.java From intellij-haskforce with Apache License 2.0 | 5 votes |
private static boolean itdecl_1_2_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "itdecl_1_2_0")) return false; boolean r; Marker m = enter_section_(b); r = itdecl_1_2_0_0(b, l + 1); r = r && gadtconstrs(b, l + 1); exit_section_(b, m, null, r); return r; }
Example #7
Source File: SpecParser.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
public static boolean scenario(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "scenario")) return false; if (!nextTokenIs(b, "<scenario>", COMMENT, SCENARIO_HEADING)) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, SCENARIO, "<scenario>"); r = scenario_0(b, l + 1); r = r && scenarioHeading(b, l + 1); r = r && scenario_2(b, l + 1); r = r && scenario_3(b, l + 1); r = r && scenario_4(b, l + 1); r = r && scenario_5(b, l + 1); exit_section_(b, l, m, r, false, null); return r; }
Example #8
Source File: SharedParsingHelpers.java From consulo-csharp with Apache License 2.0 | 5 votes |
public static boolean expectOrReportIdentifier(PsiBuilder builder, int flags) { if(builder.getTokenType() == CSharpTokens.IDENTIFIER) { doneIdentifier(builder, flags); return true; } else { reportIdentifier(builder, flags); return false; } }
Example #9
Source File: NixParser.java From nix-idea with Apache License 2.0 | 5 votes |
private static boolean attr_path_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "attr_path_1")) return false; int c = current_position_(b); while (true) { if (!attr_path_1_0(b, l + 1)) break; if (!empty_element_parsed_guard_(b, "attr_path_1", c)) break; c = current_position_(b); } return true; }
Example #10
Source File: ConceptParser.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
public static boolean table(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "table")) return false; if (!nextTokenIs(b, TABLE_BORDER)) return false; boolean r; Marker m = enter_section_(b); r = tableHeader(b, l + 1); r = r && tableBody(b, l + 1); exit_section_(b, m, TABLE, r); return r; }
Example #11
Source File: MelParser.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
static boolean mapExpressionSequence(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "mapExpressionSequence")) return false; boolean r; Marker m = enter_section_(b); r = mapEntryElement(b, l + 1); r = r && mapExpressionSequence_1(b, l + 1); exit_section_(b, m, null, r); return r; }
Example #12
Source File: HaskellParser.java From intellij-haskforce with Apache License 2.0 | 5 votes |
public static boolean vars(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "vars")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, VARS, "<vars>"); r = sequence(b, l + 1, var_parser_); exit_section_(b, l, m, r, false, null); return r; }
Example #13
Source File: SQFParser.java From arma-intellij-plugin with MIT License | 5 votes |
public static boolean expression(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "expression")) return false; boolean r; Marker m = enter_section_(b, l, _COLLAPSE_, EXPRESSION, "<expression>"); r = command_expression(b, l + 1); if (!r) r = signed_expression(b, l + 1); if (!r) r = literal_expression(b, l + 1); if (!r) r = code_block_expression(b, l + 1); if (!r) r = paren_expression(b, l + 1); exit_section_(b, l, m, r, false, null); return r; }
Example #14
Source File: ExpressionParsing.java From consulo-csharp with Apache License 2.0 | 5 votes |
private static PsiBuilder.Marker parseOutRefWrapExpression(CSharpBuilderWrapper builder, ModifierSet set) { PsiBuilder.Marker mark = builder.mark(); builder.advanceLexer(); PsiBuilder.Marker possibleVarMark = builder.mark(); if(parseType(builder, VAR_SUPPORT) != null && builder.getTokenType() == CSharpTokens.IDENTIFIER) { doneIdentifier(builder, NONE); possibleVarMark.done(OUT_REF_VARIABLE); mark.done(OUT_REF_VARIABLE_EXPRESSION); } else { possibleVarMark.rollbackTo(); if(parse(builder, set) == null) { builder.error("Expression expected"); } mark.done(OUT_REF_WRAP_EXPRESSION); } return mark; }
Example #15
Source File: SharedParsingHelpers.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull protected static <T> Pair<PsiBuilder.Marker, T> parseWithSoftElements(Function<CSharpBuilderWrapper, Pair<PsiBuilder.Marker, T>> func, CSharpBuilderWrapper builderWrapper, TokenSet softs) { builderWrapper.enableSoftKeywords(softs); Pair<PsiBuilder.Marker, T> fun = func.apply(builderWrapper); builderWrapper.disableSoftKeywords(softs); return fun; }
Example #16
Source File: CypherParser.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
public static boolean Pattern(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Pattern")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, PATTERN, "<pattern>"); r = PatternPart(b, l + 1); r = r && Pattern_1(b, l + 1); exit_section_(b, l, m, r, false, null); return r; }
Example #17
Source File: SpecParser.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
public static boolean table(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "table")) return false; if (!nextTokenIs(b, TABLE_BORDER)) return false; boolean r; Marker m = enter_section_(b); r = tableHeader(b, l + 1); r = r && tableBody(b, l + 1); exit_section_(b, m, TABLE, r); return r; }
Example #18
Source File: JSGraphQLEndpointParser.java From js-graphql-intellij-plugin with MIT License | 5 votes |
private static boolean RecoverCommaNamedType_0(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "RecoverCommaNamedType_0")) return false; boolean result_; result_ = consumeToken(builder_, LBRACE); if (!result_) result_ = consumeToken(builder_, COMMA); if (!result_) result_ = DefinitionKeyword(builder_, level_ + 1); if (!result_) result_ = consumeToken(builder_, IDENTIFIER); return result_; }
Example #19
Source File: MelParser.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private static boolean variableAssignmentExpression_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "variableAssignmentExpression_0")) return false; boolean r; Marker m = enter_section_(b); r = consumeTokenSmart(b, IDENTIFIER); r = r && consumeToken(b, EQ); r = r && expression(b, l + 1, -1); exit_section_(b, m, null, r); return r; }
Example #20
Source File: GraphQLParser.java From js-graphql-intellij-plugin with MIT License | 5 votes |
private static boolean fragmentName_0(PsiBuilder builder, int level) { if (!recursion_guard_(builder, level, "fragmentName_0")) return false; boolean result; Marker marker = enter_section_(builder, level, _NOT_); result = !consumeToken(builder, ON_KEYWORD); exit_section_(builder, level, marker, result, false, null); return result; }
Example #21
Source File: HaskellParser.java From intellij-haskforce with Apache License 2.0 | 5 votes |
static boolean fielddecl(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "fielddecl")) return false; boolean r, p; Marker m = enter_section_(b, l, _NONE_); r = vars(b, l + 1); r = r && consumeToken(b, DOUBLECOLON); p = r; // pin = 2 r = r && fielddecl_2(b, l + 1); exit_section_(b, l, m, r, p, null); return r || p; }
Example #22
Source File: NASMParser.java From JetBrains-NASM-Language with MIT License | 5 votes |
private static boolean MacroCall_3(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "MacroCall_3")) return false; while (true) { int c = current_position_(b); if (!MacroCall_3_0(b, l + 1)) break; if (!empty_element_parsed_guard_(b, "MacroCall_3", c)) break; } return true; }
Example #23
Source File: ConceptParser.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
private static boolean conceptHeading_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "conceptHeading_0")) return false; boolean r; Marker m = enter_section_(b); r = consumeToken(b, CONCEPT_HEADING_IDENTIFIER); r = r && conceptHeading_0_1(b, l + 1); r = r && consumeToken(b, NEW_LINE); exit_section_(b, m, null, r); return r; }
Example #24
Source File: CypherParser.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
public static boolean FunctionInvocationBody(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "FunctionInvocationBody")) return false; boolean r; Marker m = enter_section_(b, l, _NONE_, FUNCTION_INVOCATION_BODY, "<function invocation body>"); r = Namespace(b, l + 1); r = r && FunctionName(b, l + 1); exit_section_(b, l, m, r, false, null); return r; }
Example #25
Source File: NASMParser.java From JetBrains-NASM-Language with MIT License | 5 votes |
private static boolean Section_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Section_0")) return false; boolean r; Marker m = enter_section_(b); r = consumeTokens(b, 0, SQUARE_L, SECTION, SQUARE_R); exit_section_(b, m, null, r); return r; }
Example #26
Source File: HaskellParser.java From intellij-haskforce with Apache License 2.0 | 5 votes |
public static boolean typee(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "typee")) return false; boolean r, p; Marker m = enter_section_(b, l, _NONE_, TYPEE, "<typee>"); r = btype(b, l + 1); p = r; // pin = 1 r = r && typee_1(b, l + 1); exit_section_(b, l, m, r, p, null); return r || p; }
Example #27
Source File: JSGraphQLEndpointParser.java From js-graphql-intellij-plugin with MIT License | 5 votes |
static boolean PipeUnionMember(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "PipeUnionMember")) return false; if (!nextTokenIs(builder_, PIPE)) return false; boolean result_, pinned_; Marker marker_ = enter_section_(builder_, level_, _NONE_); result_ = consumeToken(builder_, PIPE); pinned_ = result_; // pin = 1 result_ = result_ && UnionMember(builder_, level_ + 1); exit_section_(builder_, level_, marker_, result_, pinned_, null); return result_ || pinned_; }
Example #28
Source File: NASMParser.java From JetBrains-NASM-Language with MIT License | 5 votes |
private static boolean DataValue_2_0_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "DataValue_2_0_1")) return false; boolean r; Marker m = enter_section_(b); r = DataValue_2_0_1_0(b, l + 1); r = r && DataValue_2_0_1_1(b, l + 1); exit_section_(b, m, null, r); return r; }
Example #29
Source File: HaskellParser.java From intellij-haskforce with Apache License 2.0 | 5 votes |
private static boolean itdecl_1_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "itdecl_1_0")) return false; boolean r; Marker m = enter_section_(b); r = consumeToken(b, DATA); if (!r) r = consumeToken(b, NEWTYPE); exit_section_(b, m, null, r); return r; }
Example #30
Source File: NASMParser.java From JetBrains-NASM-Language with MIT License | 5 votes |
public static boolean Struc(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Struc")) return false; if (!nextTokenIs(b, STRUC_TAG)) return false; boolean r; Marker m = enter_section_(b); r = consumeToken(b, STRUC_TAG); r = r && Identifier(b, l + 1); r = r && Struc_2(b, l + 1); r = r && Struc_3(b, l + 1); r = r && consumeToken(b, ENDSTRUC_TAG); exit_section_(b, m, STRUC, r); return r; }