public final BaseDescr primary()

in drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL5Expressions.java [3879:4289]


	public final BaseDescr primary() throws RecognitionException {
		BaseDescr result = null;


		Token i1=null;
		Token i2=null;
		Token DOT12=null;
		Token SHARP13=null;
		Token HASH14=null;
		Token NULL_SAFE_DOT15=null;
		BaseDescr expr =null;
		ParserRuleReturnScope literal11 =null;

		try {
			// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:537:5: ( ( LEFT_PAREN )=>expr= parExpression | ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments ) | ( literal )=> literal | ( super_key )=> super_key superSuffix | ( new_key )=> new_key creator | ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key | ( inlineMapExpression )=> inlineMapExpression | ( inlineListExpression )=> inlineListExpression | ( ID )=>i1= ID ( ( ( DOT ID )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )? )
			int alt60=9;
			int LA60_0 = input.LA(1);
			if ( (LA60_0==LEFT_PAREN) && (synpred19_DRL5Expressions())) {
				alt60=1;
			}
			else if ( (LA60_0==LESS) && (synpred20_DRL5Expressions())) {
				alt60=2;
			}
			else if ( (LA60_0==STRING) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==DECIMAL) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==HEX) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==FLOAT) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==BOOL) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==NULL) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==TIME_INTERVAL) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==STAR) && (synpred21_DRL5Expressions())) {
				alt60=3;
			}
			else if ( (LA60_0==ID) ) {
				int LA60_11 = input.LA(2);
				if ( ((((helper.validateIdentifierKey(DroolsSoftKeywords.SUPER)))&&synpred22_DRL5Expressions())) ) {
					alt60=4;
				}
				else if ( ((synpred23_DRL5Expressions()&&((helper.validateIdentifierKey(DroolsSoftKeywords.NEW))))) ) {
					alt60=5;
				}
				else if ( (((((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR))))&&synpred24_DRL5Expressions())) ) {
					alt60=6;
				}
				else if ( (synpred27_DRL5Expressions()) ) {
					alt60=9;
				}

				else {
					if (state.backtracking>0) {state.failed=true; return result;}
					int nvaeMark = input.mark();
					try {
						input.consume();
						NoViableAltException nvae =
							new NoViableAltException("", 60, 11, input);
						throw nvae;
					} finally {
						input.rewind(nvaeMark);
					}
				}

			}
			else if ( (LA60_0==LEFT_SQUARE) ) {
				int LA60_12 = input.LA(2);
				if ( (synpred25_DRL5Expressions()) ) {
					alt60=7;
				}
				else if ( (synpred26_DRL5Expressions()) ) {
					alt60=8;
				}

				else {
					if (state.backtracking>0) {state.failed=true; return result;}
					int nvaeMark = input.mark();
					try {
						input.consume();
						NoViableAltException nvae =
							new NoViableAltException("", 60, 12, input);
						throw nvae;
					} finally {
						input.rewind(nvaeMark);
					}
				}

			}

			else {
				if (state.backtracking>0) {state.failed=true; return result;}
				NoViableAltException nvae =
					new NoViableAltException("", 60, 0, input);
				throw nvae;
			}

			switch (alt60) {
				case 1 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:537:7: ( LEFT_PAREN )=>expr= parExpression
					{
					pushFollow(FOLLOW_parExpression_in_primary2727);
					expr=parExpression();
					state._fsp--;
					if (state.failed) return result;
					if ( state.backtracking==0 ) {  if( buildDescr  ) { result = expr; }  }
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:9: ( nonWildcardTypeArguments )=> nonWildcardTypeArguments ( explicitGenericInvocationSuffix | this_key arguments )
					{
					pushFollow(FOLLOW_nonWildcardTypeArguments_in_primary2744);
					nonWildcardTypeArguments();
					state._fsp--;
					if (state.failed) return result;
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:63: ( explicitGenericInvocationSuffix | this_key arguments )
					int alt56=2;
					int LA56_0 = input.LA(1);
					if ( (LA56_0==ID) ) {
						int LA56_1 = input.LA(2);
						if ( (!((((helper.validateIdentifierKey(DroolsSoftKeywords.THIS)))))) ) {
							alt56=1;
						}
						else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.THIS)))) ) {
							alt56=2;
						}

						else {
							if (state.backtracking>0) {state.failed=true; return result;}
							int nvaeMark = input.mark();
							try {
								input.consume();
								NoViableAltException nvae =
									new NoViableAltException("", 56, 1, input);
								throw nvae;
							} finally {
								input.rewind(nvaeMark);
							}
						}

					}

					else {
						if (state.backtracking>0) {state.failed=true; return result;}
						NoViableAltException nvae =
							new NoViableAltException("", 56, 0, input);
						throw nvae;
					}

					switch (alt56) {
						case 1 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:64: explicitGenericInvocationSuffix
							{
							pushFollow(FOLLOW_explicitGenericInvocationSuffix_in_primary2747);
							explicitGenericInvocationSuffix();
							state._fsp--;
							if (state.failed) return result;
							}
							break;
						case 2 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:538:98: this_key arguments
							{
							pushFollow(FOLLOW_this_key_in_primary2751);
							this_key();
							state._fsp--;
							if (state.failed) return result;
							pushFollow(FOLLOW_arguments_in_primary2753);
							arguments();
							state._fsp--;
							if (state.failed) return result;
							}
							break;

					}

					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:539:9: ( literal )=> literal
					{
					pushFollow(FOLLOW_literal_in_primary2769);
					literal11=literal();
					state._fsp--;
					if (state.failed) return result;
					if ( state.backtracking==0 ) { if( buildDescr  ) { result = new AtomicExprDescr( (literal11!=null?input.toString(literal11.start,literal11.stop):null), true ); }  }
					}
					break;
				case 4 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:541:9: ( super_key )=> super_key superSuffix
					{
					pushFollow(FOLLOW_super_key_in_primary2791);
					super_key();
					state._fsp--;
					if (state.failed) return result;
					pushFollow(FOLLOW_superSuffix_in_primary2793);
					superSuffix();
					state._fsp--;
					if (state.failed) return result;
					}
					break;
				case 5 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:542:9: ( new_key )=> new_key creator
					{
					pushFollow(FOLLOW_new_key_in_primary2808);
					new_key();
					state._fsp--;
					if (state.failed) return result;
					pushFollow(FOLLOW_creator_in_primary2810);
					creator();
					state._fsp--;
					if (state.failed) return result;
					}
					break;
				case 6 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:543:9: ( primitiveType )=> primitiveType ( LEFT_SQUARE RIGHT_SQUARE )* DOT class_key
					{
					pushFollow(FOLLOW_primitiveType_in_primary2825);
					primitiveType();
					state._fsp--;
					if (state.failed) return result;
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:543:41: ( LEFT_SQUARE RIGHT_SQUARE )*
					loop57:
					while (true) {
						int alt57=2;
						int LA57_0 = input.LA(1);
						if ( (LA57_0==LEFT_SQUARE) ) {
							alt57=1;
						}

						switch (alt57) {
						case 1 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:543:42: LEFT_SQUARE RIGHT_SQUARE
							{
							match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_primary2828); if (state.failed) return result;
							match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_primary2830); if (state.failed) return result;
							}
							break;

						default :
							break loop57;
						}
					}

					match(input,DOT,FOLLOW_DOT_in_primary2834); if (state.failed) return result;
					pushFollow(FOLLOW_class_key_in_primary2836);
					class_key();
					state._fsp--;
					if (state.failed) return result;
					}
					break;
				case 7 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:545:9: ( inlineMapExpression )=> inlineMapExpression
					{
					pushFollow(FOLLOW_inlineMapExpression_in_primary2856);
					inlineMapExpression();
					state._fsp--;
					if (state.failed) return result;
					}
					break;
				case 8 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:546:9: ( inlineListExpression )=> inlineListExpression
					{
					pushFollow(FOLLOW_inlineListExpression_in_primary2871);
					inlineListExpression();
					state._fsp--;
					if (state.failed) return result;
					}
					break;
				case 9 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:547:9: ( ID )=>i1= ID ( ( ( DOT ID )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )* ( ( identifierSuffix )=> identifierSuffix )?
					{
					i1=(Token)match(input,ID,FOLLOW_ID_in_primary2887); if (state.failed) return result;
					if ( state.backtracking==0 ) { helper.emit(i1, DroolsEditorType.IDENTIFIER); }
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:548:9: ( ( ( DOT ID )=> DOT i2= ID ) | ( ( SHARP ID )=> SHARP i2= ID ) | ( ( HASH ID )=> HASH i2= ID ) | ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID ) )*
					loop58:
					while (true) {
						int alt58=5;
						int LA58_0 = input.LA(1);
						if ( (LA58_0==DOT) ) {
							int LA58_2 = input.LA(2);
							if ( (LA58_2==ID) ) {
								int LA58_6 = input.LA(3);
								if ( (synpred28_DRL5Expressions()) ) {
									alt58=1;
								}

							}

						}
						else if ( (LA58_0==SHARP) && (synpred29_DRL5Expressions())) {
							alt58=2;
						}
						else if ( (LA58_0==HASH) && (synpred30_DRL5Expressions())) {
							alt58=3;
						}
						else if ( (LA58_0==NULL_SAFE_DOT) && (synpred31_DRL5Expressions())) {
							alt58=4;
						}

						switch (alt58) {
						case 1 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:549:13: ( ( DOT ID )=> DOT i2= ID )
							{
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:549:13: ( ( DOT ID )=> DOT i2= ID )
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:549:15: ( DOT ID )=> DOT i2= ID
							{
							DOT12=(Token)match(input,DOT,FOLLOW_DOT_in_primary2921); if (state.failed) return result;
							i2=(Token)match(input,ID,FOLLOW_ID_in_primary2925); if (state.failed) return result;
							if ( state.backtracking==0 ) { helper.emit(DOT12, DroolsEditorType.SYMBOL); helper.emit(i2, DroolsEditorType.IDENTIFIER); }
							}

							}
							break;
						case 2 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:551:13: ( ( SHARP ID )=> SHARP i2= ID )
							{
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:551:13: ( ( SHARP ID )=> SHARP i2= ID )
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:551:15: ( SHARP ID )=> SHARP i2= ID
							{
							SHARP13=(Token)match(input,SHARP,FOLLOW_SHARP_in_primary2965); if (state.failed) return result;
							i2=(Token)match(input,ID,FOLLOW_ID_in_primary2969); if (state.failed) return result;
							if ( state.backtracking==0 ) { helper.emit(SHARP13, DroolsEditorType.SYMBOL); helper.emit(i2, DroolsEditorType.IDENTIFIER); }
							}

							}
							break;
						case 3 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:553:13: ( ( HASH ID )=> HASH i2= ID )
							{
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:553:13: ( ( HASH ID )=> HASH i2= ID )
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:553:15: ( HASH ID )=> HASH i2= ID
							{
							HASH14=(Token)match(input,HASH,FOLLOW_HASH_in_primary3009); if (state.failed) return result;
							i2=(Token)match(input,ID,FOLLOW_ID_in_primary3013); if (state.failed) return result;
							if ( state.backtracking==0 ) { helper.emit(HASH14, DroolsEditorType.SYMBOL); helper.emit(i2, DroolsEditorType.IDENTIFIER); }
							}

							}
							break;
						case 4 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:555:13: ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID )
							{
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:555:13: ( ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID )
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:555:15: ( NULL_SAFE_DOT ID )=> NULL_SAFE_DOT i2= ID
							{
							NULL_SAFE_DOT15=(Token)match(input,NULL_SAFE_DOT,FOLLOW_NULL_SAFE_DOT_in_primary3053); if (state.failed) return result;
							i2=(Token)match(input,ID,FOLLOW_ID_in_primary3057); if (state.failed) return result;
							if ( state.backtracking==0 ) { helper.emit(NULL_SAFE_DOT15, DroolsEditorType.SYMBOL); helper.emit(i2, DroolsEditorType.IDENTIFIER); }
							}

							}
							break;

						default :
							break loop58;
						}
					}

					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:556:12: ( ( identifierSuffix )=> identifierSuffix )?
					int alt59=2;
					int LA59_0 = input.LA(1);
					if ( (LA59_0==LEFT_SQUARE) ) {
						int LA59_1 = input.LA(2);
						if ( (synpred32_DRL5Expressions()) ) {
							alt59=1;
						}
					}
					else if ( (LA59_0==LEFT_PAREN) ) {
						int LA59_2 = input.LA(2);
						if ( (synpred32_DRL5Expressions()) ) {
							alt59=1;
						}
					}
					switch (alt59) {
						case 1 :
							// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:556:13: ( identifierSuffix )=> identifierSuffix
							{
							pushFollow(FOLLOW_identifierSuffix_in_primary3079);
							identifierSuffix();
							state._fsp--;
							if (state.failed) return result;
							}
							break;

					}

					}
					break;

			}
		}

		catch (RecognitionException re) {
		    throw re;
		}

		finally {
			// do for sure before leaving
		}
		return result;
	}