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/04/29 16:51:06 UTC
svn commit: r1477113 [9/18] - in
/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide:
./ core/ core/builder/ core/codeassist/ core/extensions/ core/packages/
core/parser/ core/search/ debug/ debug/ui/ debug/ui/handlers/ debug/ui...
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/launching/RutaSourcePathComputer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/launching/RutaSourcePathComputer.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/launching/RutaSourcePathComputer.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/launching/RutaSourcePathComputer.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.launching;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
+
+public class RutaSourcePathComputer implements ISourcePathComputerDelegate {
+
+ public RutaSourcePathComputer() {
+ }
+
+ public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration,
+ IProgressMonitor monitor) throws CoreException {
+ List containers = new ArrayList();
+ return (ISourceContainer[]) containers.toArray(new ISourceContainer[containers.size()]);
+ }
+}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/AbstractFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/AbstractFactory.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/AbstractFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/AbstractFactory.java Mon Apr 29 14:50:56 2013
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import java.util.List;
import org.antlr.runtime.Token;
-import org.apache.uima.textmarker.ide.core.parser.TextMarkerParseUtils;
+import org.apache.uima.ruta.ide.core.parser.RutaParseUtils;
import org.eclipse.dltk.ast.ASTNode;
public abstract class AbstractFactory {
@@ -34,7 +34,7 @@ public abstract class AbstractFactory {
* when token==null or !(token instanceof CommonToken)
*/
protected static final int[] getBounds(Token token) throws IllegalArgumentException {
- return TextMarkerParseUtils.getBounds(token);
+ return RutaParseUtils.getBounds(token);
}
/**
@@ -48,7 +48,7 @@ public abstract class AbstractFactory {
*/
protected static final int[] getBounds(Token tokenA, Token tokenB)
throws IllegalArgumentException {
- return TextMarkerParseUtils.getBounds(tokenA, tokenB);
+ return RutaParseUtils.getBounds(tokenA, tokenB);
}
/**
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ActionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ActionFactory.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ActionFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ActionFactory.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import java.util.ArrayList;
import java.util.Iterator;
@@ -31,7 +31,7 @@ import org.eclipse.dltk.ast.expressions.
public class ActionFactory extends AbstractFactory {
- public static TextMarkerAction createAction(Token type, List exprsRaw) {
+ public static RutaAction createAction(Token type, List exprsRaw) {
int bounds[] = getBounds(type);
int nameStart = bounds[0];
int nameEnd = bounds[1];
@@ -48,12 +48,12 @@ public class ActionFactory extends Abstr
bounds[1] = Math.max(bounds[1], lastExpr.sourceEnd());
}
}
- return new TextMarkerAction(bounds[0], bounds[1], exprs,
+ return new RutaAction(bounds[0], bounds[1], exprs,
ExpressionConstants.USER_EXPRESSION_START + type.getType(), type.getText(), nameStart,
nameEnd);
}
- public static TextMarkerAction createAction(Token type, Expression... exprsArray) {
+ public static RutaAction createAction(Token type, Expression... exprsArray) {
List<Expression> listOfExpressions = new ArrayList<Expression>();
if (exprsArray != null) {
for (int i = 0; i < exprsArray.length; i++) {
@@ -66,13 +66,13 @@ public class ActionFactory extends Abstr
return createAction(type, listOfExpressions);
}
- public static TextMarkerAction createEmptyAction(Token token) {
+ public static RutaAction createEmptyAction(Token token) {
int bounds[] = getBounds(token);
- return new TextMarkerAction(bounds[0], bounds[0], new ArrayList<Expression>(),
+ return new RutaAction(bounds[0], bounds[0], new ArrayList<Expression>(),
TMConditionConstants.CONSTANT_OFFSET, "", bounds[0], bounds[0]);
}
- public static TextMarkerAction createAction(Token type, Map<Expression, Expression> map,
+ public static RutaAction createAction(Token type, Map<Expression, Expression> map,
Expression... exprsArray) {
List<Expression> listOfExpressions = new ArrayList<Expression>();
// TODO add map
@@ -87,16 +87,16 @@ public class ActionFactory extends Abstr
return createAction(type, listOfExpressions);
}
- public static TextMarkerAction createCallAction(Token callToken, ComponentReference ref) {
+ public static RutaAction createCallAction(Token callToken, ComponentReference ref) {
return createAction(callToken, ref);
}
- public static TextMarkerAction createCallAction(Token callToken, ComponentReference ref,
+ public static RutaAction createCallAction(Token callToken, ComponentReference ref,
Expression list) {
return createAction(callToken, ref, list);
}
- public static TextMarkerAction createStructureAction(Token type, Expression structure,
+ public static RutaAction createStructureAction(Token type, Expression structure,
List<Expression> indexes, List<Expression> left, List<Expression> right) {
List<Expression> args = new ArrayList<Expression>();
if (indexes != null) {
@@ -125,7 +125,7 @@ public class ActionFactory extends Abstr
}
}
- public static TextMarkerAction createLogAction(Token type, Expression logString, Token level) {
+ public static RutaAction createLogAction(Token type, Expression logString, Token level) {
int[] nameBounds = getBounds(type);
int[] bounds;
int levelBounds[] = new int[] { -1, -1 };
@@ -140,11 +140,11 @@ public class ActionFactory extends Abstr
}
List exprs = new ArrayList();
exprs.add(logString);
- return new TextMarkerLogAction(bounds[0], bounds[1], type.getText(), nameBounds[0],
+ return new RutaLogAction(bounds[0], bounds[1], type.getText(), nameBounds[0],
nameBounds[1], exprs, levelBounds[0], levelBounds[1]);
}
- public static TextMarkerAction createStructureAction(Token type, Expression structure,
+ public static RutaAction createStructureAction(Token type, Expression structure,
Expression index, Expression table, List left, List right) {
int bounds[] = getBounds(type);
int nameStart = bounds[0];
@@ -172,19 +172,19 @@ public class ActionFactory extends Abstr
bounds[1] = val.sourceEnd();
}
}
- return new TextMarkerStructureAction(bounds[0], bounds[1], numExprs,
+ return new RutaStructureAction(bounds[0], bounds[1], numExprs,
ExpressionConstants.USER_EXPRESSION_START + type.getType(), type.getText(), nameStart,
nameEnd, assignments, structure);
}
- public static TextMarkerAction createAction(Token name, Expression f, List<Expression> list) {
+ public static RutaAction createAction(Token name, Expression f, List<Expression> list) {
List<Expression> list2 = new ArrayList<Expression>();
list2.add(f);
list2.addAll(list);
return createAction(name, list2);
}
- public static TextMarkerAction createAction(Token name, Expression a1, Expression a2,
+ public static RutaAction createAction(Token name, Expression a1, Expression a2,
List<Expression> list) {
List<Expression> complete = new ArrayList<Expression>();
complete.add(a1);
@@ -193,7 +193,7 @@ public class ActionFactory extends Abstr
return createAction(name, complete);
}
- public static TextMarkerAction createConfigureAction(Token name, ComponentReference ns,
+ public static RutaAction createConfigureAction(Token name, ComponentReference ns,
List<Expression> left, List<Expression> right) {
List<Expression> exprs = new ArrayList<Expression>();
exprs.add(ns);
@@ -206,7 +206,7 @@ public class ActionFactory extends Abstr
return createAction(name, exprs);
}
- public static TextMarkerAction createStructureAction(Token name, List<Expression> args,
+ public static RutaAction createStructureAction(Token name, List<Expression> args,
List<Expression> left, List<Expression> right, Expression structure) {
int bounds[] = getBounds(name);
int nameStart = bounds[0];
@@ -230,7 +230,7 @@ public class ActionFactory extends Abstr
bounds[1] = val.sourceEnd();
}
}
- return new TextMarkerStructureAction(bounds[0], bounds[1], numExprs,
+ return new RutaStructureAction(bounds[0], bounds[1], numExprs,
ExpressionConstants.USER_EXPRESSION_START + name.getType(), name.getText(), nameStart,
nameEnd, assignments, structure);
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentDeclaration.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentDeclaration.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentDeclaration.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import org.eclipse.dltk.ast.references.SimpleReference;
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentReference.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentReference.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentReference.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComponentReference.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import org.eclipse.dltk.ast.references.SimpleReference;
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComposedRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComposedRuleElement.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComposedRuleElement.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ComposedRuleElement.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import java.util.List;
@@ -25,14 +25,14 @@ import org.eclipse.dltk.ast.ASTVisitor;
import org.eclipse.dltk.ast.expressions.Expression;
import org.eclipse.dltk.ast.expressions.ExpressionConstants;
-public class ComposedRuleElement extends TextMarkerRuleElement {
+public class ComposedRuleElement extends RutaRuleElement {
List<Expression> elements;
private boolean disjunctive;
public ComposedRuleElement(int start, int end, List<Expression> elements,
- List<Expression> quantifierExpressions, List<TextMarkerCondition> conditionExpressions,
- List<TextMarkerAction> actionExpressions, boolean disjunctive) {
+ List<Expression> quantifierExpressions, List<RutaCondition> conditionExpressions,
+ List<RutaAction> actionExpressions, boolean disjunctive) {
super(start, end, null, quantifierExpressions, conditionExpressions, actionExpressions);
if (elements != null) {
this.elements = elements;
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ConditionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ConditionFactory.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ConditionFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ConditionFactory.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +27,7 @@ import org.eclipse.dltk.ast.expressions.
public class ConditionFactory extends AbstractFactory {
- public static TextMarkerCondition createCondition(Token type, List exprs) {
+ public static RutaCondition createCondition(Token type, List exprs) {
int wholeConditionBounds[] = getBounds(type);
int nameStart = wholeConditionBounds[0];
int nameEnd = wholeConditionBounds[1];
@@ -40,12 +40,12 @@ public class ConditionFactory extends Ab
wholeConditionBounds[1] = Math.max(wholeConditionBounds[1], lastExpr.sourceEnd());
}
}
- return new TextMarkerCondition(wholeConditionBounds[0], wholeConditionBounds[1], exprs,
+ return new RutaCondition(wholeConditionBounds[0], wholeConditionBounds[1], exprs,
TMConditionConstants.CONSTANT_OFFSET + type.getType(), type.getText(), nameStart,
nameEnd);
}
- public static TextMarkerCondition createCondition(Token type, Expression... exprsArray) {
+ public static RutaCondition createCondition(Token type, Expression... exprsArray) {
List<Expression> exprL = new ArrayList<Expression>();
if (exprsArray != null) {
for (int i = 0; i < exprsArray.length; i++) {
@@ -58,19 +58,19 @@ public class ConditionFactory extends Ab
return createCondition(type, exprL);
}
- public static TextMarkerCondition createEmptyCondition(Token token) {
+ public static RutaCondition createEmptyCondition(Token token) {
int bounds[] = getBounds(token);
- return new TextMarkerCondition(bounds[0], bounds[0], new ArrayList<Expression>(),
+ return new RutaCondition(bounds[0], bounds[0], new ArrayList<Expression>(),
TMConditionConstants.CONSTANT_OFFSET, "", bounds[0], bounds[0]);
}
- // public static TextMarkerCondition createConditionAnd(int start, int end,
- // DLTKToken token, List<TextMarkerCondition> conds,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionAnd(int start, int end,
+ // DLTKToken token, List<RutaCondition> conds,
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
- // public static TextMarkerCondition createConditionContains(
+ // public static RutaCondition createConditionContains(
// Expression typeExpr, Token name, Expression min, Expression max,
// Expression percent) {
// int bounds[];
@@ -88,106 +88,106 @@ public class ConditionFactory extends Ab
// percentSet = true;
// bounds[1] = percent.sourceEnd();
// }
- // return new TextMarkerContainsCondition(bounds[0], bounds[1], list,
+ // return new RutaContainsCondition(bounds[0], bounds[1], list,
// percentSet);
// }
//
- // public static TextMarkerCondition createConditionCount(int start, int end,
+ // public static RutaCondition createConditionCount(int start, int end,
// String text, Expression text2, Expression text3,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionContextCount(int start,
+ // public static RutaCondition createConditionContextCount(int start,
// int end, String text, Expression text2, Expression text3,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionInList(int start, int end,
+ // public static RutaCondition createConditionInList(int start, int end,
// String wordList, Expression text, Expression text2,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionInList(int start, int end,
+ // public static RutaCondition createConditionInList(int start, int end,
// List<String> list, Expression text, Expression text2,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionIsInTag(int start,
+ // public static RutaCondition createConditionIsInTag(int start,
// int end, Expression text, List<Expression> list1,
- // List<Expression> list2, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // List<Expression> list2, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionMOfN(int start, int end,
- // List<TextMarkerCondition> conds, Expression text, Expression text2,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionMOfN(int start, int end,
+ // List<RutaCondition> conds, Expression text, Expression text2,
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionNear(int start, int end,
+ // public static RutaCondition createConditionNear(int start, int end,
// Expression text, Expression text2, Expression text3,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionNot(int start, int end,
- // TextMarkerCondition c, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionNot(int start, int end,
+ // RutaCondition c, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionOr(int start, int end,
- // List<TextMarkerCondition> conds, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionOr(int start, int end,
+ // List<RutaCondition> conds, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionPartOf(int start, int end,
- // String text, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionPartOf(int start, int end,
+ // String text, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionPosition(int start,
- // int end, String text, Expression text2, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionPosition(int start,
+ // int end, String text, Expression text2, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionRegExp(int start, int end,
- // Expression text, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionRegExp(int start, int end,
+ // Expression text, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionScore(int start, int end,
+ // public static RutaCondition createConditionScore(int start, int end,
// String text, Expression text2, Expression text3,
- // TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionVote(int start, int end,
- // String text, String text2, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionVote(int start, int end,
+ // String text, String text2, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionLast(int start, int end,
- // String text, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionLast(int start, int end,
+ // String text, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionIf(int start, int end,
- // Expression e, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionIf(int start, int end,
+ // Expression e, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionFeature(int start,
- // int end, TextMarkerBlock parent) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionFeature(int start,
+ // int end, RutaBlock parent) {
+ // return new RutaCondition(start, end);
// }
//
- // public static TextMarkerCondition createConditionParse(int start, int end,
- // TextMarkerBlock env) {
- // return new TextMarkerCondition(start, end);
+ // public static RutaCondition createConditionParse(int start, int end,
+ // RutaBlock env) {
+ // return new RutaCondition(start, end);
// }
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java Mon Apr 29 14:50:56 2013
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import java.util.ArrayList;
import java.util.List;
import org.antlr.runtime.CommonToken;
import org.antlr.runtime.Token;
-import org.apache.uima.textmarker.parser.TextMarkerLexer;
+import org.apache.uima.ruta.parser.RutaLexer;
import org.eclipse.dltk.ast.expressions.BooleanLiteral;
import org.eclipse.dltk.ast.expressions.Expression;
import org.eclipse.dltk.ast.expressions.ExpressionConstants;
@@ -43,57 +43,57 @@ public class ExpressionFactory extends A
*/
private static VariableReference newVariableReference(Token ref, int kind) {
int bounds[] = getBounds(ref);
- return new TextMarkerVariableReference(bounds[0], bounds[1], ref.getText(), kind);
+ return new RutaVariableReference(bounds[0], bounds[1], ref.getText(), kind);
}
public static VariableReference createGenericVariableReference(Token ref) {
return newVariableReference(ref, TMTypeConstants.TM_TYPE_G);
}
- public static TextMarkerQuantifierLiteralExpression createQuantifierLiteralExpression(Token q,
+ public static RutaQuantifierLiteralExpression createQuantifierLiteralExpression(Token q,
Token q2) {
int bounds[] = getBounds(q);
if (q2 != null) {
bounds[1] = Math.max(bounds[1], getBounds(q2)[1]);
}
- return new TextMarkerQuantifierLiteralExpression(bounds[0], bounds[1], q.getText());
+ return new RutaQuantifierLiteralExpression(bounds[0], bounds[1], q.getText());
}
// =====> BOOLEAN-EXPRESSIONS <======
public static Expression createBooleanExpression(Expression e) {
if (e == null)
return null;
- return new TextMarkerExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_B);
+ return new RutaExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_B);
}
- public static TextMarkerBooleanNumberExpression createBooleanNumberExpression(Expression e1,
+ public static RutaBooleanNumberExpression createBooleanNumberExpression(Expression e1,
Token op, Expression e2) {
int lexerOpID = op.getType(); // Integer.valueOf(op.getText());
int operatorID = 0;
// convert lexer-opId to dltk-opId:
switch (lexerOpID) {
- case TextMarkerLexer.LESS:
+ case RutaLexer.LESS:
operatorID = E_LT;
break;
- case TextMarkerLexer.LESSEQUAL:
+ case RutaLexer.LESSEQUAL:
operatorID = E_LE;
break;
- case TextMarkerLexer.GREATER:
+ case RutaLexer.GREATER:
operatorID = E_GT;
break;
- case TextMarkerLexer.GREATEREQUAL:
+ case RutaLexer.GREATEREQUAL:
operatorID = E_GE;
break;
- case TextMarkerLexer.EQUAL:
+ case RutaLexer.EQUAL:
operatorID = E_EQUAL;
break;
- case TextMarkerLexer.NOTEQUAL:
+ case RutaLexer.NOTEQUAL:
operatorID = E_NOT_EQUAL;
break;
default:
break;
}
- return new TextMarkerBooleanNumberExpression(e1.sourceStart(), e2.sourceEnd(), operatorID, e1,
+ return new RutaBooleanNumberExpression(e1.sourceStart(), e2.sourceEnd(), operatorID, e1,
e2);
}
@@ -110,28 +110,28 @@ public class ExpressionFactory extends A
// =====> TYPE-EXPRESSIONS <======
public static Expression createTypeExpression(Expression e) {
- return new TextMarkerExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_AT);
+ return new RutaExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_AT);
}
public static Expression createEmptyTypeExpression(Token token) {
int bounds[] = getBounds(token);
- return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_AT);
+ return new RutaVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_AT);
}
public static Expression createEmptyStringExpression(Token token) {
int bounds[] = getBounds(token);
- return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_S);
+ return new RutaVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_S);
}
public static Expression createEmptyNumberExpression(Token token) {
int bounds[] = getBounds(token);
- return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_N);
+ return new RutaVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_N);
}
public static Expression createEmptyBooleanExpression(Token token) {
int bounds[] = getBounds(token);
- return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_B);
+ return new RutaVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_B);
}
- // public static Expression createSimpleTypeExpression(Token at, TextMarkerBlock env) {
+ // public static Expression createSimpleTypeExpression(Token at, RutaBlock env) {
// int bounds[] = getBounds(at);
- // return new TextMarkerSimpleTypeExpression(bounds[0], bounds[1], at.getText());
+ // return new RutaSimpleTypeExpression(bounds[0], bounds[1], at.getText());
// }
public static VariableReference createAnnotationTypeVariableReference(Token atRef) {
@@ -140,13 +140,13 @@ public class ExpressionFactory extends A
public static Expression createAnnotationTypeConstantReference(Token atBasic) {
int bounds[] = getBounds(atBasic);
- return new TextMarkerVariableReference(bounds[0], bounds[1], atBasic.getText(),
+ return new RutaVariableReference(bounds[0], bounds[1], atBasic.getText(),
TMTypeConstants.TM_TYPE_AT);
- // TextMarkerBasicAnnotationType(atBasic.getText(),bounds[0],bounds[1],bounds[0],bounds[1]);
+ // RutaBasicAnnotationType(atBasic.getText(),bounds[0],bounds[1],bounds[0],bounds[1]);
}
// =====> STRING-EXPRESSIONS <======
- public static TextMarkerStringExpression createStringExpression(List<Expression> exprList) {
+ public static RutaStringExpression createStringExpression(List<Expression> exprList) {
if (exprList == null) {
exprList = new ArrayList<Expression>();
}
@@ -156,7 +156,7 @@ public class ExpressionFactory extends A
start = exprList.get(0).sourceStart();
end = exprList.get(exprList.size() - 1).sourceEnd();
}
- return new TextMarkerStringExpression(start, end, exprList);
+ return new RutaStringExpression(start, end, exprList);
}
public static StringLiteral createSimpleString(Token stringToken) {
@@ -171,8 +171,8 @@ public class ExpressionFactory extends A
}
// =====> NUMBER-EXPRESSIONS <======
- public static TextMarkerExpression createNumberExpression(Expression e) {
- return new TextMarkerExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_N);
+ public static RutaExpression createNumberExpression(Expression e) {
+ return new RutaExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_N);
}
public static NumericLiteral createDecimalLiteral(Token decLit, Token minus) {
@@ -215,35 +215,35 @@ public class ExpressionFactory extends A
if (minus != null) {
bounds[0] = ((CommonToken) minus).getStartIndex();
}
- return new TextMarkerExpression(bounds[0], bounds[1], expr, TMTypeConstants.TM_TYPE_N);
+ return new RutaExpression(bounds[0], bounds[1], expr, TMTypeConstants.TM_TYPE_N);
}
- public static TextMarkerBinaryArithmeticExpression createBinaryArithmeticExpr(Expression exprA,
+ public static RutaBinaryArithmeticExpression createBinaryArithmeticExpr(Expression exprA,
Expression exprB, Token op) {
int bounds[] = getBounds(exprA, exprB);
int lexerOpID = op.getType();
int operatorID = 0;
// convert lexer-opId to dltk-opId:
switch (lexerOpID) {
- case TextMarkerLexer.STAR:
+ case RutaLexer.STAR:
operatorID = ExpressionConstants.E_MULT;
break;
- case TextMarkerLexer.SLASH:
+ case RutaLexer.SLASH:
operatorID = ExpressionConstants.E_DIV;
break;
- case TextMarkerLexer.PERCENT:
+ case RutaLexer.PERCENT:
operatorID = ExpressionConstants.E_MOD;
break;
- case TextMarkerLexer.PLUS:
+ case RutaLexer.PLUS:
operatorID = ExpressionConstants.E_PLUS;
break;
- case TextMarkerLexer.MINUS:
+ case RutaLexer.MINUS:
operatorID = ExpressionConstants.E_MINUS;
break;
default:
break;
}
- return new TextMarkerBinaryArithmeticExpression(bounds[0], bounds[1], exprA, exprB, operatorID);
+ return new RutaBinaryArithmeticExpression(bounds[0], bounds[1], exprA, exprB, operatorID);
}
public static Expression createUnaryArithmeticExpr(Expression expr, Token op) {
@@ -254,7 +254,7 @@ public class ExpressionFactory extends A
System.out.println("debug::expr==null->null pointer Excptn");
}
int opID = convertOpToInt(op);
- return new TextMarkerUnaryArithmeticExpression(bounds[0], bounds[1], expr, opID);
+ return new RutaUnaryArithmeticExpression(bounds[0], bounds[1], expr, opID);
}
private static int convertOpToInt(Token opToken) {
@@ -263,7 +263,7 @@ public class ExpressionFactory extends A
// TODO
public static Expression createBooleanFunction(Token op, Expression e1, Expression e2) {
- return new TextMarkerExpression(e1.sourceStart(), e2.sourceEnd(), null,
+ return new RutaExpression(e1.sourceStart(), e2.sourceEnd(), null,
TMTypeConstants.TM_TYPE_B);
}
@@ -279,7 +279,7 @@ public class ExpressionFactory extends A
int bounds[] = getBounds(path);
String pathWithoutQuotes = path.getText();
pathWithoutQuotes = pathWithoutQuotes.substring(1, pathWithoutQuotes.length() - 1);
- return new TextMarkerRessourceReference(bounds[0], bounds[1], pathWithoutQuotes);
+ return new RutaRessourceReference(bounds[0], bounds[1], pathWithoutQuotes);
}
public static Expression createInnerListExpression(Token lBrak, List<String> inner, Token rBrak) {
@@ -290,7 +290,7 @@ public class ExpressionFactory extends A
s.append(el);
}
s.append(rBrak);
- return new TextMarkerInnerListExpression(boundsA[0], boundsA[1], s.toString());
+ return new RutaInnerListExpression(boundsA[0], boundsA[1], s.toString());
}
public static Expression createBooleanTypeExpression(Expression e1, Token op, Expression e2) {
@@ -298,17 +298,17 @@ public class ExpressionFactory extends A
int operatorID = 0;
// convert lexer-opId to dltk-opId:
switch (lexerOpID) {
- case TextMarkerLexer.EQUAL:
+ case RutaLexer.EQUAL:
operatorID = E_EQUAL;
break;
- case TextMarkerLexer.NOTEQUAL:
+ case RutaLexer.NOTEQUAL:
operatorID = E_NOT_EQUAL;
break;
default:
break;
}
if (e1 != null && e2 != null) {
- return new TextMarkerBooleanTypeExpression(e1.sourceStart(), e2.sourceEnd(), operatorID, e1,
+ return new RutaBooleanTypeExpression(e1.sourceStart(), e2.sourceEnd(), operatorID, e1,
e2);
}
return null;
@@ -329,7 +329,7 @@ public class ExpressionFactory extends A
exprList.get(0).sourceEnd();
}
}
- return new TextMarkerListExpression(start, end, exprList, type);
+ return new RutaListExpression(start, end, exprList, type);
}
public static Expression createListExpression(Token var, int type) {
@@ -363,7 +363,7 @@ public class ExpressionFactory extends A
return createFunction(id, args, TMTypeConstants.TM_TYPE_AT);
}
- public static TextMarkerFunction createFunction(Token type, List<Expression> exprsRaw, int kind) {
+ public static RutaFunction createFunction(Token type, List<Expression> exprsRaw, int kind) {
int bounds[] = getBounds(type);
int nameStart = bounds[0];
int nameEnd = bounds[1];
@@ -380,7 +380,7 @@ public class ExpressionFactory extends A
bounds[1] = Math.max(bounds[1], lastExpr.sourceEnd());
}
}
- return new TextMarkerFunction(bounds[0], bounds[1], exprs,
+ return new RutaFunction(bounds[0], bounds[1], exprs,
kind, type.getText(), nameStart,
nameEnd);
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/FeatureMatchExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/FeatureMatchExpression.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/FeatureMatchExpression.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/FeatureMatchExpression.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import org.antlr.runtime.Token;
import org.eclipse.dltk.ast.ASTVisitor;
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAbstractDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAbstractDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAbstractDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAbstractDeclaration.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.declarations.FieldDeclaration;
+import org.eclipse.dltk.ast.references.SimpleReference;
+
+public abstract class RutaAbstractDeclaration extends FieldDeclaration {
+ private SimpleReference ref;
+
+ public RutaAbstractDeclaration(String name, int nameStart, int nameEnd, int declStart,
+ int declEnd, SimpleReference ref) {
+ super(name, nameStart, nameEnd, nameStart, nameEnd); // declStart, declEnd);
+ this.setName(name);
+ this.ref = ref;
+ }
+
+ @Override
+ public SimpleReference getRef() {
+ return this.ref;
+ }
+
+ @Override
+ public int getKind() {
+ return D_VAR_DECL;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ this.ref.traverse(visitor);
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public int matchStart() {
+ return this.getNameStart();
+ }
+
+ @Override
+ public int matchLength() {
+ return this.getName().length();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaAction extends Expression {
+ protected List<Expression> exprs;
+
+ protected int kind;
+
+ private int nameStart;
+
+ public int getNameStart() {
+ return nameStart;
+ }
+
+ public int getNameEnd() {
+ return nameEnd;
+ }
+
+ private int nameEnd;
+
+ private String name;
+
+ /**
+ * @param start
+ * @param end
+ * @param exprs
+ * @param kind
+ */
+ public RutaAction(int start, int end, List<Expression> exprs, int kind, String name,
+ int nameStart, int nameEnd) {
+ super(start, end);
+ if (exprs != null) {
+ this.exprs = exprs;
+ } else {
+ this.exprs = new ArrayList<Expression>();
+ }
+ this.kind = kind;
+ this.name = name;
+ this.nameStart = nameStart;
+ this.nameEnd = nameEnd;
+ }
+
+ /**
+ * Copy-Constructor
+ *
+ * @param source
+ */
+ public RutaAction(RutaAction source) {
+ super(source.sourceStart(), source.sourceEnd());
+ this.exprs = source.exprs;
+ this.kind = source.kind;
+ }
+
+ @Override
+ public int getKind() {
+ return this.kind;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ for (Expression expr : exprs) {
+ if (expr != null) {
+ expr.traverse(visitor);
+ }
+
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public List<Expression> getChilds() {
+ return exprs;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBasicAnnotationType.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBasicAnnotationType.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBasicAnnotationType.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBasicAnnotationType.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
+
+public class RutaBasicAnnotationType extends TypeDeclaration {
+
+ public RutaBasicAnnotationType(String name, int nameStart, int nameEnd, int start, int end) {
+ super(name, nameStart, nameEnd, start, end);
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBinaryArithmeticExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBinaryArithmeticExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBinaryArithmeticExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBinaryArithmeticExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class RutaBinaryArithmeticExpression extends Expression {
+ private Expression exprA;
+
+ private Expression exprB;
+
+ /**
+ * Classifies the type of Expression represented (+,-,*,...).
+ */
+ private int kind;
+
+ public RutaBinaryArithmeticExpression(int start, int end, Expression exprA,
+ Expression exprB, int kind) {
+ super(start, end);
+ this.exprA = exprA;
+ this.exprB = exprB;
+ this.kind = kind;
+ }
+
+ @Override
+ public int getKind() {
+ return this.kind;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (exprA != null) {
+ exprA.traverse(visitor);
+ }
+ if (exprB != null) {
+ exprB.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("[" + exprA.toString() + " " + getOperator() + " " + exprB.toString()
+ + "]");
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.statements.Statement;
+
+public class RutaBlock extends MethodDeclaration {
+
+ private RutaRule rule;
+
+ private String namespace;
+
+ public RutaBlock(String name, String namespace, int nameStart, int nameEnd, int declStart,
+ int declEnd) {
+ super(name, nameStart, nameEnd, declStart, declEnd);
+ this.namespace = StringUtils.isEmpty(namespace) ? name : namespace + "." + name;
+ }
+
+ public void setElements(List<Statement> body) {
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (rule != null) {
+ rule.traverse(visitor);
+ }
+ traverseChildNodes(visitor);
+ visitor.endvisit(this);
+ }
+ }
+
+ /**
+ * @param ruleElement
+ * the ruleElement to set
+ */
+ public void setRule(RutaRule rule) {
+ this.rule = rule;
+ }
+
+ /**
+ * @return the ruleElement
+ */
+ public RutaRule getRule() {
+ return rule;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlockDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlockDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlockDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBlockDeclaration.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaBlockDeclaration extends MethodDeclaration {
+
+ private Expression ruleElement;
+
+ public RutaBlockDeclaration(DLTKToken type, DLTKToken name, Expression re) {
+ super(type, name);
+ this.ruleElement = re;
+ }
+
+ public Expression getRuleElement() {
+ return ruleElement;
+ }
+
+ public void setRuleElement(Expression ruleElement) {
+ this.ruleElement = ruleElement;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanNumberExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanNumberExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanNumberExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanNumberExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class RutaBooleanNumberExpression extends Expression {
+ /**
+ * <,<=,>,>=,==,...
+ */
+ private int kind;
+
+ private Expression e1;
+
+ private Expression e2;
+
+ public RutaBooleanNumberExpression(int start, int end, int operatorID, Expression e1,
+ Expression e2) {
+ super(start, end);
+ this.kind = operatorID;
+ // List list = new ArrayList<Expression>();
+ // list.add(e1);
+ // list.add(e2);
+ // exprs = new ASTListNode(start, end, list);
+ this.e1 = e1;
+ this.e2 = e2;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ast.statements.Statement#getKind()
+ */
+ @Override
+ public int getKind() {
+ return kind;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ // exprs.traverse(visitor);
+ if (e1 != null) {
+ e1.traverse(visitor);
+ }
+ if (e2 != null) {
+ e2.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ public Expression getE1() {
+ return e1;
+ }
+
+ public Expression getE2() {
+ return e2;
+ }
+
+ @Override
+ public void printNode(CorePrinter output) {
+ // exprs.printNode(output);
+ output.print("(");
+ e1.printNode(output);
+ output.print(" " + getOperator() + " ");
+ e2.printNode(output);
+ output.print(")");
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanTypeExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanTypeExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanTypeExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaBooleanTypeExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class RutaBooleanTypeExpression extends Expression {
+ /**
+ * <,<=,>,>=,==,...
+ */
+ private int kind;
+
+ private Expression e1;
+
+ private Expression e2;
+
+ public RutaBooleanTypeExpression(int start, int end, int operatorID, Expression e1,
+ Expression e2) {
+ super(start, end);
+ this.kind = operatorID;
+ this.e1 = e1;
+ this.e2 = e2;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ast.statements.Statement#getKind()
+ */
+ @Override
+ public int getKind() {
+ return kind;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ // exprs.traverse(visitor);
+ if (e1 != null) {
+ e1.traverse(visitor);
+ }
+ if (e2 != null) {
+ e2.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ public Expression getE1() {
+ return e1;
+ }
+
+ public Expression getE2() {
+ return e2;
+ }
+
+ @Override
+ public void printNode(CorePrinter output) {
+ // exprs.printNode(output);
+ output.print("(");
+ e1.printNode(output);
+ output.print(" " + getOperator() + " ");
+ e2.printNode(output);
+ output.print(")");
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaCondition.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaCondition.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaCondition.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaCondition.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaCondition extends Expression {
+ protected List<Expression> exprs;
+
+ protected int kind;
+
+ private int nameStart;
+
+ private int nameEnd;
+
+ private String name;
+
+ /**
+ * @param start
+ * @param end
+ * @param exprs
+ * @param kind
+ */
+ public RutaCondition(int start, int end, List<Expression> exprs, int kind, String name,
+ int nameStart, int nameEnd) {
+ super(start, end);
+ if (exprs != null) {
+ this.exprs = exprs;
+ } else {
+ this.exprs = new ArrayList<Expression>();
+ }
+ this.kind = kind;
+ this.name = name;
+ this.nameStart = nameStart;
+ this.nameEnd = nameEnd;
+ }
+
+ @Override
+ public int getKind() {
+ return this.kind;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ for (Iterator<Expression> iterator = exprs.iterator(); iterator.hasNext();) {
+ Expression expr = iterator.next();
+ if (expr != null) {
+ expr.traverse(visitor);
+ }
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public List<Expression> getChilds() {
+ return exprs;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getNameStart() {
+ return nameStart;
+ }
+
+ public int getNameEnd() {
+ return nameEnd;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclarationsStatement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclarationsStatement.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclarationsStatement.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclarationsStatement.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.statements.Statement;
+
+/**
+ * Container for declarations,<br>
+ * i.e.:<br>
+ * "INT a, b, c = 2;"<br>
+ * is a RutaDeclarationsStatement with 3 RutaVariableDeclarations.
+ *
+ *
+ */
+public class RutaDeclarationsStatement extends Statement {
+ private List<RutaAbstractDeclaration> declarations;
+
+ private int typeTokenStart;
+
+ private int typeTokenEnd;
+
+ private Expression initExpr;
+
+ // public RutaDeclarationsStatement(int declStart, int declEnd,
+ // List<RutaAbstractDeclaration> declarations, Expression init) {
+ // this(declStart, declEnd, declarations, init, 0, 0);
+ // }
+
+ public RutaDeclarationsStatement(int stmtStart, int stmtEnd,
+ List<RutaAbstractDeclaration> declarations, Expression init, int typeTokenStart,
+ int typeTokenEnd) {
+ super(stmtStart, stmtEnd);
+ this.declarations = declarations == null ? new ArrayList<RutaAbstractDeclaration>()
+ : declarations;
+ this.initExpr = init;
+ this.typeTokenStart = typeTokenStart;
+ this.typeTokenEnd = typeTokenEnd;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (declarations != null) {
+ for (RutaAbstractDeclaration decl : declarations) {
+ decl.traverse(visitor);
+ }
+ }
+ if (initExpr != null) {
+ initExpr.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public int getKind() {
+ return TMStatementConstants.S_DECLARATIONS;
+ }
+
+ public void addDeclaration(RutaAbstractDeclaration decl) {
+ if (decl != null) {
+ this.declarations.add(decl);
+ }
+ }
+
+ public int getDeclarationsCount() {
+ return this.declarations == null ? 0 : this.declarations.size();
+ }
+
+ public List<RutaAbstractDeclaration> getDeclarations() {
+ return declarations;
+ }
+
+ public Expression getInitExpr() {
+ return initExpr;
+ }
+
+ public int getTypeTokenStart() {
+ return typeTokenStart;
+ }
+
+ public int getTypeTokenEnd() {
+ return typeTokenEnd;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclareDeclarationsStatement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclareDeclarationsStatement.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclareDeclarationsStatement.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaDeclareDeclarationsStatement.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+
+public class RutaDeclareDeclarationsStatement extends RutaDeclarationsStatement {
+ private ASTNode parent;
+
+ // public RutaDeclarationsStatement(int declStart, int declEnd,
+ // List<RutaAbstractDeclaration> declarations, Expression init) {
+ // this(declStart, declEnd, declarations, init, 0, 0);
+ // }
+
+ public RutaDeclareDeclarationsStatement(int stmtStart, int stmtEnd,
+ List<RutaAbstractDeclaration> declarations, ASTNode parent, int typeTokenStart,
+ int typeTokenEnd) {
+ super(stmtStart, stmtEnd, declarations, null, typeTokenStart, typeTokenEnd);
+ this.parent = parent;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (parent != null) {
+ parent.traverse(visitor);
+ }
+ if (getDeclarations() != null) {
+ for (RutaAbstractDeclaration decl : getDeclarations()) {
+ decl.traverse(visitor);
+ }
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public int getKind() {
+ return TMStatementConstants.S_DECLARATIONS;
+ }
+
+ public ASTNode getParent() {
+ return parent;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+/**
+ * Wrapper for top level expressions like number, boolean, string, type..
+ *
+ *
+ */
+public class RutaExpression extends Expression {
+ private Expression expression;
+
+ private boolean inParantheses;
+
+ /**
+ * see {@link TMTypeConstants}
+ */
+ private int type;
+
+ public RutaExpression(int sourceStart, int sourceEnd, Expression expression, int type) {
+ super(sourceStart, sourceEnd);
+ this.expression = expression;
+ this.type = type;
+ this.inParantheses = false;
+ if (expression instanceof RutaExpression) {
+ this.inParantheses = ((RutaExpression) expression).isInParantheses();
+ }
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (expression != null) {
+ expression.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ public Expression getExpression() {
+ return this.expression == null ? this : this.expression;
+ }
+
+ @Override
+ public int getKind() {
+ return type;
+ }
+
+ public boolean isInParantheses() {
+ return inParantheses;
+ }
+
+ public void setInParantheses(boolean inParantheses) {
+ this.inParantheses = inParantheses;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpressionList.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpressionList.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpressionList.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaExpressionList.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.statements.StatementConstants;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class RutaExpressionList extends Expression {
+ private List<Expression> expressions;
+
+ /**
+ * Statement with bounds from first to last expression.
+ *
+ * @param expressions
+ */
+ public RutaExpressionList(List<Expression> expressions) {
+ if (!expressions.isEmpty()) {
+ // First
+ Expression first = expressions.get(0);
+ if (first != null) {
+ this.setStart(first.sourceStart());
+ }
+ // Last
+ Expression last = expressions.get(expressions.size() - 1);
+ if (last != null) {
+ this.setEnd(last.sourceEnd());
+ }
+ }
+ this.expressions = expressions;
+ }
+
+ /**
+ * Statement with specified bounds and expression list.
+ *
+ * @param start
+ * @param end
+ * @param expressions
+ */
+ public RutaExpressionList(int start, int end, List<Expression> expressions) {
+ super(start, end);
+ if (expressions == null) {
+ this.expressions = new ArrayList<Expression>();
+ } else {
+ this.expressions = expressions;
+ }
+ }
+
+ public List<Expression> getExpressions() {
+ return this.expressions;
+ }
+
+ public Expression getAt(int index) {
+ if (index >= 0 && index < this.expressions.size()) {
+ return this.expressions.get(index);
+ }
+
+ return null;
+ }
+
+ public int getCount() {
+ return this.expressions.size();
+ }
+
+ @Override
+ public int getKind() {
+ return StatementConstants.S_BLOCK;
+ // return RutaConstants.TM_STATEMENT;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (this.expressions != null) {
+ for (int i = 0; i < this.expressions.size(); i++) {
+ ASTNode node = this.expressions.get(i);
+ if (node != null) {
+ node.traverse(visitor);
+ }
+ }
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public void printNode(CorePrinter output) {
+ if (this.expressions != null) {
+ output.formatPrintLn("");
+ Iterator i = this.expressions.iterator();
+ while (i.hasNext()) {
+ ASTNode node = (ASTNode) i.next();
+ node.printNode(output);
+ output.formatPrintLn(" ");
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ String value = "";
+ if (this.expressions != null) {
+ Iterator i = this.expressions.iterator();
+ while (i.hasNext()) {
+ ASTNode node = (ASTNode) i.next();
+ value += node.toString();
+ value += " ";
+ }
+ }
+
+ return value;
+ }
+
+ public void setExpressions(List<Expression> asList) {
+ if (asList != null) {
+ this.expressions = asList;
+ }
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFeatureDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFeatureDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFeatureDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFeatureDeclaration.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.references.SimpleReference;
+
+public class RutaFeatureDeclaration extends RutaAbstractDeclaration {
+
+ private String type;
+
+ public RutaFeatureDeclaration(String name, String type, int nameStart, int nameEnd,
+ int declStart, int declEnd, SimpleReference ref) {
+ super(name, nameStart, nameEnd, declStart, declEnd, ref);
+ this.type = type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFunction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFunction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFunction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFunction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaFunction extends Expression {
+ protected List<Expression> exprs;
+
+ protected int kind;
+
+ private int nameStart;
+
+ private int nameEnd;
+
+ private String name;
+
+ /**
+ * @param start
+ * @param end
+ * @param exprs
+ * @param kind
+ */
+ public RutaFunction(int start, int end, List<Expression> exprs, int kind, String name,
+ int nameStart, int nameEnd) {
+ super(start, end);
+ if (exprs != null) {
+ this.exprs = exprs;
+ } else {
+ this.exprs = new ArrayList<Expression>();
+ }
+ this.kind = kind;
+ this.name = name;
+ this.nameStart = nameStart;
+ this.nameEnd = nameEnd;
+ }
+
+ /**
+ * Copy-Constructor
+ *
+ * @param source
+ */
+ public RutaFunction(RutaFunction source) {
+ super(source.sourceStart(), source.sourceEnd());
+ this.exprs = source.exprs;
+ this.kind = source.kind;
+ }
+
+ @Override
+ public int getKind() {
+ return this.kind;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ for (Expression expr : exprs) {
+ if (expr != null) {
+ expr.traverse(visitor);
+ }
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public List<Expression> getChilds() {
+ return exprs;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+
+ public int getNameStart() {
+ return nameStart;
+ }
+
+ public int getNameEnd() {
+ return nameEnd;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.expressions.ExpressionConstants;
+import org.eclipse.dltk.ast.references.SimpleReference;
+
+public class RutaImportExpression extends SimpleReference {
+
+ public RutaImportExpression(int start, int end, String name) {
+ super(start, end, name);
+ }
+
+ @Override
+ public int getKind() {
+ return ExpressionConstants.E_IMPORT;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportStatement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportStatement.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportStatement.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaImportStatement.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.ruta.ide.parser.ast;
+
+import org.eclipse.dltk.ast.Modifiers;
+import org.eclipse.dltk.ast.references.SimpleReference;
+
+public class RutaImportStatement extends RutaSimpleStatement {
+ private int type;
+
+ public RutaImportStatement(int sourceStart, int sourceEnd, SimpleReference importRef,
+ int type) {
+ super(sourceStart, sourceEnd, importRef);
+ this.type = type;
+ }
+
+ @Override
+ public int getKind() {
+ return Modifiers.AccNameSpace;
+ }
+
+ /**
+ * See {@link TMStatementConstants}
+ *
+ * @return
+ */
+ public int getType() {
+ return this.type;
+ }
+
+}