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 2013/12/19 14:17:04 UTC

svn commit: r1552312 - in /uima/ruta/trunk/ruta-ep-ide/src/main: antlr3/org/apache/uima/ruta/ide/core/parser/RutaParser.g java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java

Author: pkluegl
Date: Thu Dec 19 13:17:03 2013
New Revision: 1552312

URL: http://svn.apache.org/r1552312
Log:
UIMA-3507
- skip id counter for dummy ast rules

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

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=1552312&r1=1552311&r2=1552312&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 Thu Dec 19 13:17:03 2013
@@ -577,7 +577,7 @@ simpleStatement returns [RutaRule stmt =
 	(regexpRule)=> rer = regexpRule {stmt = rer;}
 	|
 	elements=ruleElementsRoot
-	{stmt = scriptFactory.createRule(elements, null);}
+	{stmt = scriptFactory.createRule(elements, null, false);}
 		s = SEMI 
 	{stmt = scriptFactory.createRule(elements, s);}
 		

Modified: uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java?rev=1552312&r1=1552311&r2=1552312&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java (original)
+++ uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java Thu Dec 19 13:17:03 2013
@@ -36,20 +36,32 @@ public class ScriptFactory extends Abstr
 
   private int idCounter;
 
+  public void resetRuleCounter() {
+    idCounter = 0;
+  }
+  
+  
   public RutaRule createRule(RutaRuleElement element) {
     List<Expression> elements = new ArrayList<Expression>();
     elements.add(element);
     return createRule(elements, null);
   }
 
-  public RutaRule createRule(List<Expression> elements, Token s) {
-    RutaRule rule = new RutaRule(elements, idCounter++);
+  public RutaRule createRule(List<Expression> elements, Token s, boolean updateCounter) {
+    RutaRule rule = new RutaRule(elements, idCounter);
+    if(updateCounter) {
+      idCounter++;
+    }
     if (s != null) {
       int[] bounds = getBounds(s);
       rule.setEnd(bounds[1]);
     }
     return rule;
   }
+  
+  public RutaRule createRule(List<Expression> elements, Token s) {
+    return createRule(elements, s, true);
+  }
 
   public RutaRule createRegExpRule(List<Expression> exprs,
           Map<Expression, Map<Expression, Expression>> fa, Token s) {