// $ANTLR start "ruleContained"
  // PsiInternalBug289524ExTestLanguage.g:178:1: ruleContained : (otherlv_0= 'containment' (
  // (lv_name_1_0= RULE_ID ) ) ) ;
  public final void ruleContained() throws RecognitionException {
    Token otherlv_0 = null;
    Token lv_name_1_0 = null;

    try {
      // PsiInternalBug289524ExTestLanguage.g:178:14: ( (otherlv_0= 'containment' ( (lv_name_1_0=
      // RULE_ID ) ) ) )
      // PsiInternalBug289524ExTestLanguage.g:179:2: (otherlv_0= 'containment' ( (lv_name_1_0=
      // RULE_ID ) ) )
      {
        // PsiInternalBug289524ExTestLanguage.g:179:2: (otherlv_0= 'containment' ( (lv_name_1_0=
        // RULE_ID ) ) )
        // PsiInternalBug289524ExTestLanguage.g:180: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;
          if (state.backtracking == 0) {

            doneLeaf(otherlv_0);
          }
          // PsiInternalBug289524ExTestLanguage.g:187:3: ( (lv_name_1_0= RULE_ID ) )
          // PsiInternalBug289524ExTestLanguage.g:188:4: (lv_name_1_0= RULE_ID )
          {
            // PsiInternalBug289524ExTestLanguage.g:188:4: (lv_name_1_0= RULE_ID )
            // PsiInternalBug289524ExTestLanguage.g:189: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;
              if (state.backtracking == 0) {

                doneLeaf(lv_name_1_0);
              }
            }
          }
        }
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return;
  }
  // $ANTLR start synpred2_PsiInternalBug289524ExTestLanguage
  public final void synpred2_PsiInternalBug289524ExTestLanguage_fragment()
      throws RecognitionException {
    // PsiInternalBug289524ExTestLanguage.g:115:4: ( ( (lv_containments_1_0= ruleContained ) ) )
    // PsiInternalBug289524ExTestLanguage.g:115:4: ( (lv_containments_1_0= ruleContained ) )
    {
      // PsiInternalBug289524ExTestLanguage.g:115:4: ( (lv_containments_1_0= ruleContained ) )
      // PsiInternalBug289524ExTestLanguage.g:116:5: (lv_containments_1_0= ruleContained )
      {
        // PsiInternalBug289524ExTestLanguage.g:116:5: (lv_containments_1_0= ruleContained )
        // PsiInternalBug289524ExTestLanguage.g:117:6: lv_containments_1_0= ruleContained
        {
          if (state.backtracking == 0) {

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

          state._fsp--;
          if (state.failed) return;
        }
      }
    }
  }
  // $ANTLR start "entryRuleModel"
  // PsiInternalBug289524ExTestLanguage.g:58:1: entryRuleModel : ruleModel EOF ;
  public final void entryRuleModel() throws RecognitionException {
    try {
      // PsiInternalBug289524ExTestLanguage.g:58:15: ( ruleModel EOF )
      // PsiInternalBug289524ExTestLanguage.g:59:2: ruleModel EOF
      {
        if (state.backtracking == 0) {
          markComposite(elementTypeProvider.getModelElementType());
        }
        pushFollow(FollowSets000.FOLLOW_1);
        ruleModel();

        state._fsp--;
        if (state.failed) return;
        match(input, EOF, FollowSets000.FOLLOW_2);
        if (state.failed) return;
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return;
  }
  // $ANTLR start synpred4_PsiInternalBug289524ExTestLanguage
  public final void synpred4_PsiInternalBug289524ExTestLanguage_fragment()
      throws RecognitionException {
    Token otherlv_2 = null;
    Token otherlv_3 = null;
    Token otherlv_4 = null;
    Token otherlv_5 = null;

    // PsiInternalBug289524ExTestLanguage.g:127:4: ( (otherlv_2= 'reference' ( (otherlv_3= RULE_ID )
    // ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* ) )
    // PsiInternalBug289524ExTestLanguage.g:127:4: (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) )
    // (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
    {
      // PsiInternalBug289524ExTestLanguage.g:127:4: (otherlv_2= 'reference' ( (otherlv_3= RULE_ID )
      // ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
      // PsiInternalBug289524ExTestLanguage.g:128: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;
        // PsiInternalBug289524ExTestLanguage.g:135:5: ( (otherlv_3= RULE_ID ) )
        // PsiInternalBug289524ExTestLanguage.g:136:6: (otherlv_3= RULE_ID )
        {
          // PsiInternalBug289524ExTestLanguage.g:136:6: (otherlv_3= RULE_ID )
          // PsiInternalBug289524ExTestLanguage.g:137:7: otherlv_3= RULE_ID
          {
            if (state.backtracking == 0) {

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

        // PsiInternalBug289524ExTestLanguage.g:146: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:
              // PsiInternalBug289524ExTestLanguage.g:147:6: otherlv_4= '$' ( (otherlv_5= RULE_ID )
              // )
              {
                otherlv_4 = (Token) match(input, 13, FollowSets000.FOLLOW_4);
                if (state.failed) return;
                // PsiInternalBug289524ExTestLanguage.g:154:6: ( (otherlv_5= RULE_ID ) )
                // PsiInternalBug289524ExTestLanguage.g:155:7: (otherlv_5= RULE_ID )
                {
                  // PsiInternalBug289524ExTestLanguage.g:155:7: (otherlv_5= RULE_ID )
                  // PsiInternalBug289524ExTestLanguage.g:156:8: otherlv_5= RULE_ID
                  {
                    if (state.backtracking == 0) {

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

            default:
              break loop4;
          }
        } while (true);
      }
    }
  }
  // $ANTLR start "ruleModelElement"
  // PsiInternalBug289524ExTestLanguage.g:103:1: ruleModelElement : ( () ( ( (lv_containments_1_0=
  // ruleContained ) ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' (
  // (otherlv_5= RULE_ID ) ) )* ) )+ ) ;
  public final void ruleModelElement() throws RecognitionException {
    Token otherlv_2 = null;
    Token otherlv_3 = null;
    Token otherlv_4 = null;
    Token otherlv_5 = null;

    try {
      // PsiInternalBug289524ExTestLanguage.g:103:17: ( ( () ( ( (lv_containments_1_0= ruleContained
      // ) ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5=
      // RULE_ID ) ) )* ) )+ ) )
      // PsiInternalBug289524ExTestLanguage.g:104:2: ( () ( ( (lv_containments_1_0= ruleContained )
      // ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID
      // ) ) )* ) )+ )
      {
        // PsiInternalBug289524ExTestLanguage.g:104:2: ( () ( ( (lv_containments_1_0= ruleContained
        // ) ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5=
        // RULE_ID ) ) )* ) )+ )
        // PsiInternalBug289524ExTestLanguage.g:105:3: () ( ( (lv_containments_1_0= ruleContained )
        // ) | (otherlv_2= 'reference' ( (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5=
        // RULE_ID ) ) )* ) )+
        {
          // PsiInternalBug289524ExTestLanguage.g:105:3: ()
          // PsiInternalBug289524ExTestLanguage.g:106:4:
          {
            if (state.backtracking == 0) {

              /* */

            }
            if (state.backtracking == 0) {

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

          // PsiInternalBug289524ExTestLanguage.g:114: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_PsiInternalBug289524ExTestLanguage())) {
                alt3 = 1;
              }

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

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

            switch (alt3) {
              case 1:
                // PsiInternalBug289524ExTestLanguage.g:115:4: ( (lv_containments_1_0= ruleContained
                // ) )
                {
                  // PsiInternalBug289524ExTestLanguage.g:115:4: ( (lv_containments_1_0=
                  // ruleContained ) )
                  // PsiInternalBug289524ExTestLanguage.g:116:5: (lv_containments_1_0= ruleContained
                  // )
                  {
                    // PsiInternalBug289524ExTestLanguage.g:116:5: (lv_containments_1_0=
                    // ruleContained )
                    // PsiInternalBug289524ExTestLanguage.g:117:6: lv_containments_1_0=
                    // ruleContained
                    {
                      if (state.backtracking == 0) {

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

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

                        doneComposite();
                      }
                    }
                  }
                }
                break;
              case 2:
                // PsiInternalBug289524ExTestLanguage.g:127:4: (otherlv_2= 'reference' ( (otherlv_3=
                // RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
                {
                  // PsiInternalBug289524ExTestLanguage.g:127:4: (otherlv_2= 'reference' (
                  // (otherlv_3= RULE_ID ) ) (otherlv_4= '$' ( (otherlv_5= RULE_ID ) ) )* )
                  // PsiInternalBug289524ExTestLanguage.g:128: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;
                    if (state.backtracking == 0) {

                      doneLeaf(otherlv_2);
                    }
                    // PsiInternalBug289524ExTestLanguage.g:135:5: ( (otherlv_3= RULE_ID ) )
                    // PsiInternalBug289524ExTestLanguage.g:136:6: (otherlv_3= RULE_ID )
                    {
                      // PsiInternalBug289524ExTestLanguage.g:136:6: (otherlv_3= RULE_ID )
                      // PsiInternalBug289524ExTestLanguage.g:137:7: otherlv_3= RULE_ID
                      {
                        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;
                        if (state.backtracking == 0) {

                          doneLeaf(otherlv_3);
                        }
                      }
                    }

                    // PsiInternalBug289524ExTestLanguage.g:146: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:
                          // PsiInternalBug289524ExTestLanguage.g:147: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;
                            if (state.backtracking == 0) {

                              doneLeaf(otherlv_4);
                            }
                            // PsiInternalBug289524ExTestLanguage.g:154:6: ( (otherlv_5= RULE_ID ) )
                            // PsiInternalBug289524ExTestLanguage.g:155:7: (otherlv_5= RULE_ID )
                            {
                              // PsiInternalBug289524ExTestLanguage.g:155:7: (otherlv_5= RULE_ID )
                              // PsiInternalBug289524ExTestLanguage.g:156:8: otherlv_5= RULE_ID
                              {
                                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;
                                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;
                }
                EarlyExitException eee = new EarlyExitException(3, input);
                throw eee;
            }
            cnt3++;
          } while (true);
        }
      }

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return;
  }
  // $ANTLR start "ruleModel"
  // PsiInternalBug289524ExTestLanguage.g:64:1: ruleModel : ( () otherlv_1= 'Model' ( (lv_refs_2_0=
  // ruleModelElement ) )* ) ;
  public final void ruleModel() throws RecognitionException {
    Token otherlv_1 = null;

    try {
      // PsiInternalBug289524ExTestLanguage.g:64:10: ( ( () otherlv_1= 'Model' ( (lv_refs_2_0=
      // ruleModelElement ) )* ) )
      // PsiInternalBug289524ExTestLanguage.g:65:2: ( () otherlv_1= 'Model' ( (lv_refs_2_0=
      // ruleModelElement ) )* )
      {
        // PsiInternalBug289524ExTestLanguage.g:65:2: ( () otherlv_1= 'Model' ( (lv_refs_2_0=
        // ruleModelElement ) )* )
        // PsiInternalBug289524ExTestLanguage.g:66:3: () otherlv_1= 'Model' ( (lv_refs_2_0=
        // ruleModelElement ) )*
        {
          // PsiInternalBug289524ExTestLanguage.g:66:3: ()
          // PsiInternalBug289524ExTestLanguage.g:67:4:
          {
            if (state.backtracking == 0) {

              /* */

            }
            if (state.backtracking == 0) {

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

          if (state.backtracking == 0) {

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

            doneLeaf(otherlv_1);
          }
          // PsiInternalBug289524ExTestLanguage.g:82: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:
                // PsiInternalBug289524ExTestLanguage.g:83:4: (lv_refs_2_0= ruleModelElement )
                {
                  // PsiInternalBug289524ExTestLanguage.g:83:4: (lv_refs_2_0= ruleModelElement )
                  // PsiInternalBug289524ExTestLanguage.g:84:5: lv_refs_2_0= ruleModelElement
                  {
                    if (state.backtracking == 0) {

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

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

                      doneComposite();
                    }
                  }
                }
                break;

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

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