docs: public final EObject ruleTerminalRule() throws RecognitionException {
          EObject current = null;
  
          Token otherlv_1=null;
          Token lv_fragment_2_0=null;
          Token otherlv_5=null;
          Token otherlv_7=null;
          Token otherlv_9=null;
          EObject lv_annotations_0_0 = null;
  
          AntlrDatatypeRuleToken lv_name_3_0 = null;
  
          AntlrDatatypeRuleToken lv_name_4_0 = null;
  
          EObject lv_type_6_0 = null;
  
          EObject lv_alternatives_8_0 = null;
  
  
  
          	enterRule();
  
          try {
              // InternalXtext.g:2859:2: ( ( ( (lv_annotations_0_0= ruleAnnotation ) )* otherlv_1= 'terminal' ( ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) ) | ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? ) ) otherlv_7= ':' ( (lv_alternatives_8_0= ruleTerminalAlternatives ) ) otherlv_9= ';' ) )
              // InternalXtext.g:2860:2: ( ( (lv_annotations_0_0= ruleAnnotation ) )* otherlv_1= 'terminal' ( ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) ) | ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? ) ) otherlv_7= ':' ( (lv_alternatives_8_0= ruleTerminalAlternatives ) ) otherlv_9= ';' )
              {
              // InternalXtext.g:2860:2: ( ( (lv_annotations_0_0= ruleAnnotation ) )* otherlv_1= 'terminal' ( ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) ) | ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? ) ) otherlv_7= ':' ( (lv_alternatives_8_0= ruleTerminalAlternatives ) ) otherlv_9= ';' )
              // InternalXtext.g:2861:3: ( (lv_annotations_0_0= ruleAnnotation ) )* otherlv_1= 'terminal' ( ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) ) | ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? ) ) otherlv_7= ':' ( (lv_alternatives_8_0= ruleTerminalAlternatives ) ) otherlv_9= ';'
              {
              // InternalXtext.g:2861:3: ( (lv_annotations_0_0= ruleAnnotation ) )*
              loop62:
              do {
                  int alt62=2;
                  int LA62_0 = input.LA(1);
  
                  if ( (LA62_0==21) ) {
                      alt62=1;
                  }
  
  
                  switch (alt62) {
              	case 1 :
              	    // InternalXtext.g:2862:4: (lv_annotations_0_0= ruleAnnotation )
              	    {
              	    // InternalXtext.g:2862:4: (lv_annotations_0_0= ruleAnnotation )
              	    // InternalXtext.g:2863:5: lv_annotations_0_0= ruleAnnotation
              	    {
  
              	    					newCompositeNode(grammarAccess.getTerminalRuleAccess().getAnnotationsAnnotationParserRuleCall_0_0());
              	    				
              	    pushFollow(FollowSets000.FOLLOW_44);
              	    lv_annotations_0_0=ruleAnnotation();
  
              	    state._fsp--;
  
  
              	    					if (current==null) {
              	    						current = createModelElementForParent(grammarAccess.getTerminalRuleRule());
              	    					}
              	    					add(
              	    						current,
              	    						"annotations",
              	    						lv_annotations_0_0,
              	    						"org.eclipse.xtext.Xtext.Annotation");
              	    					afterParserOrEnumRuleCall();
              	    				
  
              	    }
  
  
              	    }
              	    break;
  
              	default :
              	    break loop62;
                  }
              } while (true);
  
              otherlv_1=(Token)match(input,47,FollowSets000.FOLLOW_45); 
  
              			newLeafNode(otherlv_1, grammarAccess.getTerminalRuleAccess().getTerminalKeyword_1());
              		
              // InternalXtext.g:2884:3: ( ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) ) | ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? ) )
              int alt64=2;
              int LA64_0 = input.LA(1);
  
              if ( (LA64_0==22) ) {
                  alt64=1;
              }
              else if ( (LA64_0==RULE_ID||(LA64_0>=39 && LA64_0<=40)) ) {
                  alt64=2;
              }
              else {
                  NoViableAltException nvae =
                      new NoViableAltException("", 64, 0, input);
  
                  throw nvae;
              }
              switch (alt64) {
                  case 1 :
                      // InternalXtext.g:2885:4: ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) )
                      {
                      // InternalXtext.g:2885:4: ( ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) ) )
                      // InternalXtext.g:2886:5: ( (lv_fragment_2_0= 'fragment' ) ) ( (lv_name_3_0= ruleValidID ) )
                      {
                      // InternalXtext.g:2886:5: ( (lv_fragment_2_0= 'fragment' ) )
                      // InternalXtext.g:2887:6: (lv_fragment_2_0= 'fragment' )
                      {
                      // InternalXtext.g:2887:6: (lv_fragment_2_0= 'fragment' )
                      // InternalXtext.g:2888:7: lv_fragment_2_0= 'fragment'
                      {
                      lv_fragment_2_0=(Token)match(input,22,FollowSets000.FOLLOW_3); 
  
                      							newLeafNode(lv_fragment_2_0, grammarAccess.getTerminalRuleAccess().getFragmentFragmentKeyword_2_0_0_0());
                      						
  
                      							if (current==null) {
                      								current = createModelElement(grammarAccess.getTerminalRuleRule());
                      							}
                      							setWithLastConsumed(current, "fragment", true, "fragment");
                      						
  
                      }
  
  
                      }
  
                      // InternalXtext.g:2900:5: ( (lv_name_3_0= ruleValidID ) )
                      // InternalXtext.g:2901:6: (lv_name_3_0= ruleValidID )
                      {
                      // InternalXtext.g:2901:6: (lv_name_3_0= ruleValidID )
                      // InternalXtext.g:2902:7: lv_name_3_0= ruleValidID
                      {
  
                      							newCompositeNode(grammarAccess.getTerminalRuleAccess().getNameValidIDParserRuleCall_2_0_1_0());
                      						
                      pushFollow(FollowSets000.FOLLOW_18);
                      lv_name_3_0=ruleValidID();
  
                      state._fsp--;
  
  
                      							if (current==null) {
                      								current = createModelElementForParent(grammarAccess.getTerminalRuleRule());
                      							}
                      							set(
                      								current,
                      								"name",
                      								lv_name_3_0,
                      								"org.eclipse.xtext.Xtext.ValidID");
                      							afterParserOrEnumRuleCall();
                      						
  
                      }
  
  
                      }
  
  
                      }
  
  
                      }
                      break;
                  case 2 :
                      // InternalXtext.g:2921:4: ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? )
                      {
                      // InternalXtext.g:2921:4: ( ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )? )
                      // InternalXtext.g:2922:5: ( (lv_name_4_0= ruleValidID ) ) (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )?
                      {
                      // InternalXtext.g:2922:5: ( (lv_name_4_0= ruleValidID ) )
                      // InternalXtext.g:2923:6: (lv_name_4_0= ruleValidID )
                      {
                      // InternalXtext.g:2923:6: (lv_name_4_0= ruleValidID )
                      // InternalXtext.g:2924:7: lv_name_4_0= ruleValidID
                      {
  
                      							newCompositeNode(grammarAccess.getTerminalRuleAccess().getNameValidIDParserRuleCall_2_1_0_0());
                      						
                      pushFollow(FollowSets000.FOLLOW_46);
                      lv_name_4_0=ruleValidID();
  
                      state._fsp--;
  
  
                      							if (current==null) {
                      								current = createModelElementForParent(grammarAccess.getTerminalRuleRule());
                      							}
                      							set(
                      								current,
                      								"name",
                      								lv_name_4_0,
                      								"org.eclipse.xtext.Xtext.ValidID");
                      							afterParserOrEnumRuleCall();
                      						
  
                      }
  
  
                      }
  
                      // InternalXtext.g:2941:5: (otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) ) )?
                      int alt63=2;
                      int LA63_0 = input.LA(1);
  
                      if ( (LA63_0==24) ) {
                          alt63=1;
                      }
                      switch (alt63) {
                          case 1 :
                              // InternalXtext.g:2942:6: otherlv_5= 'returns' ( (lv_type_6_0= ruleTypeRef ) )
                              {
                              otherlv_5=(Token)match(input,24,FollowSets000.FOLLOW_13); 
  
                              						newLeafNode(otherlv_5, grammarAccess.getTerminalRuleAccess().getReturnsKeyword_2_1_1_0());
                              					
                              // InternalXtext.g:2946:6: ( (lv_type_6_0= ruleTypeRef ) )
                              // InternalXtext.g:2947:7: (lv_type_6_0= ruleTypeRef )
                              {
                              // InternalXtext.g:2947:7: (lv_type_6_0= ruleTypeRef )
                              // InternalXtext.g:2948:8: lv_type_6_0= ruleTypeRef
                              {
  
                              								newCompositeNode(grammarAccess.getTerminalRuleAccess().getTypeTypeRefParserRuleCall_2_1_1_1_0());
                              							
                              pushFollow(FollowSets000.FOLLOW_18);
                              lv_type_6_0=ruleTypeRef();
  
                              state._fsp--;
  
  
                              								if (current==null) {
                              									current = createModelElementForParent(grammarAccess.getTerminalRuleRule());
                              								}
                              								set(
                              									current,
                              									"type",
                              									lv_type_6_0,
                              									"org.eclipse.xtext.Xtext.TypeRef");
                              								afterParserOrEnumRuleCall();
                              							
  
                              }
  
  
                              }
  
  
                              }
                              break;
  
                      }
  
  
                      }
  
  
                      }
                      break;
  
              }
  
              otherlv_7=(Token)match(input,25,FollowSets000.FOLLOW_47); 
  
              			newLeafNode(otherlv_7, grammarAccess.getTerminalRuleAccess().getColonKeyword_3());
              		
              // InternalXtext.g:2972:3: ( (lv_alternatives_8_0= ruleTerminalAlternatives ) )
              // InternalXtext.g:2973:4: (lv_alternatives_8_0= ruleTerminalAlternatives )
              {
              // InternalXtext.g:2973:4: (lv_alternatives_8_0= ruleTerminalAlternatives )
              // InternalXtext.g:2974:5: lv_alternatives_8_0= ruleTerminalAlternatives
              {
  
              					newCompositeNode(grammarAccess.getTerminalRuleAccess().getAlternativesTerminalAlternativesParserRuleCall_4_0());
              				
              pushFollow(FollowSets000.FOLLOW_20);
              lv_alternatives_8_0=ruleTerminalAlternatives();
  
              state._fsp--;
  
  
              					if (current==null) {
              						current = createModelElementForParent(grammarAccess.getTerminalRuleRule());
              					}
              					set(
              						current,
              						"alternatives",
              						lv_alternatives_8_0,
              						"org.eclipse.xtext.Xtext.TerminalAlternatives");
              					afterParserOrEnumRuleCall();
              				
  
              }
  
  
              }
  
              otherlv_9=(Token)match(input,26,FollowSets000.FOLLOW_2); 
  
              			newLeafNode(otherlv_9, grammarAccess.getTerminalRuleAccess().getSemicolonKeyword_5());
              		
  
              }
  
  
              }
  
  
              	leaveRule();
  
          }
  
              catch (RecognitionException re) {
                  recover(input,re);
                  appendSkippedTokens();
              }
          finally {
          }
          return current;
      }