// This is a generated file. Not intended for manual editing.
package org.jetbrains.plugins.groovy.lang.parser;

import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import static org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.*;
import static org.jetbrains.plugins.groovy.lang.parser.GroovyParserUtils.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.tree.TokenSet;
import com.intellij.lang.PsiParser;
import com.intellij.lang.LightPsiParser;
import static com.intellij.lang.parser.GeneratedParserUtilBase.*;
import static org.jetbrains.plugins.groovy.lang.parser.GroovyGeneratedParserUtils.adapt_builder_;

@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
public class GroovyGeneratedParser implements PsiParser, LightPsiParser {

  public ASTNode parse(IElementType t, PsiBuilder b) {
    parseLight(t, b);
    return b.getTreeBuilt();
  }

  public void parseLight(IElementType t, PsiBuilder b) {
    boolean r;
    b = adapt_builder_(t, b, this, EXTENDS_SETS_);
    Marker m = enter_section_(b, 0, _COLLAPSE_, null);
    r = parse_root_(t, b);
    exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
  }

  protected boolean parse_root_(IElementType t, PsiBuilder b) {
    return parse_root_(t, b, 0);
  }

  static boolean parse_root_(IElementType t, PsiBuilder b, int l) {
    boolean r;
    if (t == ANNOTATION) {
      r = annotation(b, l + 1);
    }
    else if (t == ANNOTATION_MEMBER_VALUE_PAIR) {
      r = annotation_member_value_pair(b, l + 1);
    }
    else if (t == BLOCK_LAMBDA_BODY) {
      r = block_lambda_body(b, l + 1);
    }
    else if (t == BLOCK_LAMBDA_BODY_SWITCH_AWARE) {
      r = block_lambda_body_switch_aware(b, l + 1);
    }
    else if (t == BLOCK_STATEMENT) {
      r = block_statement(b, l + 1);
    }
    else if (t == CLOSURE) {
      r = closure(b, l + 1);
    }
    else if (t == CLOSURE_SWITCH_AWARE) {
      r = closure_switch_aware(b, l + 1);
    }
    else if (t == CODE_REFERENCE) {
      r = code_reference(b, l + 1);
    }
    else if (t == CONSTRUCTOR_BLOCK) {
      r = constructor_block(b, l + 1);
    }
    else if (t == OPEN_BLOCK) {
      r = open_block(b, l + 1);
    }
    else if (t == OPEN_BLOCK_SWITCH_AWARE) {
      r = open_block_switch_aware(b, l + 1);
    }
    else if (t == TYPE_ELEMENT) {
      r = type_element(b, l + 1);
    }
    else {
      r = root(b, l + 1);
    }
    return r;
  }

  public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] {
    create_token_set_(ARRAY_TYPE_ELEMENT, CLASS_TYPE_ELEMENT, DISJUNCTION_TYPE_ELEMENT, PRIMITIVE_TYPE_ELEMENT,
      TYPE_ELEMENT, WILDCARD_TYPE_ELEMENT),
    create_token_set_(ADDITIVE_EXPRESSION, APPLICATION_EXPRESSION, ASSIGNMENT_EXPRESSION, AS_EXPRESSION,
      ATTRIBUTE_EXPRESSION, BAND_EXPRESSION, BOR_EXPRESSION, BUILT_IN_TYPE_EXPRESSION,
      CAST_EXPRESSION, CLOSURE, CONSTRUCTOR_CALL_EXPRESSION, ELVIS_EXPRESSION,
      EQUALITY_EXPRESSION, EXPRESSION, GSTRING, IMPL_EXPRESSION,
      INDEX_EXPRESSION, INSTANCEOF_EXPRESSION, IN_EXPRESSION, LAMBDA_EXPRESSION,
      LAND_EXPRESSION, LIST_OR_MAP, LITERAL, LOR_EXPRESSION,
      METHOD_CALL_EXPRESSION, METHOD_REFERENCE_EXPRESSION, MULTIPLICATIVE_EXPRESSION, NEW_EXPRESSION,
      PARENTHESIZED_EXPRESSION, POWER_EXPRESSION, PROPERTY_EXPRESSION, RANGE_EXPRESSION,
      REFERENCE_EXPRESSION, REGEX, REGEX_FIND_EXPRESSION, REGEX_MATCH_EXPRESSION,
      RELATIONAL_EXPRESSION, SHIFT_EXPRESSION, SWITCH_EXPRESSION, TERNARY_EXPRESSION,
      TUPLE_ASSIGNMENT_EXPRESSION, UNARY_EXPRESSION, XOR_EXPRESSION),
  };

  /* ********************************************************** */
  // <<a>> (<<b>> <<a>>)*
  static boolean a_b_a(PsiBuilder b, int l, Parser _a, Parser _b) {
    if (!recursion_guard_(b, l, "a_b_a")) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = _a.parse(b, l);
    p = r; // pin = 1
    r = r && a_b_a_1(b, l + 1, _b, _a);
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  // (<<b>> <<a>>)*
  private static boolean a_b_a_1(PsiBuilder b, int l, Parser _b, Parser _a) {
    if (!recursion_guard_(b, l, "a_b_a_1")) return false;
    while (true) {
      int c = current_position_(b);
      if (!a_b_a_1_0(b, l + 1, _b, _a)) break;
      if (!empty_element_parsed_guard_(b, "a_b_a_1", c)) break;
    }
    return true;
  }

  // <<b>> <<a>>
  private static boolean a_b_a_1_0(PsiBuilder b, int l, Parser _b, Parser _a) {
    if (!recursion_guard_(b, l, "a_b_a_1_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = _b.parse(b, l);
    r = r && _a.parse(b, l);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // <<a>> (<<b>> <<a>>)*
  static boolean a_b_a_p(PsiBuilder b, int l, Parser _a, Parser _b) {
    if (!recursion_guard_(b, l, "a_b_a_p")) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = _a.parse(b, l);
    p = r; // pin = 1
    r = r && a_b_a_p_1(b, l + 1, _b, _a);
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  // (<<b>> <<a>>)*
  private static boolean a_b_a_p_1(PsiBuilder b, int l, Parser _b, Parser _a) {
    if (!recursion_guard_(b, l, "a_b_a_p_1")) return false;
    while (true) {
      int c = current_position_(b);
      if (!a_b_a_p_1_0(b, l + 1, _b, _a)) break;
      if (!empty_element_parsed_guard_(b, "a_b_a_p_1", c)) break;
    }
    return true;
  }

  // <<b>> <<a>>
  private static boolean a_b_a_p_1_0(PsiBuilder b, int l, Parser _b, Parser _a) {
    if (!recursion_guard_(b, l, "a_b_a_p_1_0")) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = _b.parse(b, l);
    p = r; // pin = 1
    r = r && _a.parse(b, l);
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  /* ********************************************************** */
  // mb_nl annotation_argument_list | empty_annotation_argument_list
  static boolean after_annotation_reference(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_annotation_reference")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = after_annotation_reference_0(b, l + 1);
    if (!r) r = empty_annotation_argument_list(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // mb_nl annotation_argument_list
  private static boolean after_annotation_reference_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_annotation_reference_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && annotation_argument_list(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // <<mb_nl_group (type_argument_list? qualified_reference_expression_identifiers)>>
  static boolean after_dot(PsiBuilder b, int l) {
    return mb_nl_group(b, l + 1, GroovyGeneratedParser::after_dot_0_0);
  }

  // type_argument_list? qualified_reference_expression_identifiers
  private static boolean after_dot_0_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_dot_0_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = after_dot_0_0_0(b, l + 1);
    r = r && qualified_reference_expression_identifiers(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // type_argument_list?
  private static boolean after_dot_0_0_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_dot_0_0_0")) return false;
    type_argument_list(b, l + 1);
    return true;
  }

  /* ********************************************************** */
  // if_header mb_nl branch [mb_separators else_branch]
  static boolean after_if_keyword(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_if_keyword")) return false;
    if (!nextTokenIs(b, T_LPAREN)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = if_header(b, l + 1);
    p = r; // pin = 1
    r = r && report_error_(b, mb_nl(b, l + 1));
    r = p && report_error_(b, branch(b, l + 1)) && r;
    r = p && after_if_keyword_3(b, l + 1) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  // [mb_separators else_branch]
  private static boolean after_if_keyword_3(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_if_keyword_3")) return false;
    after_if_keyword_3_0(b, l + 1);
    return true;
  }

  // mb_separators else_branch
  private static boolean after_if_keyword_3_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_if_keyword_3_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_separators(b, l + 1);
    r = r && else_branch(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // ':' mb_nl statement
  static boolean after_label(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_label")) return false;
    if (!nextTokenIsFast(b, T_COLON)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = consumeTokenFast(b, T_COLON);
    p = r; // pin = 1
    r = r && report_error_(b, mb_nl(b, l + 1));
    r = p && statement(b, l + 1) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  /* ********************************************************** */
  // while_header mb_nl while_body
  static boolean after_while(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "after_while")) return false;
    if (!nextTokenIs(b, T_LPAREN)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = while_header(b, l + 1);
    p = r; // pin = 1
    r = r && report_error_(b, mb_nl(b, l + 1));
    r = p && while_body(b, l + 1) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  /* ********************************************************** */
  // (non_empty_annotation_list <<forceWrapLeft <<item>>>>) | <<item>>
  static boolean annotated(PsiBuilder b, int l, Parser _item) {
    if (!recursion_guard_(b, l, "annotated")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = annotated_0(b, l + 1, _item);
    if (!r) r = _item.parse(b, l);
    exit_section_(b, m, null, r);
    return r;
  }

  // non_empty_annotation_list <<forceWrapLeft <<item>>>>
  private static boolean annotated_0(PsiBuilder b, int l, Parser _item) {
    if (!recursion_guard_(b, l, "annotated_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = non_empty_annotation_list(b, l + 1);
    r = r && forceWrapLeft(b, l + 1, _item);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // '@' annotation_reference after_annotation_reference
  public static boolean annotation(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation")) return false;
    if (!nextTokenIsFast(b, T_AT)) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = consumeTokenFast(b, T_AT);
    r = r && annotation_reference(b, l + 1);
    r = r && after_annotation_reference(b, l + 1);
    exit_section_(b, m, ANNOTATION, r);
    return r;
  }

  /* ********************************************************** */
  // <<paren_list annotation_member_value_pair>>
  public static boolean annotation_argument_list(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_argument_list")) return false;
    if (!nextTokenIs(b, T_LPAREN)) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = paren_list(b, l + 1, GroovyGeneratedParser::annotation_member_value_pair);
    exit_section_(b, m, ANNOTATION_ARGUMENT_LIST, r);
    return r;
  }

  /* ********************************************************** */
  // mb_nl <<separated_item annotation_array_item_end annotation_value annotation_array_item_start>>
  static boolean annotation_array_item(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_item")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && separated_item(b, l + 1, GroovyGeneratedParser::annotation_array_item_end, GroovyGeneratedParser::annotation_value, GroovyGeneratedParser::annotation_array_item_start);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // mb_nl (',' | &']' | end_of_file)
  static boolean annotation_array_item_end(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_item_end")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && annotation_array_item_end_1(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // ',' | &']' | end_of_file
  private static boolean annotation_array_item_end_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_item_end_1")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = consumeToken(b, T_COMMA);
    if (!r) r = annotation_array_item_end_1_1(b, l + 1);
    if (!r) r = eof(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // &']'
  private static boolean annotation_array_item_end_1_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_item_end_1_1")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _AND_);
    r = consumeToken(b, T_RBRACK);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // '@' | expression_start
  static boolean annotation_array_item_start(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_item_start")) return false;
    boolean r;
    r = consumeToken(b, T_AT);
    if (!r) r = expression_start(b, l + 1);
    return r;
  }

  /* ********************************************************** */
  // '[' annotation_array_item* (mb_nl ']')
  public static boolean annotation_array_value(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_value")) return false;
    if (!nextTokenIs(b, T_LBRACK)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_, ANNOTATION_ARRAY_VALUE, null);
    r = consumeToken(b, T_LBRACK);
    p = r; // pin = 1
    r = r && report_error_(b, annotation_array_value_1(b, l + 1));
    r = p && annotation_array_value_2(b, l + 1) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  // annotation_array_item*
  private static boolean annotation_array_value_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_value_1")) return false;
    while (true) {
      int c = current_position_(b);
      if (!annotation_array_item(b, l + 1)) break;
      if (!empty_element_parsed_guard_(b, "annotation_array_value_1", c)) break;
    }
    return true;
  }

  // mb_nl ']'
  private static boolean annotation_array_value_2(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_array_value_2")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && consumeToken(b, T_RBRACK);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // '{' mb_nl <<disableCompactConstructors annotation_members>> '}'
  public static boolean annotation_body(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_body")) return false;
    if (!nextTokenIs(b, T_LBRACE)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_, CLASS_BODY, null);
    r = consumeToken(b, T_LBRACE);
    p = r; // pin = 1
    r = r && report_error_(b, mb_nl(b, l + 1));
    r = p && report_error_(b, disableCompactConstructors(b, l + 1, GroovyGeneratedParser::annotation_members)) && r;
    r = p && consumeToken(b, T_RBRACE) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  /* ********************************************************** */
  // IDENTIFIER
  static boolean annotation_definition_header(PsiBuilder b, int l) {
    return consumeToken(b, IDENTIFIER);
  }

  /* ********************************************************** */
  // weak_keyword | IDENTIFIER | 'as' | 'def' | 'in'
  static boolean annotation_key(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_key")) return false;
    boolean r;
    r = weak_keyword(b, l + 1);
    if (!r) r = consumeToken(b, IDENTIFIER);
    if (!r) r = consumeToken(b, KW_AS);
    if (!r) r = consumeToken(b, KW_DEF);
    if (!r) r = consumeToken(b, KW_IN);
    return r;
  }

  /* ********************************************************** */
  // type_definition | parse_annotation_declaration
  static boolean annotation_level(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_level")) return false;
    boolean r;
    r = type_definition(b, l + 1);
    if (!r) r = parse_annotation_declaration(b, l + 1);
    return r;
  }

  /* ********************************************************** */
  // <<class_level_item annotation_level>>
  static boolean annotation_level_item(PsiBuilder b, int l) {
    return class_level_item(b, l + 1, GroovyGeneratedParser::annotation_level);
  }

  /* ********************************************************** */
  // annotation_key '=' annotation_value | annotation_value
  public static boolean annotation_member_value_pair(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_member_value_pair")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, ANNOTATION_MEMBER_VALUE_PAIR, "<annotation attribute>");
    r = annotation_member_value_pair_0(b, l + 1);
    if (!r) r = annotation_value(b, l + 1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  // annotation_key '=' annotation_value
  private static boolean annotation_member_value_pair_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_member_value_pair_0")) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = annotation_key(b, l + 1);
    r = r && consumeToken(b, T_ASSIGN);
    p = r; // pin = 2
    r = r && annotation_value(b, l + 1);
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  /* ********************************************************** */
  // annotation_level_item*
  static boolean annotation_members(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_members")) return false;
    while (true) {
      int c = current_position_(b);
      if (!annotation_level_item(b, l + 1)) break;
      if (!empty_element_parsed_guard_(b, "annotation_members", c)) break;
    }
    return true;
  }

  /* ********************************************************** */
  // method_identifier method_parameter_list [mb_nl annotation_method_default] nl_throws
  public static boolean annotation_method(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_method")) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_, ANNOTATION_METHOD, "<annotation method>");
    r = method_identifier(b, l + 1);
    r = r && method_parameter_list(b, l + 1);
    p = r; // pin = 2
    r = r && report_error_(b, annotation_method_2(b, l + 1));
    r = p && nl_throws(b, l + 1) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  // [mb_nl annotation_method_default]
  private static boolean annotation_method_2(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_method_2")) return false;
    annotation_method_2_0(b, l + 1);
    return true;
  }

  // mb_nl annotation_method_default
  private static boolean annotation_method_2_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_method_2_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && annotation_method_default(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // 'default' annotation_value
  static boolean annotation_method_default(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_method_default")) return false;
    if (!nextTokenIs(b, KW_DEFAULT)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _NONE_);
    r = consumeToken(b, KW_DEFAULT);
    p = r; // pin = 1
    r = r && annotation_value(b, l + 1);
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  /* ********************************************************** */
  // non_empty_annotation_list?
  public static boolean annotation_modifier_list(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_modifier_list")) return false;
    Marker m = enter_section_(b, l, _NONE_, MODIFIER_LIST, "<annotation modifier list>");
    non_empty_annotation_list(b, l + 1);
    exit_section_(b, l, m, true, false, null);
    return true;
  }

  /* ********************************************************** */
  // simple_reference
  static boolean annotation_reference(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_reference")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, null, "<annotation reference>");
    r = simple_reference(b, l + 1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // <<mb_nl_group (annotation_method | field_declaration)>>
  static boolean annotation_tails(PsiBuilder b, int l) {
    return mb_nl_group(b, l + 1, GroovyGeneratedParser::annotation_tails_0_0);
  }

  // annotation_method | field_declaration
  private static boolean annotation_tails_0_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_tails_0_0")) return false;
    boolean r;
    r = annotation_method(b, l + 1);
    if (!r) r = field_declaration(b, l + 1);
    return r;
  }

  /* ********************************************************** */
  // '@' ('interface') annotation_definition_header mb_nl annotation_body
  public static boolean annotation_type_definition(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_type_definition")) return false;
    if (!nextTokenIsFast(b, T_AT)) return false;
    boolean r, p;
    Marker m = enter_section_(b, l, _LEFT_, ANNOTATION_TYPE_DEFINITION, null);
    r = consumeTokenFast(b, T_AT);
    r = r && annotation_type_definition_1(b, l + 1);
    r = r && annotation_definition_header(b, l + 1);
    p = r; // pin = annotation_definition_header
    r = r && report_error_(b, mb_nl(b, l + 1));
    r = p && annotation_body(b, l + 1) && r;
    exit_section_(b, l, m, r, p, null);
    return r || p;
  }

  // ('interface')
  private static boolean annotation_type_definition_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_type_definition_1")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = consumeTokenFast(b, KW_INTERFACE);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // annotation | annotation_array_value | expression
  static boolean annotation_value(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "annotation_value")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, null, "<annotation attribute initializer>");
    r = annotation(b, l + 1);
    if (!r) r = annotation_array_value(b, l + 1);
    if (!r) r = expression(b, l + 1, -1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // <<annotated code_reference>> call_argument_list mb_nl_inside_parentheses class_body
  public static boolean anonymous_type_definition(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "anonymous_type_definition")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = annotated(b, l + 1, GroovyGeneratedParser::code_reference);
    r = r && call_argument_list(b, l + 1);
    r = r && mb_nl_inside_parentheses(b, l + 1);
    r = r && class_body(b, l + 1);
    exit_section_(b, m, ANONYMOUS_TYPE_DEFINITION, r);
    return r;
  }

  /* ********************************************************** */
  // <<anyTypeElement type_element>>
  static boolean any_type_element(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "any_type_element")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, null, "<type>");
    r = anyTypeElement(b, l + 1, GroovyGeneratedParser::type_element);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // <<parseApplication application_ref application_expression application_call application_index>>
  static boolean application(PsiBuilder b, int l) {
    return parseApplication(b, l + 1, GroovyGeneratedParser::application_ref, GroovyGeneratedParser::application_expression, GroovyGeneratedParser::application_call, GroovyGeneratedParser::application_index);
  }

  /* ********************************************************** */
  // <<applicationArguments application_arguments>>
  public static boolean application_argument_list(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_argument_list")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _NONE_, APPLICATION_ARGUMENT_LIST, "<application argument list>");
    r = applicationArguments(b, l + 1, GroovyGeneratedParser::application_arguments);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // weak_keyword
  //                                      | IDENTIFIER
  //                                      | simple_literal_tokens
  //                                      | GSTRING_BEGIN
  //                                      | primitive_type
  //                                      | '~' | '!'
  //                                      | 'this' | 'super'
  static boolean application_argument_start(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_argument_start")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = weak_keyword(b, l + 1);
    if (!r) r = consumeTokenFast(b, IDENTIFIER);
    if (!r) r = simple_literal_tokens(b, l + 1);
    if (!r) r = consumeTokenFast(b, GSTRING_BEGIN);
    if (!r) r = parsePrimitiveType(b, l + 1);
    if (!r) r = consumeTokenFast(b, T_BNOT);
    if (!r) r = consumeTokenFast(b, T_NOT);
    if (!r) r = consumeTokenFast(b, KW_THIS);
    if (!r) r = consumeTokenFast(b, KW_SUPER);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // argument (',' mb_nl argument)*
  static boolean application_arguments(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_arguments")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = argument(b, l + 1);
    r = r && application_arguments_1(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // (',' mb_nl argument)*
  private static boolean application_arguments_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_arguments_1")) return false;
    while (true) {
      int c = current_position_(b);
      if (!application_arguments_1_0(b, l + 1)) break;
      if (!empty_element_parsed_guard_(b, "application_arguments_1", c)) break;
    }
    return true;
  }

  // ',' mb_nl argument
  private static boolean application_arguments_1_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_arguments_1_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = consumeToken(b, T_COMMA);
    r = r && mb_nl(b, l + 1);
    r = r && argument(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // call_argument_list (mb_nl lazy_closure)* | empty_argument_list (mb_nl lazy_closure)+
  public static boolean application_call(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _LEFT_, METHOD_CALL_EXPRESSION, "<application call>");
    r = application_call_0(b, l + 1);
    if (!r) r = application_call_1(b, l + 1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  // call_argument_list (mb_nl lazy_closure)*
  private static boolean application_call_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = call_argument_list(b, l + 1);
    r = r && application_call_0_1(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // (mb_nl lazy_closure)*
  private static boolean application_call_0_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call_0_1")) return false;
    while (true) {
      int c = current_position_(b);
      if (!application_call_0_1_0(b, l + 1)) break;
      if (!empty_element_parsed_guard_(b, "application_call_0_1", c)) break;
    }
    return true;
  }

  // mb_nl lazy_closure
  private static boolean application_call_0_1_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call_0_1_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && lazy_closure(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // empty_argument_list (mb_nl lazy_closure)+
  private static boolean application_call_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call_1")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = empty_argument_list(b, l + 1);
    r = r && application_call_1_1(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  // (mb_nl lazy_closure)+
  private static boolean application_call_1_1(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call_1_1")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = application_call_1_1_0(b, l + 1);
    while (r) {
      int c = current_position_(b);
      if (!application_call_1_1_0(b, l + 1)) break;
      if (!empty_element_parsed_guard_(b, "application_call_1_1", c)) break;
    }
    exit_section_(b, m, null, r);
    return r;
  }

  // mb_nl lazy_closure
  private static boolean application_call_1_1_0(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_call_1_1_0")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = mb_nl(b, l + 1);
    r = r && lazy_closure(b, l + 1);
    exit_section_(b, m, null, r);
    return r;
  }

  /* ********************************************************** */
  // application_argument_list | clear_variants_and_fail
  public static boolean application_expression(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_expression")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _LEFT_, APPLICATION_EXPRESSION, "<application expression>");
    r = application_argument_list(b, l + 1);
    if (!r) r = clear_variants_and_fail(b, l + 1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // mb_question index_expression_argument_list
  public static boolean application_index(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_index")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _LEFT_, APPLICATION_INDEX, "<application index>");
    r = mb_question(b, l + 1);
    r = r && index_expression_argument_list(b, l + 1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // weak_keyword | IDENTIFIER | simple_literal_tokens
  public static boolean application_ref(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "application_ref")) return false;
    boolean r;
    Marker m = enter_section_(b, l, _LEFT_, REFERENCE_EXPRESSION, "<application ref>");
    r = weak_keyword(b, l + 1);
    if (!r) r = consumeTokenFast(b, IDENTIFIER);
    if (!r) r = simple_literal_tokens(b, l + 1);
    exit_section_(b, l, m, r, false, null);
    return r;
  }

  /* ********************************************************** */
  // spread_list_argument
  //                    | named_argument
  //                    | !<<isApplicationArguments>> expression_or_application (map_argument_label map_argument)?
  //                    | expression (map_argument_label map_argument)?
  static boolean argument(PsiBuilder b, int l) {
    if (!recursion_guard_(b, l, "argument")) return false;
    boolean r;
    Marker m = enter_section_(b);
    r = spread_list_argument(b, l + 1);
