/** * Parses parenthesised list or parenthesised list element. To avoid double parenthesised * expression parsing * * @param b PerlBuilder * @param l parsing level * @return parsing result */ public static boolean parseListOrListElement(PsiBuilder b, int l) { PsiBuilder.Marker m = b.mark(); if (PerlParser.parenthesised_expr(b, l)) { if (PerlParser.array_index(b, l)) m.done(ANON_ARRAY_ELEMENT); else m.drop(); return true; } m.drop(); return false; }
/** * Parses comma sequence with trailing comma support * * @param b PerlBuilder * @param l parsing level * @return parsing result */ public static boolean parseCommaSequence(PsiBuilder b, int l) { boolean r = false; while (true) { if (consumeToken(b, OPERATOR_COMMA) || consumeToken(b, OPERATOR_COMMA_ARROW)) // got comma { r = true; // consume sequential commas while (true) { if (!(consumeToken(b, OPERATOR_COMMA) || consumeToken(b, OPERATOR_COMMA_ARROW))) break; } ; if (!PerlParser.expr(b, l, 4)) // looks like an end break; } else break; } return r; }
public static boolean parseExpressionLevel(PsiBuilder b, int l, int g) { return PerlParser.expr(b, l, g); }