Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
  /**
   * 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;
  }
Ejemplo n.º 3
0
 public static boolean parseExpressionLevel(PsiBuilder b, int l, int g) {
   return PerlParser.expr(b, l, g);
 }