You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2015/05/17 16:52:44 UTC

svn commit: r1679867 - /uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g

Author: pkluegl
Date: Sun May 17 14:52:43 2015
New Revision: 1679867

URL: http://svn.apache.org/r1679867
Log:
UIMA-4398
- fixed declare grammar

Modified:
    uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g

Modified: uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g?rev=1679867&r1=1679866&r2=1679867&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g (original)
+++ uima/ruta/trunk/ruta-ep-ide/src/main/antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g Sun May 17 14:52:43 2015
@@ -127,7 +127,12 @@ import org.apache.uima.ruta.ide.parser.a
 		}
 	}
 	
-	public void addType(RutaBlock parent, String type, String parentType) {
+	public void addType(RutaBlock parent, String type, VariableReference parentTypeExpr) {
+	
+	String parentType = "uima.tcas.Annotation";
+          if(parentTypeExpr != null) {
+          	parentType = parentTypeExpr.getName();
+	  }
 		vars.add(type);
 		String descriptionString = null;
        if(packageString == null) {
@@ -144,8 +149,12 @@ import org.apache.uima.ruta.ide.parser.a
 		
 	}
 	
-	public void addType(RutaBlock parent, String name, String parentType, List featuresTypes,
+	public void addType(RutaBlock parent, String name, VariableReference parentTypeExpr, List featuresTypes,
           List<Token> featuresNames) {
+          String parentType = "uima.tcas.Annotation";
+          if(parentTypeExpr != null) {
+          	parentType = parentTypeExpr.getName();
+	  }
 	   	 name = parent.getNamespace() + "." + name.trim();
 	   	 String descriptionString = null;
 	   	 if(packageString == null) {
@@ -504,13 +513,13 @@ declaration returns [List<Statement> stm
 		 id = Identifier {addVariable(id.getText(), declareToken.getText());}
 			
 	(
-	{addType($blockDeclaration::env, id.getText(), lazyParent == null ? null : lazyParent.toString());
+	{addType($blockDeclaration::env, id.getText(), lazyParent);
 			declarations.add(StatementFactory.createAnnotationType(id,declareToken));}
 		(
 		
 		COMMA 
 		 id = Identifier {addVariable(id.getText(), declareToken.getText());}
-			{addType($blockDeclaration::env, id.getText(),  lazyParent == null ? null : lazyParent.toString()); 
+			{addType($blockDeclaration::env, id.getText(),  lazyParent); 
 			declarations.add(StatementFactory.createAnnotationType(id,declareToken));}
 		 )* end = SEMI
 		 {
@@ -518,8 +527,6 @@ declaration returns [List<Statement> stm
 		 stmts.add(stmt);
 		 }
 	|
-	declareToken=DECLARE type=annotationType
-	id = Identifier {addVariable(id.getText(), declareToken.getText());}
 		(LPAREN 
 			(
 			obj1 = annotationType{featureTypes.add(obj1);} 
@@ -552,7 +559,7 @@ declaration returns [List<Statement> stm
 		   features.add(StatementFactory.createFeatureDeclaration(eachTO, eachName));  
 		   i++;
 		}
-		addType($blockDeclaration::env, id.getText(), lazyParent == null? "": lazyParent.toString(), featureTypes, featureNames);
+		addType($blockDeclaration::env, id.getText(), lazyParent, featureTypes, featureNames);
 		declarations.add( StatementFactory.createAnnotationType(id,declareToken, lazyParent, features));
 		stmt = StatementFactory.createDeclareDeclarationsStatement(declareToken, declarations, lazyParent, features);
 		stmts.add(stmt);
@@ -2255,14 +2262,14 @@ dottedComponentDeclaration returns [Comp
 	;
 
 //seems OK
-annotationType returns [Expression at = null]
+annotationType returns [VariableReference at = null]
 	: 
 	(
 	atRef = annotationTypeVariableReference {at = atRef;}
 	)
 	;
 		
-annotationTypeVariableReference returns [Expression typeVar = null]
+annotationTypeVariableReference returns [VariableReference typeVar = null]
   :
   atRef = dottedId 
   {typeVar = ExpressionFactory.createAnnotationTypeVariableReference(atRef);}