// $ANTLR start "entryRuleModel"
  // PsiInternalBug289524TestLanguage.g:58:1: entryRuleModel returns [Boolean current=false] :
  // iv_ruleModel= ruleModel EOF ;
  public final Boolean entryRuleModel() throws RecognitionException {
    Boolean current = false;

    Boolean iv_ruleModel = null;

    try {
      // PsiInternalBug289524TestLanguage.g:58:47: (iv_ruleModel= ruleModel EOF )
      // PsiInternalBug289524TestLanguage.g:59:2: iv_ruleModel= ruleModel EOF
      {
        if (state.backtracking == 0) {
          markComposite(elementTypeProvider.getModelElementType());
        }
        pushFollow(FollowSets000.FOLLOW_1);
        iv_ruleModel = ruleModel();

        state._fsp--;
        if (state.failed) return current;
        if (state.backtracking == 0) {
          current = iv_ruleModel;
        }
        match(input, EOF, FollowSets000.FOLLOW_2);
        if (state.failed) return current;
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return current;
  }
  // $ANTLR start synpred2_PsiInternalBug289524TestLanguage
  public final void synpred2_PsiInternalBug289524TestLanguage_fragment()
      throws RecognitionException {
    Boolean lv_containments_1_0 = null;

    // PsiInternalBug289524TestLanguage.g:125:4: ( ( (lv_containments_1_0= ruleContained ) ) )
    // PsiInternalBug289524TestLanguage.g:125:4: ( (lv_containments_1_0= ruleContained ) )
    {
      // PsiInternalBug289524TestLanguage.g:125:4: ( (lv_containments_1_0= ruleContained ) )
      // PsiInternalBug289524TestLanguage.g:126:5: (lv_containments_1_0= ruleContained )
      {
        // PsiInternalBug289524TestLanguage.g:126:5: (lv_containments_1_0= ruleContained )
        // PsiInternalBug289524TestLanguage.g:127:6: lv_containments_1_0= ruleContained
        {
          if (state.backtracking == 0) {

            markComposite(
                elementTypeProvider
                    .getModelElement_ContainmentsContainedParserRuleCall_1_0_0ElementType());
          }
          pushFollow(FollowSets000.FOLLOW_2);
          lv_containments_1_0 = ruleContained();

          state._fsp--;
          if (state.failed) return;
        }
      }
    }
  }
  // $ANTLR start synpred4_PsiInternalBug289524TestLanguage
  public final void synpred4_PsiInternalBug289524TestLanguage_fragment()
      throws RecognitionException {
    Token otherlv_2 = null;
    Token otherlv_3 = null;
    Token otherlv_4 = null;
    Token otherlv_5 = null;

    // PsiInternalBug289524TestLanguage.g:141:4: ( (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) )
    // (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* ) )
    // PsiInternalBug289524TestLanguage.g:141:4: (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) )
    // (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
    {
      // PsiInternalBug289524TestLanguage.g:141:4: (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) )
      // (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
      // PsiInternalBug289524TestLanguage.g:142:5: otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) )
      // (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )*
      {
        if (state.backtracking == 0) {

          markLeaf(elementTypeProvider.getModelElement_ReferenceKeyword_1_1_0ElementType());
        }
        otherlv_2 = (Token) match(input, 12, FollowSets000.FOLLOW_4);
        if (state.failed) return;
        // PsiInternalBug289524TestLanguage.g:149:5: ( (otherlv_3= RULE_ID ) )
        // PsiInternalBug289524TestLanguage.g:150:6: (otherlv_3= RULE_ID )
        {
          // PsiInternalBug289524TestLanguage.g:150:6: (otherlv_3= RULE_ID )
          // PsiInternalBug289524TestLanguage.g:151:7: otherlv_3= RULE_ID
          {
            if (state.backtracking == 0) {

              /* */

            }
            otherlv_3 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_6);
            if (state.failed) return;
          }
        }

        // PsiInternalBug289524TestLanguage.g:169:5: (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )*
        loop4:
        do {
          int alt4 = 2;
          int LA4_0 = input.LA(1);

          if ((LA4_0 == 13)) {
            alt4 = 1;
          }

          switch (alt4) {
            case 1:
              // PsiInternalBug289524TestLanguage.g:170:6: otherlv_4= '$' ( (otherlv_5= RULE_ID ) )
              {
                otherlv_4 = (Token) match(input, 13, FollowSets000.FOLLOW_4);
                if (state.failed) return;
                // PsiInternalBug289524TestLanguage.g:177:6: ( (otherlv_5= RULE_ID ) )
                // PsiInternalBug289524TestLanguage.g:178:7: (otherlv_5= RULE_ID )
                {
                  // PsiInternalBug289524TestLanguage.g:178:7: (otherlv_5= RULE_ID )
                  // PsiInternalBug289524TestLanguage.g:179:8: otherlv_5= RULE_ID
                  {
                    if (state.backtracking == 0) {

                      /* */

                    }
                    otherlv_5 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_6);
                    if (state.failed) return;
                  }
                }
              }
              break;

            default:
              break loop4;
          }
        } while (true);
      }
    }
  }
  // $ANTLR start "ruleContained"
  // PsiInternalBug289524TestLanguage.g:211:1: ruleContained returns [Boolean current=false] :
  // (otherlv_0= 'containment' ( (lv_name_1_0= RULE_ID ) ) ) ;
  public final Boolean ruleContained() throws RecognitionException {
    Boolean current = false;

    Token otherlv_0 = null;
    Token lv_name_1_0 = null;

    try {
      // PsiInternalBug289524TestLanguage.g:212:1: ( (otherlv_0= 'containment' ( (lv_name_1_0=
      // RULE_ID ) ) ) )
      // PsiInternalBug289524TestLanguage.g:213:2: (otherlv_0= 'containment' ( (lv_name_1_0= RULE_ID
      // ) ) )
      {
        // PsiInternalBug289524TestLanguage.g:213:2: (otherlv_0= 'containment' ( (lv_name_1_0=
        // RULE_ID ) ) )
        // PsiInternalBug289524TestLanguage.g:214:3: otherlv_0= 'containment' ( (lv_name_1_0=
        // RULE_ID ) )
        {
          if (state.backtracking == 0) {

            markLeaf(elementTypeProvider.getContained_ContainmentKeyword_0ElementType());
          }
          otherlv_0 = (Token) match(input, 14, FollowSets000.FOLLOW_4);
          if (state.failed) return current;
          if (state.backtracking == 0) {

            doneLeaf(otherlv_0);
          }
          // PsiInternalBug289524TestLanguage.g:221:3: ( (lv_name_1_0= RULE_ID ) )
          // PsiInternalBug289524TestLanguage.g:222:4: (lv_name_1_0= RULE_ID )
          {
            // PsiInternalBug289524TestLanguage.g:222:4: (lv_name_1_0= RULE_ID )
            // PsiInternalBug289524TestLanguage.g:223:5: lv_name_1_0= RULE_ID
            {
              if (state.backtracking == 0) {

                markLeaf(elementTypeProvider.getContained_NameIDTerminalRuleCall_1_0ElementType());
              }
              lv_name_1_0 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_2);
              if (state.failed) return current;
              if (state.backtracking == 0) {

                if (!current) {
                  associateWithSemanticElement();
                  current = true;
                }
              }
              if (state.backtracking == 0) {

                doneLeaf(lv_name_1_0);
              }
            }
          }
        }
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return current;
  }
  // $ANTLR start "ruleModelElement"
  // PsiInternalBug289524TestLanguage.g:111:1: ruleModelElement returns [Boolean current=false] : (
  // () ( ( (lv_containments_1_0= ruleContained ) ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID
  // ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* ) )+ ) ;
  public final Boolean ruleModelElement() throws RecognitionException {
    Boolean current = false;

    Token otherlv_2 = null;
    Token otherlv_3 = null;
    Token otherlv_4 = null;
    Token otherlv_5 = null;
    Boolean lv_containments_1_0 = null;

    try {
      // PsiInternalBug289524TestLanguage.g:112:1: ( ( () ( ( (lv_containments_1_0= ruleContained )
      // ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID
      // ) ) )* ) )+ ) )
      // PsiInternalBug289524TestLanguage.g:113:2: ( () ( ( (lv_containments_1_0= ruleContained ) )
      // | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID )
      // ) )* ) )+ )
      {
        // PsiInternalBug289524TestLanguage.g:113:2: ( () ( ( (lv_containments_1_0= ruleContained )
        // ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5=
        // RULE_ID ) ) )* ) )+ )
        // PsiInternalBug289524TestLanguage.g:114:3: () ( ( (lv_containments_1_0= ruleContained ) )
        // | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID
        // ) ) )* ) )+
        {
          // PsiInternalBug289524TestLanguage.g:114:3: ()
          // PsiInternalBug289524TestLanguage.g:115:4:
          {
            if (state.backtracking == 0) {

              /* */

            }
            if (state.backtracking == 0) {

              precedeComposite(
                  elementTypeProvider.getModelElement_ModelElementAction_0ElementType());
              doneComposite();
              associateWithSemanticElement();
            }
          }

          // PsiInternalBug289524TestLanguage.g:124:3: ( ( (lv_containments_1_0= ruleContained ) ) |
          // (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID
          // ) ) )* ) )+
          int cnt3 = 0;
          loop3:
          do {
            int alt3 = 3;
            int LA3_0 = input.LA(1);

            if ((LA3_0 == 14)) {
              int LA3_2 = input.LA(2);

              if ((synpred2_PsiInternalBug289524TestLanguage())) {
                alt3 = 1;
              }

            } else if ((LA3_0 == 12)) {
              int LA3_3 = input.LA(2);

              if ((synpred4_PsiInternalBug289524TestLanguage())) {
                alt3 = 2;
              }
            }

            switch (alt3) {
              case 1:
                // PsiInternalBug289524TestLanguage.g:125:4: ( (lv_containments_1_0= ruleContained )
                // )
                {
                  // PsiInternalBug289524TestLanguage.g:125:4: ( (lv_containments_1_0= ruleContained
                  // ) )
                  // PsiInternalBug289524TestLanguage.g:126:5: (lv_containments_1_0= ruleContained )
                  {
                    // PsiInternalBug289524TestLanguage.g:126:5: (lv_containments_1_0= ruleContained
                    // )
                    // PsiInternalBug289524TestLanguage.g:127:6: lv_containments_1_0= ruleContained
                    {
                      if (state.backtracking == 0) {

                        markComposite(
                            elementTypeProvider
                                .getModelElement_ContainmentsContainedParserRuleCall_1_0_0ElementType());
                      }
                      pushFollow(FollowSets000.FOLLOW_3);
                      lv_containments_1_0 = ruleContained();

                      state._fsp--;
                      if (state.failed) return current;
                      if (state.backtracking == 0) {

                        doneComposite();
                        if (!current) {
                          associateWithSemanticElement();
                          current = true;
                        }
                      }
                    }
                  }
                }
                break;
              case 2:
                // PsiInternalBug289524TestLanguage.g:141:4: (otherlv_2= 'reference' ( (otherlv_3=
                // RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
                {
                  // PsiInternalBug289524TestLanguage.g:141:4: (otherlv_2= 'reference' ( (otherlv_3=
                  // RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
                  // PsiInternalBug289524TestLanguage.g:142:5: otherlv_2= 'reference' ( (otherlv_3=
                  // RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )*
                  {
                    if (state.backtracking == 0) {

                      markLeaf(
                          elementTypeProvider.getModelElement_ReferenceKeyword_1_1_0ElementType());
                    }
                    otherlv_2 = (Token) match(input, 12, FollowSets000.FOLLOW_4);
                    if (state.failed) return current;
                    if (state.backtracking == 0) {

                      doneLeaf(otherlv_2);
                    }
                    // PsiInternalBug289524TestLanguage.g:149:5: ( (otherlv_3= RULE_ID ) )
                    // PsiInternalBug289524TestLanguage.g:150:6: (otherlv_3= RULE_ID )
                    {
                      // PsiInternalBug289524TestLanguage.g:150:6: (otherlv_3= RULE_ID )
                      // PsiInternalBug289524TestLanguage.g:151:7: otherlv_3= RULE_ID
                      {
                        if (state.backtracking == 0) {

                          /* */

                        }
                        if (state.backtracking == 0) {

                          if (!current) {
                            associateWithSemanticElement();
                            current = true;
                          }
                        }
                        if (state.backtracking == 0) {

                          markLeaf(
                              elementTypeProvider
                                  .getModelElement_RefsContainedCrossReference_1_1_1_0ElementType());
                        }
                        otherlv_3 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_5);
                        if (state.failed) return current;
                        if (state.backtracking == 0) {

                          doneLeaf(otherlv_3);
                        }
                      }
                    }

                    // PsiInternalBug289524TestLanguage.g:169:5: (otherlv_4= '$' ( (otherlv_5=
                    // RULE_ID ) ) )*
                    loop2:
                    do {
                      int alt2 = 2;
                      int LA2_0 = input.LA(1);

                      if ((LA2_0 == 13)) {
                        alt2 = 1;
                      }

                      switch (alt2) {
                        case 1:
                          // PsiInternalBug289524TestLanguage.g:170:6: otherlv_4= '$' ( (otherlv_5=
                          // RULE_ID ) )
                          {
                            if (state.backtracking == 0) {

                              markLeaf(
                                  elementTypeProvider
                                      .getModelElement_DollarSignKeyword_1_1_2_0ElementType());
                            }
                            otherlv_4 = (Token) match(input, 13, FollowSets000.FOLLOW_4);
                            if (state.failed) return current;
                            if (state.backtracking == 0) {

                              doneLeaf(otherlv_4);
                            }
                            // PsiInternalBug289524TestLanguage.g:177:6: ( (otherlv_5= RULE_ID ) )
                            // PsiInternalBug289524TestLanguage.g:178:7: (otherlv_5= RULE_ID )
                            {
                              // PsiInternalBug289524TestLanguage.g:178:7: (otherlv_5= RULE_ID )
                              // PsiInternalBug289524TestLanguage.g:179:8: otherlv_5= RULE_ID
                              {
                                if (state.backtracking == 0) {

                                  /* */

                                }
                                if (state.backtracking == 0) {

                                  if (!current) {
                                    associateWithSemanticElement();
                                    current = true;
                                  }
                                }
                                if (state.backtracking == 0) {

                                  markLeaf(
                                      elementTypeProvider
                                          .getModelElement_RefsContainedCrossReference_1_1_2_1_0ElementType());
                                }
                                otherlv_5 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_5);
                                if (state.failed) return current;
                                if (state.backtracking == 0) {

                                  doneLeaf(otherlv_5);
                                }
                              }
                            }
                          }
                          break;

                        default:
                          break loop2;
                      }
                    } while (true);
                  }
                }
                break;

              default:
                if (cnt3 >= 1) break loop3;
                if (state.backtracking > 0) {
                  state.failed = true;
                  return current;
                }
                EarlyExitException eee = new EarlyExitException(3, input);
                throw eee;
            }
            cnt3++;
          } while (true);
        }
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return current;
  }
  // $ANTLR start "ruleModel"
  // PsiInternalBug289524TestLanguage.g:65:1: ruleModel returns [Boolean current=false] : ( ()
  // otherlv_1= 'Model' ( (lv_refs_2_0= ruleModelElement ) )* ) ;
  public final Boolean ruleModel() throws RecognitionException {
    Boolean current = false;

    Token otherlv_1 = null;
    Boolean lv_refs_2_0 = null;

    try {
      // PsiInternalBug289524TestLanguage.g:66:1: ( ( () otherlv_1= 'Model' ( (lv_refs_2_0=
      // ruleModelElement ) )* ) )
      // PsiInternalBug289524TestLanguage.g:67:2: ( () otherlv_1= 'Model' ( (lv_refs_2_0=
      // ruleModelElement ) )* )
      {
        // PsiInternalBug289524TestLanguage.g:67:2: ( () otherlv_1= 'Model' ( (lv_refs_2_0=
        // ruleModelElement ) )* )
        // PsiInternalBug289524TestLanguage.g:68:3: () otherlv_1= 'Model' ( (lv_refs_2_0=
        // ruleModelElement ) )*
        {
          // PsiInternalBug289524TestLanguage.g:68:3: ()
          // PsiInternalBug289524TestLanguage.g:69:4:
          {
            if (state.backtracking == 0) {

              /* */

            }
            if (state.backtracking == 0) {

              precedeComposite(elementTypeProvider.getModel_ModelAction_0ElementType());
              doneComposite();
              associateWithSemanticElement();
            }
          }

          if (state.backtracking == 0) {

            markLeaf(elementTypeProvider.getModel_ModelKeyword_1ElementType());
          }
          otherlv_1 = (Token) match(input, 11, FollowSets000.FOLLOW_3);
          if (state.failed) return current;
          if (state.backtracking == 0) {

            doneLeaf(otherlv_1);
          }
          // PsiInternalBug289524TestLanguage.g:85:3: ( (lv_refs_2_0= ruleModelElement ) )*
          loop1:
          do {
            int alt1 = 2;
            int LA1_0 = input.LA(1);

            if ((LA1_0 == 12 || LA1_0 == 14)) {
              alt1 = 1;
            }

            switch (alt1) {
              case 1:
                // PsiInternalBug289524TestLanguage.g:86:4: (lv_refs_2_0= ruleModelElement )
                {
                  // PsiInternalBug289524TestLanguage.g:86:4: (lv_refs_2_0= ruleModelElement )
                  // PsiInternalBug289524TestLanguage.g:87:5: lv_refs_2_0= ruleModelElement
                  {
                    if (state.backtracking == 0) {

                      markComposite(
                          elementTypeProvider
                              .getModel_RefsModelElementParserRuleCall_2_0ElementType());
                    }
                    pushFollow(FollowSets000.FOLLOW_3);
                    lv_refs_2_0 = ruleModelElement();

                    state._fsp--;
                    if (state.failed) return current;
                    if (state.backtracking == 0) {

                      doneComposite();
                      if (!current) {
                        associateWithSemanticElement();
                        current = true;
                      }
                    }
                  }
                }
                break;

              default:
                break loop1;
            }
          } while (true);
        }
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return current;
  }