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 [10/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/u...
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaInnerListExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaInnerListExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaInnerListExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaInnerListExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,74 @@
+/*
+ * 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;
+
+public class RutaInnerListExpression extends Expression {
+ private String innerList;
+
+ /**
+ * @param start
+ * @param end
+ */
+ public RutaInnerListExpression(int start, int end, String inner) {
+ super(start, end);
+ this.innerList = inner == null ? "" : inner;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public String getOperator() {
+ return TMExpressionConstants.E_INNERLIST_STR;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ast.statements.Statement#getKind()
+ */
+ @Override
+ public int getKind() {
+ return TMExpressionConstants.E_INNERLIST;
+ }
+
+ /**
+ * @param innerList
+ * the innerList to set
+ */
+ public void setInnerList(String innerList) {
+ this.innerList = innerList;
+ }
+
+ /**
+ * @return the innerList
+ */
+ public String getInnerList() {
+ return innerList;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaListExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaListExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaListExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaListExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,72 @@
+/*
+ * 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.ASTListNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.expressions.ExpressionConstants;
+import org.eclipse.dltk.utils.CorePrinter;
+
+
+public class RutaListExpression extends RutaExpression {
+ private ASTListNode exprs;
+
+ private int type;
+
+ public RutaListExpression(int start, int end, List<Expression> exprList, int type) {
+ super(start, end, null, TMTypeConstants.TM_TYPE_S);
+ this.setExprs(new ASTListNode(start, end, exprList));
+ this.type = type;
+ }
+
+ @Override
+ public int getKind() {
+ return ExpressionConstants.E_CONCAT;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ this.getExprs().traverse(visitor);
+ }
+ }
+
+ @Override
+ public void printNode(CorePrinter output) {
+ getExprs().printNode(output);
+ }
+
+ @Override
+ public String getOperator() {
+ return ",";
+ }
+
+ public void setExprs(ASTListNode exprs) {
+ this.exprs = exprs;
+ }
+
+ public ASTListNode getExprs() {
+ return exprs;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaLogAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaLogAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaLogAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaLogAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,59 @@
+/*
+ * 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.expressions.Expression;
+
+public class RutaLogAction extends RutaAction {
+ int[] logLevelBounds;
+
+ boolean logLevelAssigned;
+
+ public RutaLogAction(int exprStart, int exprEnd, String name, int nameStart, int nameEnd,
+ List<Expression> exprs, int levelStart, int levelEnd) {
+ super(exprStart, exprEnd, exprs, TMActionConstants.A_LOG, name, nameStart, nameEnd);
+ logLevelBounds = new int[2];
+ logLevelBounds[0] = levelStart;
+ logLevelBounds[1] = levelEnd;
+ if (levelStart > 0 && levelEnd > 0) {
+ logLevelAssigned = true;
+ }
+ }
+
+ /**
+ * @return may throw nullpointer if no level assigned
+ */
+ public int getLogLevelStart() {
+ return logLevelBounds[0];
+ }
+
+ /**
+ * @return may throw nullpointer if no level assigned
+ */
+ public int getLogLevelEnd() {
+ return logLevelBounds[1];
+ }
+
+ public boolean isLogLevelAssigned() {
+ return logLevelAssigned;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaModuleDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaModuleDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaModuleDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaModuleDeclaration.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.parser.ast;
+
+import org.apache.uima.ruta.ide.core.builder.DescriptorManager;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+
+
+public class RutaModuleDeclaration extends ModuleDeclaration {
+
+ public DescriptorManager descriptorInfo;
+
+ public RutaModuleDeclaration(int sourceLength) {
+ super(sourceLength);
+ }
+
+ public RutaModuleDeclaration(int length, boolean rebuild) {
+ super(length, rebuild);
+ }
+
+ 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/RutaPackageDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaPackageDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaPackageDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaPackageDeclaration.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.Declaration;
+import org.eclipse.dltk.ast.references.SimpleReference;
+
+public class RutaPackageDeclaration extends Declaration {
+ SimpleReference ref;
+
+ public RutaPackageDeclaration(int start, int end, SimpleReference ref) {
+ super(start, end);
+ this.setName(ref.getName());
+ this.setNameStart(ref.sourceStart());
+ this.setNameEnd(ref.sourceEnd());
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaQuantifierLiteralExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaQuantifierLiteralExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaQuantifierLiteralExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaQuantifierLiteralExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.Expression;
+
+public class RutaQuantifierLiteralExpression extends Expression {
+ private String operator;
+
+ public RutaQuantifierLiteralExpression(int start, int end, String operator) {
+ super(start, end);
+ this.operator = operator == null ? "" : operator;
+ }
+
+ @Override
+ public String getOperator() {
+ return this.operator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ast.statements.Statement#getKind()
+ */
+ @Override
+ public int getKind() {
+ return TMExpressionConstants.E_QUANTIFIER_LIT;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRessourceReference.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRessourceReference.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRessourceReference.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRessourceReference.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,35 @@
+/*
+ * 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.StringLiteral;
+
+public class RutaRessourceReference extends StringLiteral {
+
+ public RutaRessourceReference(int start, int end, String value) {
+ super(start, end, value);
+ }
+
+ @Override
+ public int getKind() {
+ return TMExpressionConstants.E_RESSOURCE;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRule.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRule.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRule.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 java.util.List;
+
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaRule extends RutaStatement {
+
+ private final int id;
+
+ public RutaRule(List<Expression> expressions, int id) {
+ super(expressions);
+ this.id = id;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " : " + super.toString();
+ }
+
+ public int getId() {
+ return id;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,114 @@
+/*
+ * 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.expressions.ExpressionConstants;
+
+public class RutaRuleElement extends Expression {
+ protected List<RutaCondition> conditions;
+
+ protected List<RutaAction> actions;
+
+ protected Expression head;
+
+ protected List<Expression> quantifierExpressions;
+
+ // TODO to be removed
+ public RutaRuleElement(int start, int end) {
+ super(start, end);
+ }
+
+ public RutaRuleElement(int start, int end, Expression head,
+ List<Expression> quantifierPartExpressions, List<RutaCondition> conditions,
+ List<RutaAction> actions) {
+ super(start, end);
+ if (conditions != null) {
+ this.conditions = conditions;
+ } else {
+ conditions = new ArrayList<RutaCondition>();
+ }
+ if (actions != null) {
+ this.actions = actions;
+ } else {
+ actions = new ArrayList<RutaAction>();
+ }
+ if (quantifierPartExpressions != null) {
+ this.quantifierExpressions = quantifierPartExpressions;
+ } else {
+ this.quantifierExpressions = new ArrayList<Expression>();
+ }
+ this.head = head;
+ }
+
+ @Override
+ public int getKind() {
+ return ExpressionConstants.E_CALL;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (head != null) {
+ head.traverse(visitor);
+ }
+ if (quantifierExpressions != null) {
+ for (Expression qpe : quantifierExpressions) {
+ qpe.traverse(visitor);
+ }
+ }
+ if (conditions != null) {
+ for (Expression cond : conditions) {
+ cond.traverse(visitor);
+ }
+ }
+ if (actions != null) {
+ for (Expression action : actions) {
+ action.traverse(visitor);
+ }
+ }
+ }
+ }
+
+ public Expression getHead() {
+ return head;
+ }
+
+ public List<RutaAction> getActions() {
+ return actions;
+ }
+
+ public List<RutaCondition> getConditions() {
+ return conditions;
+ }
+
+ public List<Expression> getQuantifierExpressions() {
+ return quantifierExpressions;
+ }
+
+ 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/RutaScript.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScript.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScript.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScript.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+public class RutaScript {
+
+ public RutaScript(RutaScriptBlock rootBlock) {
+ // TODO Auto-generated constructor stub
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScriptBlock.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScriptBlock.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScriptBlock.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaScriptBlock.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,38 @@
+/*
+ * 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.statements.Statement;
+
+public class RutaScriptBlock extends RutaBlock {
+
+ public RutaScriptBlock(String name, String namespace, int nameStart, int nameEnd,
+ int declStart, int declEnd) {
+ super(name, namespace, nameStart, nameEnd, declStart, declEnd);
+ }
+
+ @Override
+ public void setElements(List<Statement> stmts) {
+
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaSimpleStatement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaSimpleStatement.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaSimpleStatement.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaSimpleStatement.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,61 @@
+/*
+ * 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.ast.statements.Statement;
+
+/**
+ * Simple statement with just one expression argument.
+ *
+ */
+public abstract class RutaSimpleStatement extends Statement {
+ private Expression expression;
+
+ public RutaSimpleStatement(int sourceStart, int sourceEnd, Expression expression) {
+ super(sourceStart, sourceEnd);
+ this.expression = expression;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ast.statements.Statement#getKind()
+ */
+ @Override
+ public abstract int getKind();
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ expression.traverse(visitor);
+ visitor.endvisit(this);
+ }
+ }
+
+ public Expression getExpression() {
+ return this.expression;
+ }
+
+ 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/RutaStatement.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStatement.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStatement.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStatement.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,142 @@
+/*
+ * 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.Statement;
+import org.eclipse.dltk.ast.statements.StatementConstants;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class RutaStatement extends Statement {
+ private List<Expression> expressions;
+
+ /**
+ * Statement with bounds from first to last expression.
+ *
+ * @param expressions
+ */
+ public RutaStatement(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 RutaStatement(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) {
+ this.expressions = asList;
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStringExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStringExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStringExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStringExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,59 @@
+/*
+ * 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.ASTListNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Simple string literal or concatenation of strings / string expressions
+ *
+ *
+ */
+public class RutaStringExpression extends RutaExpression {
+ private ASTListNode exprs;
+
+ public RutaStringExpression(int start, int end, List<Expression> exprList) {
+ super(start, end, null, TMTypeConstants.TM_TYPE_S);
+ this.exprs = new ASTListNode(start, end, exprList);
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ this.exprs.traverse(visitor);
+ }
+ }
+
+ @Override
+ public void printNode(CorePrinter output) {
+ exprs.printNode(output);
+ }
+
+ @Override
+ public String getOperator() {
+ return "+";
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStructureAction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStructureAction.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStructureAction.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStructureAction.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,82 @@
+/*
+ * 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 java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaStructureAction extends RutaAction {
+ private Expression structure;
+
+ private Map<Expression, Expression> assignments;
+
+ public RutaStructureAction(int start, int end, List<Expression> exprs, int kind,
+ String name, int nameStart, int nameEnd, Map<Expression, Expression> assignments,
+ Expression structure) {
+ super(start, end, exprs, kind, name, nameStart, nameEnd);
+ this.assignments = assignments;
+ this.structure = structure;
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ for (Expression e : super.exprs) {
+ e.traverse(visitor);
+ }
+ Iterator<Entry<Expression, Expression>> it = assignments.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<Expression, Expression> pairs = it.next();
+ if (pairs.getKey() == null || pairs.getValue() == null) {
+ break;
+ }
+ ((Expression) pairs.getKey()).traverse(visitor);
+ ((Expression) pairs.getValue()).traverse(visitor);
+ }
+ }
+ }
+
+ @Override
+ public List<Expression> getChilds() {
+ List<Expression> l = new ArrayList<Expression>();
+ l.addAll(super.getChilds());
+ l.addAll(assignments.keySet());
+ l.addAll(assignments.values());
+ return l;
+ }
+
+ public Map<Expression, Expression> getAssignments() {
+ return assignments;
+ }
+
+ public Expression getStructure() {
+ return structure;
+ }
+
+ public List<Expression> getExpressions() {
+ return super.exprs;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaTypeDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaTypeDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaTypeDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaTypeDeclaration.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,65 @@
+/*
+ * 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.references.SimpleReference;
+
+public class RutaTypeDeclaration extends RutaAbstractDeclaration {
+
+ private List<RutaFeatureDeclaration> features = new ArrayList<RutaFeatureDeclaration>();
+
+ public RutaTypeDeclaration(String name, int nameStart, int nameEnd, int declStart,
+ int declEnd, SimpleReference ref) {
+ super(name, nameStart, nameEnd, declStart, declEnd, ref);
+ }
+
+ public RutaTypeDeclaration(String name, int nameStart, int nameEnd, int declStart,
+ int declEnd, SimpleReference ref, List<RutaFeatureDeclaration> features) {
+ super(name, nameStart, nameEnd, declStart, declEnd, ref);
+ this.setFeatures(features);
+ }
+
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ getRef().traverse(visitor);
+ for (RutaFeatureDeclaration each : getFeatures()) {
+ each.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public int getKind() {
+ return TMTypeConstants.TM_TYPE_AT;
+ }
+
+ public void setFeatures(List<RutaFeatureDeclaration> features) {
+ this.features = features;
+ }
+
+ public List<RutaFeatureDeclaration> getFeatures() {
+ return features;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaUnaryArithmeticExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaUnaryArithmeticExpression.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaUnaryArithmeticExpression.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaUnaryArithmeticExpression.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,72 @@
+/*
+ * 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.Iterator;
+import java.util.Map;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public class RutaUnaryArithmeticExpression extends Expression {
+ private int opID;
+
+ private Expression expr;
+
+ public RutaUnaryArithmeticExpression(int start, int end, Expression expr, int opID) {
+ super(start, end);
+ this.opID = opID;
+ this.expr = expr;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.dltk.ast.statements.Statement#getKind()
+ */
+ @Override
+ public int getKind() {
+ return opID;
+ }
+
+ @Override
+ public String getOperator() {
+ Map<String, Integer> map = TMExpressionConstants.opIDs;
+ for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
+ String key = (String) iterator.next();
+ Integer intID = map.get(key);
+ if (intID.equals(opID)) {
+ return key;
+ }
+ }
+ return super.getOperator();
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (expr != null) {
+ this.expr.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableDeclaration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableDeclaration.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableDeclaration.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableDeclaration.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,74 @@
+/*
+ * 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.ast.references.SimpleReference;
+
+public class RutaVariableDeclaration extends RutaAbstractDeclaration {
+
+ private int type;
+
+ private boolean hasInitExpression;
+
+ private Expression initExpression;
+
+ public RutaVariableDeclaration(String name, int nameStart, int nameEnd, int declStart,
+ int declEnd, SimpleReference ref, int type) {
+ super(name, nameStart, nameEnd, declStart, declEnd, ref);
+ this.type = type;
+ hasInitExpression = false;
+ }
+
+ public RutaVariableDeclaration(String name, int nameStart, int nameEnd, int declStart,
+ int declEnd, SimpleReference ref, int type, Expression initExpression) {
+ this(name, nameStart, nameEnd, declStart, declEnd, ref, type);
+ this.initExpression = initExpression;
+ if (initExpression != null) {
+ hasInitExpression = true;
+ }
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ getRef().traverse(visitor);
+ if (hasInitExpression) {
+ initExpression.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return this.getName() + ":: RutaIntVariable :: " + super.toString();
+ }
+
+ @Override
+ public int getKind() {
+ return type;
+ }
+
+ public boolean hasInitExpression() {
+ return hasInitExpression;
+ }
+}
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableReference.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableReference.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableReference.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaVariableReference.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.references.VariableReference;
+
+public class RutaVariableReference extends VariableReference {
+ private int typeId;
+
+ /**
+ * @param start
+ * @param end
+ * @param name
+ * @param typedId
+ * raw type id from {@link TMTypeConstants}
+ */
+ public RutaVariableReference(int start, int end, String name, int typedId) {
+ super(start, end, name);
+ this.typeId = typedId;
+ }
+
+ public int getType() {
+ return this.typeId;
+ }
+
+ public void setType(int type) {
+ this.typeId = type;
+ }
+}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.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/ScriptFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.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;
@@ -32,14 +32,14 @@ public class ScriptFactory extends Abstr
private int idCounter;
- public TextMarkerRule createRule(TextMarkerRuleElement element) {
+ public RutaRule createRule(RutaRuleElement element) {
List<Expression> elements = new ArrayList<Expression>();
elements.add(element);
return createRule(elements, null);
}
- public TextMarkerRule createRule(List<Expression> elements, Token s) {
- TextMarkerRule rule = new TextMarkerRule(elements, idCounter++);
+ public RutaRule createRule(List<Expression> elements, Token s) {
+ RutaRule rule = new RutaRule(elements, idCounter++);
if (s != null) {
int[] bounds = getBounds(s);
rule.setEnd(bounds[1]);
@@ -48,8 +48,8 @@ public class ScriptFactory extends Abstr
}
public ComposedRuleElement createComposedRuleElement(List<Expression> res, List<Expression> q,
- List<TextMarkerCondition> c, List<TextMarkerAction> a, boolean disjunctive,
- TextMarkerBlock env, Token... tokens) {
+ List<RutaCondition> c, List<RutaAction> a, boolean disjunctive,
+ RutaBlock env, Token... tokens) {
int bounds[] = getSurroundingBounds((ASTNode) null, res);
// taking care of null statements - errors should have been recognized
// in parser
@@ -84,9 +84,9 @@ public class ScriptFactory extends Abstr
return new ComposedRuleElement(bounds[0], bounds[1], res, q, c, a, disjunctive);
}
- public TextMarkerRuleElement createRuleElement(Expression head,
- List<Expression> quantifierPartExpressions, List<TextMarkerCondition> conditions,
- List<TextMarkerAction> actions, Token end) {
+ public RutaRuleElement createRuleElement(Expression head,
+ List<Expression> quantifierPartExpressions, List<RutaCondition> conditions,
+ List<RutaAction> actions, Token end) {
int bounds[] = getSurroundingBounds(head, conditions, actions);
setMaxEnd(bounds, end);
// taking care of null statements - errors should have been recognized
@@ -101,17 +101,17 @@ public class ScriptFactory extends Abstr
if (quantifierPart != null) {
bounds[1] = Math.max(bounds[1], quantifierPart.sourceEnd());
}
- return new TextMarkerRuleElement(bounds[0], bounds[1], head, quantifierPartExpressions,
+ return new RutaRuleElement(bounds[0], bounds[1], head, quantifierPartExpressions,
conditions, actions);
}
- public TextMarkerRuleElement createRuleElement(Token w, List<TextMarkerCondition> c,
- List<TextMarkerAction> a, Token end) {
+ public RutaRuleElement createRuleElement(Token w, List<RutaCondition> c,
+ List<RutaAction> a, Token end) {
int bounds[] = getSurroundingBounds(null, c, a);
setMinBegin(bounds, w);
filterNullObjects(c);
filterNullObjects(a);
- return new TextMarkerRuleElement(bounds[0], bounds[1], null, null,
+ return new RutaRuleElement(bounds[0], bounds[1], null, null,
c, a);
}
@@ -132,11 +132,11 @@ public class ScriptFactory extends Abstr
* @param packageString
* @return
*/
- public TextMarkerScriptBlock createScriptBlock(int declStart, int declEnd, int nameStart,
- int nameEnd, String string, List<TextMarkerRuleElement> res, Block block,
+ public RutaScriptBlock createScriptBlock(int declStart, int declEnd, int nameStart,
+ int nameEnd, String string, List<RutaRuleElement> res, Block block,
String packageString) {
createRule(new ArrayList<Expression>(), null);
- return new TextMarkerScriptBlock(string, packageString, nameStart, nameEnd, declStart, declEnd);
+ return new RutaScriptBlock(string, packageString, nameStart, nameEnd, declStart, declEnd);
}
/**
@@ -148,21 +148,21 @@ public class ScriptFactory extends Abstr
* @param textMarkerBlock
* @return
*/
- public TextMarkerBlock createScriptBlock(Token id, Token type, TextMarkerBlock textMarkerBlock) {
+ public RutaBlock createScriptBlock(Token id, Token type, RutaBlock textMarkerBlock) {
int[] bounds = getBounds(type, id);
int[] nameBounds = getBounds(id);
if (textMarkerBlock == null) {
- TextMarkerBlock block = new TextMarkerBlock(id.getText(), "error", nameBounds[0],
+ RutaBlock block = new RutaBlock(id.getText(), "error", nameBounds[0],
nameBounds[1], bounds[0], bounds[1]);
return block;
} else {
- TextMarkerBlock block = new TextMarkerBlock(id.getText(), textMarkerBlock.getNamespace(),
+ RutaBlock block = new RutaBlock(id.getText(), textMarkerBlock.getNamespace(),
nameBounds[0], nameBounds[1], bounds[0], bounds[1]);
return block;
}
}
- public void finalizeScriptBlock(TextMarkerBlock block, Token rc, TextMarkerRule rule,
+ public void finalizeScriptBlock(RutaBlock block, Token rc, RutaRule rule,
List<Statement> body) {
// taking care of null statements - errors should have been recognized
// in parser
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/StatementFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/StatementFactory.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/StatementFactory.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/StatementFactory.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;
@@ -38,10 +38,10 @@ public class StatementFactory extends Ab
* Antlr-Token (dotted-identifier/id)
* @return new Import-Statement
*/
- public static TextMarkerImportStatement createImport(ComponentDeclaration dottedId,
+ public static RutaImportStatement createImport(ComponentDeclaration dottedId,
Token impString, int type) {
int bounds[] = getBounds(impString, dottedId);
- return new TextMarkerImportStatement(bounds[0], bounds[1], dottedId, type);
+ return new RutaImportStatement(bounds[0], bounds[1], dottedId, type);
}
public static ComponentDeclaration createEmptyComponentDeclaration(Token t) {
@@ -51,13 +51,13 @@ public class StatementFactory extends Ab
return new ComponentDeclaration(bounds[0], bounds[1], "");
}
- public static TextMarkerImportStatement createImportTypeSystem(ComponentDeclaration dottedId,
+ public static RutaImportStatement createImportTypeSystem(ComponentDeclaration dottedId,
Token impString) {
dottedId.setType(ComponentDeclaration.TYPESYSTEM);
return createImport(dottedId, impString, TMStatementConstants.S_IMPORT_TYPESYSTEM);
}
- public static TextMarkerImportStatement createImportScript(ComponentDeclaration dottedId,
+ public static RutaImportStatement createImportScript(ComponentDeclaration dottedId,
Token impString) {
if (dottedId != null) {
dottedId.setType(ComponentDeclaration.SCRIPT);
@@ -65,7 +65,7 @@ public class StatementFactory extends Ab
return createImport(dottedId, impString, TMStatementConstants.S_IMPORT_SCRIPT);
}
- public static TextMarkerImportStatement createImportEngine(ComponentDeclaration dottedId,
+ public static RutaImportStatement createImportEngine(ComponentDeclaration dottedId,
Token impString) {
dottedId.setType(ComponentDeclaration.ENGINE);
return createImport(dottedId, impString, TMStatementConstants.S_IMPORT_ENGINE);
@@ -78,7 +78,7 @@ public class StatementFactory extends Ab
* Antlr-Token (dotted-identifier/id)
* @return
*/
- public static TextMarkerPackageDeclaration createPkgDeclaration(Token dottedId, Token pString) {
+ public static RutaPackageDeclaration createPkgDeclaration(Token dottedId, Token pString) {
int bounds[] = getBounds(pString, dottedId);
int nameBounds[] = new int[2];
if (dottedId != null) {
@@ -86,7 +86,7 @@ public class StatementFactory extends Ab
}
SimpleReference ref = new SimpleReference(nameBounds[0], nameBounds[1], dottedId == null ? ""
: dottedId.getText());
- return new TextMarkerPackageDeclaration(bounds[0], bounds[1], ref);
+ return new RutaPackageDeclaration(bounds[0], bounds[1], ref);
}
/**
@@ -94,18 +94,18 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- private static TextMarkerVariableDeclaration createVariable(Token id, Token typeToken, int type) {
+ private static RutaVariableDeclaration createVariable(Token id, Token typeToken, int type) {
return createVariable(id, typeToken, type, null);
}
- private static TextMarkerVariableDeclaration createVariable(Token id, Token typeToken, int type,
+ private static RutaVariableDeclaration createVariable(Token id, Token typeToken, int type,
Expression expr) {
int declBounds[] = getBounds(typeToken, id);
int nameBounds[] = getBounds(id);
// FieldDeclaration
- SimpleReference ref = new TextMarkerVariableReference(nameBounds[0], nameBounds[1], id
+ SimpleReference ref = new RutaVariableReference(nameBounds[0], nameBounds[1], id
.getText(), type);
- return new TextMarkerVariableDeclaration(id.getText(), nameBounds[0], nameBounds[1],
+ return new RutaVariableDeclaration(id.getText(), nameBounds[0], nameBounds[1],
declBounds[0], declBounds[1], ref, type, expr);
}
@@ -114,7 +114,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createIntVariable(Token id, Token type) {
+ public static RutaVariableDeclaration createIntVariable(Token id, Token type) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_I);
}
@@ -132,7 +132,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createDoubleVariable(Token id, Token type) {
+ public static RutaVariableDeclaration createDoubleVariable(Token id, Token type) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_D);
}
@@ -141,7 +141,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createStringVariable(Token id, Token type) {
+ public static RutaVariableDeclaration createStringVariable(Token id, Token type) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_S);
}
@@ -150,7 +150,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createBooleanVariable(Token id, Token type) {
+ public static RutaVariableDeclaration createBooleanVariable(Token id, Token type) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_B);
}
@@ -159,7 +159,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createTypeVariable(Token id, Token type) {
+ public static RutaVariableDeclaration createTypeVariable(Token id, Token type) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_AT);
}
@@ -168,7 +168,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createListVariable(Token id, Token type,
+ public static RutaVariableDeclaration createListVariable(Token id, Token type,
Expression expr) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_WL, expr);
}
@@ -178,7 +178,7 @@ public class StatementFactory extends Ab
* @param type
* @return
*/
- public static TextMarkerVariableDeclaration createTableVariable(Token id, Token type,
+ public static RutaVariableDeclaration createTableVariable(Token id, Token type,
Expression expr) {
return createVariable(id, type, TMTypeConstants.TM_TYPE_WT, expr);
}
@@ -193,7 +193,7 @@ public class StatementFactory extends Ab
*/
public static Declaration createAnnotationType(Token id, Token declareToken, Expression type,
- List<TextMarkerFeatureDeclaration> features) {
+ List<RutaFeatureDeclaration> features) {
int declBounds[] = getBounds(declareToken, id);
if (features != null && !features.isEmpty()) {
@@ -202,9 +202,9 @@ public class StatementFactory extends Ab
int nameBounds[] = getBounds(id);
// FieldDeclarartion
- SimpleReference ref = new TextMarkerVariableReference(nameBounds[0], nameBounds[1], id
+ SimpleReference ref = new RutaVariableReference(nameBounds[0], nameBounds[1], id
.getText(), TMTypeConstants.TM_TYPE_AT);
- return new TextMarkerTypeDeclaration(id.getText(), nameBounds[0], nameBounds[1], declBounds[0],
+ return new RutaTypeDeclaration(id.getText(), nameBounds[0], nameBounds[1], declBounds[0],
declBounds[1], ref, features);
}
@@ -212,13 +212,13 @@ public class StatementFactory extends Ab
int declBounds[] = getBounds(declareToken, id);
int nameBounds[] = getBounds(id);
- SimpleReference ref = new TextMarkerVariableReference(nameBounds[0], nameBounds[1], id
+ SimpleReference ref = new RutaVariableReference(nameBounds[0], nameBounds[1], id
.getText(), TMTypeConstants.TM_TYPE_AT);
- return new TextMarkerTypeDeclaration(id.getText(), nameBounds[0], nameBounds[1], declBounds[0],
+ return new RutaTypeDeclaration(id.getText(), nameBounds[0], nameBounds[1], declBounds[0],
declBounds[1], ref);
}
- public static TextMarkerFeatureDeclaration createFeatureDeclaration(Object eachTO, Token eachName) {
+ public static RutaFeatureDeclaration createFeatureDeclaration(Object eachTO, Token eachName) {
int declBounds[] = { 0, 0 };
String type = "";
if (eachTO instanceof ASTNode) {
@@ -232,15 +232,15 @@ public class StatementFactory extends Ab
}
int nameBounds[] = getBounds(eachName);
SimpleReference ref = new SimpleReference(nameBounds[0], nameBounds[1], eachName.getText());
- return new TextMarkerFeatureDeclaration(eachName.getText(), type, nameBounds[0], nameBounds[1],
+ return new RutaFeatureDeclaration(eachName.getText(), type, nameBounds[0], nameBounds[1],
declBounds[0], declBounds[1], ref);
}
@SuppressWarnings("unchecked")
public static Statement createDeclareDeclarationsStatement(Token declareToken, List declarations,
ASTNode parent) {
- List<TextMarkerAbstractDeclaration> decls = declarations;
- for (TextMarkerAbstractDeclaration d : decls) {
+ List<RutaAbstractDeclaration> decls = declarations;
+ for (RutaAbstractDeclaration d : decls) {
if (d == null) {
decls.remove(d);
}
@@ -253,15 +253,15 @@ public class StatementFactory extends Ab
int end = decls.get(decls.size() - 1).sourceEnd();
statementBounds[1] = Math.max(statementBounds[1], end);
}
- return new TextMarkerDeclareDeclarationsStatement(statementBounds[0], statementBounds[1],
+ return new RutaDeclareDeclarationsStatement(statementBounds[0], statementBounds[1],
declarations, parent, declBounds[0], declBounds[1]);
}
@SuppressWarnings("unchecked")
public static Statement createDeclarationsStatement(Token declareToken, List declarations,
Expression init) {
- List<TextMarkerAbstractDeclaration> decls = declarations;
- for (TextMarkerAbstractDeclaration d : decls) {
+ List<RutaAbstractDeclaration> decls = declarations;
+ for (RutaAbstractDeclaration d : decls) {
if (d == null) {
decls.remove(d);
}
@@ -274,7 +274,7 @@ public class StatementFactory extends Ab
int end = decls.get(decls.size() - 1).sourceEnd();
statementBounds[1] = Math.max(statementBounds[1], end);
}
- return new TextMarkerDeclarationsStatement(statementBounds[0], statementBounds[1],
+ return new RutaDeclarationsStatement(statementBounds[0], statementBounds[1],
declarations, init, declBounds[0], declBounds[1]);
}
@@ -285,18 +285,18 @@ public class StatementFactory extends Ab
@SuppressWarnings("unchecked")
public static Statement createDeclarationsStatement(Token declareToken,
- TextMarkerAbstractDeclaration declaration, Expression init) {
- List decl = new ArrayList<TextMarkerAbstractDeclaration>();
+ RutaAbstractDeclaration declaration, Expression init) {
+ List decl = new ArrayList<RutaAbstractDeclaration>();
return createDeclarationsStatement(declareToken, decl, init);
}
public static Statement createComposedVariableConditionDeclaration(Token id,
- List<TextMarkerCondition> conditions) {
+ List<RutaCondition> conditions) {
return null;
}
public static Statement createComposedVariableActionDeclaration(Token id,
- List<TextMarkerAction> actions) {
+ List<RutaAction> actions) {
return null;
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMActionConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMActionConstants.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/TMActionConstants.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMActionConstants.java Mon Apr 29 14:50:56 2013
@@ -17,23 +17,23 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
-import org.apache.uima.textmarker.ide.core.parser.TextMarkerParser;
+import org.apache.uima.ruta.ide.core.parser.RutaParser;
import org.eclipse.dltk.ast.expressions.ExpressionConstants;
public interface TMActionConstants {
public static final int A_CALL = ExpressionConstants.USER_EXPRESSION_START
- + TextMarkerParser.CALL;
+ + RutaParser.CALL;
public static final int A_ASSIGN = ExpressionConstants.USER_EXPRESSION_START
- + TextMarkerParser.ASSIGN;
+ + RutaParser.ASSIGN;
public static final int A_CREATE = ExpressionConstants.USER_EXPRESSION_START
- + TextMarkerParser.CREATE;
+ + RutaParser.CREATE;
public static final int A_FILL = ExpressionConstants.USER_EXPRESSION_START
- + TextMarkerParser.FILL;
+ + RutaParser.FILL;
- public static final int A_LOG = ExpressionConstants.USER_EXPRESSION_START + TextMarkerParser.LOG;
+ public static final int A_LOG = ExpressionConstants.USER_EXPRESSION_START + RutaParser.LOG;
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMConditionConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMConditionConstants.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/TMConditionConstants.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMConditionConstants.java Mon Apr 29 14:50:56 2013
@@ -17,19 +17,19 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
-import org.apache.uima.textmarker.ide.core.parser.TextMarkerParser;
+import org.apache.uima.ruta.ide.core.parser.RutaParser;
import org.eclipse.dltk.ast.expressions.ExpressionConstants;
public class TMConditionConstants {
public static final int CONSTANT_OFFSET = ExpressionConstants.USER_EXPRESSION_START;
// important for formatter to handle the only condition without parantheses
- public static final int COND_MINUS = CONSTANT_OFFSET + TextMarkerParser.MINUS;
+ public static final int COND_MINUS = CONSTANT_OFFSET + RutaParser.MINUS;
// public static int getConditionConstant(String str) {
- // // TextMarkerParser.tokenNames;
+ // // RutaParser.tokenNames;
// return 0;
// }
}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMExpressionConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMExpressionConstants.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/TMExpressionConstants.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMExpressionConstants.java Mon Apr 29 14:50:56 2013
@@ -17,30 +17,30 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.parser.ast;
+package org.apache.uima.ruta.ide.parser.ast;
import java.util.HashMap;
import java.util.Map;
-import org.apache.uima.textmarker.parser.TextMarkerLexer;
+import org.apache.uima.ruta.parser.RutaLexer;
import org.eclipse.dltk.ast.expressions.ExpressionConstants;
public final class TMExpressionConstants implements ExpressionConstants {
- public static final int E_EXP = USER_EXPRESSION_START + TextMarkerLexer.EXP;
+ public static final int E_EXP = USER_EXPRESSION_START + RutaLexer.EXP;
- public static final int E_LOGN = USER_EXPRESSION_START + TextMarkerLexer.LOGN;
+ public static final int E_LOGN = USER_EXPRESSION_START + RutaLexer.LOGN;
- public static final int E_SIN = USER_EXPRESSION_START + TextMarkerLexer.SIN;
+ public static final int E_SIN = USER_EXPRESSION_START + RutaLexer.SIN;
- public static final int E_COS = USER_EXPRESSION_START + TextMarkerLexer.COS;
+ public static final int E_COS = USER_EXPRESSION_START + RutaLexer.COS;
- public static final int E_TAN = USER_EXPRESSION_START + TextMarkerLexer.TAN;
+ public static final int E_TAN = USER_EXPRESSION_START + RutaLexer.TAN;
- public static final int E_QUANTIFIER_LIT = USER_EXPRESSION_START + TextMarkerLexer.QUESTION;
+ public static final int E_QUANTIFIER_LIT = USER_EXPRESSION_START + RutaLexer.QUESTION;
- public static final int E_INNERLIST = USER_EXPRESSION_START + TextMarkerLexer.RBRACK;
+ public static final int E_INNERLIST = USER_EXPRESSION_START + RutaLexer.RBRACK;
- public static final int E_RESSOURCE = USER_EXPRESSION_START + TextMarkerLexer.RessourceLiteral;
+ public static final int E_RESSOURCE = USER_EXPRESSION_START + RutaLexer.RessourceLiteral;
public static final String E_EXP_STR = "EXP";
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMStatementConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMStatementConstants.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/TMStatementConstants.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMStatementConstants.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;
public interface TMStatementConstants {
public static final int S_USERSTART = 1;
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMTypeConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMTypeConstants.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/TMTypeConstants.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/TMTypeConstants.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.HashMap;
import java.util.Map;
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/DefaultRutaSemanticHighlightingExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/DefaultRutaSemanticHighlightingExtension.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/DefaultRutaSemanticHighlightingExtension.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/DefaultRutaSemanticHighlightingExtension.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,117 @@
+/*
+ * 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.ui;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.ruta.ide.parser.ast.RutaModuleDeclaration;
+import org.apache.uima.ruta.ide.ui.text.RutaTextTools;
+import org.eclipse.dltk.ast.ASTListNode;
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.Argument;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
+import org.eclipse.dltk.compiler.env.ISourceModule;
+import org.eclipse.dltk.core.SourceParserUtil;
+import org.eclipse.dltk.ui.editor.highlighting.HighlightedPosition;
+import org.eclipse.dltk.ui.editor.highlighting.ISemanticHighlightingRequestor;
+import org.eclipse.dltk.ui.editor.highlighting.SemanticHighlighting;
+
+
+public class DefaultRutaSemanticHighlightingExtension implements
+ ISemanticHighlightingExtension {
+
+ private SemanticHighlighting[] highlightings = new SemanticHighlighting[] {
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_DECLARATION_DEFINITION_COLOR,
+ null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_FUNCTION_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_ACTION_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_CONDITION_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_STRING_COLOR, null, null),
+ new RutaTextTools.SH(RutaPreferenceConstants.EDITOR_VARIABLE_COLOR,
+ RutaPreferenceConstants.EDITOR_CONDITION_COLOR, null) };
+
+ public DefaultRutaSemanticHighlightingExtension() {
+ }
+
+ public HighlightedPosition[] calculatePositions(ASTNode node,
+ ISemanticHighlightingRequestor requestor) {
+
+ // Check Ruta procedures
+ if (node instanceof MethodDeclaration) {
+ MethodDeclaration m = (MethodDeclaration) node;
+ requestor.addPosition(m.getNameStart(), m.getNameEnd(), RutaPreferenceConstants.EDITOR_FUNCTION_COLOR);
+
+ }
+
+ if (node instanceof Argument) {
+ Argument m = (Argument) node;
+ requestor.addPosition(m.getNameStart(), m.getNameEnd(), RutaPreferenceConstants.EDITOR_VARIABLE_COLOR);
+ }
+
+ if (node instanceof TypeDeclaration) {
+
+ TypeDeclaration t = (TypeDeclaration) node;
+ List children;
+
+ // Handle base classes highlighting
+ ASTListNode s = t.getSuperClasses();
+
+ if (s != null && s.getChilds() != null) {
+ children = s.getChilds();
+ Iterator it = children.iterator();
+ while (it.hasNext()) {
+ ASTNode n = (ASTNode) it.next();
+ requestor.addPosition(n.sourceStart(), n.sourceEnd(), RutaPreferenceConstants.EDITOR_DECLARATION_DEFINITION_COLOR);
+ }
+ }
+
+ requestor.addPosition(t.getNameStart(), t.getNameEnd(), RutaPreferenceConstants.EDITOR_VARIABLE_COLOR);
+ }
+
+ return null;
+
+ }
+
+ public void processNode(ASTNode node, ISemanticHighlightingRequestor requestor) {
+ calculatePositions(node, requestor);
+
+ }
+
+ public SemanticHighlighting[] getHighlightings() {
+ return highlightings;
+ }
+
+ public void doOtherHighlighting(ISourceModule code,
+ final ISemanticHighlightingRequestor semanticHighlightingRequestor) {
+ ModuleDeclaration moduleDeclaration = SourceParserUtil
+ .getModuleDeclaration((org.eclipse.dltk.core.ISourceModule) (code.getModelElement()));
+ if (moduleDeclaration instanceof RutaModuleDeclaration) {
+ RutaModuleDeclaration md = (RutaModuleDeclaration) moduleDeclaration;
+ if (md != null) {
+
+ // do highlightings
+
+ }
+ }
+ }
+}
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ExplainPerspective.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ExplainPerspective.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ExplainPerspective.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ExplainPerspective.java Mon Apr 29 14:50:56 2013
@@ -17,11 +17,11 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui;
+package org.apache.uima.ruta.ide.ui;
-import org.apache.uima.textmarker.ide.ui.wizards.TextMarkerFileCreationWizard;
-import org.apache.uima.textmarker.ide.ui.wizards.TextMarkerPackageCreationWizard;
-import org.apache.uima.textmarker.ide.ui.wizards.TextMarkerProjectCreationWizard;
+import org.apache.uima.ruta.ide.ui.wizards.RutaFileCreationWizard;
+import org.apache.uima.ruta.ide.ui.wizards.RutaPackageCreationWizard;
+import org.apache.uima.ruta.ide.ui.wizards.RutaProjectCreationWizard;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
@@ -30,25 +30,25 @@ import org.eclipse.ui.progress.IProgress
public class ExplainPerspective implements IPerspectiveFactory {
- public static final String FAILED_RULES = "org.apache.uima.textmarker.explain.failed";
+ public static final String FAILED_RULES = "org.apache.uima.ruta.explain.failed";
- public static final String MATCHED_RULES = "org.apache.uima.textmarker.explain.matched";
+ public static final String MATCHED_RULES = "org.apache.uima.ruta.explain.matched";
- public static final String RULE_ELEMENTS = "org.apache.uima.textmarker.explain.element";
+ public static final String RULE_ELEMENTS = "org.apache.uima.ruta.explain.element";
- public static final String APPLIED_RULES = "org.apache.uima.textmarker.explain.apply";
+ public static final String APPLIED_RULES = "org.apache.uima.ruta.explain.apply";
- public static final String SELECTION_RULES = "org.apache.uima.textmarker.explain.selection";
+ public static final String SELECTION_RULES = "org.apache.uima.ruta.explain.selection";
- public static final String RULE_LIST = "org.apache.uima.textmarker.explain.rulelist";
+ public static final String RULE_LIST = "org.apache.uima.ruta.explain.rulelist";
- public static final String CREATED_BY = "org.apache.uima.textmarker.explain.createdBy";
+ public static final String CREATED_BY = "org.apache.uima.ruta.explain.createdBy";
public static final String TYPE_BROWSER = "org.apache.uima.caseditor.browser";
public static final String SELECTION_VIEW = "org.apache.uima.caseditor.selection";
- public static final String QUERY = "org.apache.uima.textmarker.query.ui.ScriptQueryView";
+ public static final String QUERY = "org.apache.uima.ruta.query.ui.ScriptQueryView";
public static final String SCRIPT_EXPLORER = "org.eclipse.dltk.ui.ScriptExplorer";
@@ -58,16 +58,16 @@ public class ExplainPerspective implemen
public static final String NEW_UNTITLED_TEXT_FILE_WIZARD = "org.eclipse.ui.editors.wizards.UntitledTextFileWizard"; //$NON-NLS-1$
- public static final String ID_NEW_SOURCE_WIZARD = "org.apache.uima.textmarker.ide.ui.wizards.NewSourceFolderCreationWizard";
+ public static final String ID_NEW_SOURCE_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.NewSourceFolderCreationWizard";
- public static final String ID_NEW_PACKAGE_WIZARD = "org.apache.uima.textmarker.ide.ui.wizards.NewPackageCreationWizard";
+ public static final String ID_NEW_PACKAGE_WIZARD = "org.apache.uima.ruta.ide.ui.wizards.NewPackageCreationWizard";
protected void addNewWizardShortcuts(IPageLayout layout) {
- layout.addNewWizardShortcut(TextMarkerProjectCreationWizard.ID_WIZARD);
- layout.addNewWizardShortcut(TextMarkerFileCreationWizard.ID_WIZARD);
+ layout.addNewWizardShortcut(RutaProjectCreationWizard.ID_WIZARD);
+ layout.addNewWizardShortcut(RutaFileCreationWizard.ID_WIZARD);
layout.addNewWizardShortcut(ID_NEW_SOURCE_WIZARD);
- layout.addNewWizardShortcut(TextMarkerPackageCreationWizard.ID_WIZARD);
+ layout.addNewWizardShortcut(RutaPackageCreationWizard.ID_WIZARD);
layout.addNewWizardShortcut(NEW_FOLDER_WIZARD);
layout.addNewWizardShortcut(NEW_FILE_WIZARD);
@@ -121,7 +121,7 @@ public class ExplainPerspective implemen
}
protected void addPerspectiveShotcuts(IPageLayout layout) {
- layout.addPerspectiveShortcut("org.apache.uima.textmarker.ide.ui.TextMarkerPerspective");
+ layout.addPerspectiveShortcut("org.apache.uima.ruta.ide.ui.RutaPerspective");
}
public void createInitialLayout(IPageLayout layout) {
Modified: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ISemanticHighlightingExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ISemanticHighlightingExtension.java?rev=1477113&r1=1477112&r2=1477113&view=diff
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ISemanticHighlightingExtension.java (original)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/ISemanticHighlightingExtension.java Mon Apr 29 14:50:56 2013
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.textmarker.ide.ui;
+package org.apache.uima.ruta.ide.ui;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ui.editor.highlighting.ISemanticHighlightingRequestor;
Added: uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaImages.java
URL: http://svn.apache.org/viewvc/uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaImages.java?rev=1477113&view=auto
==============================================================================
--- uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaImages.java (added)
+++ uima/sandbox/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/ui/RutaImages.java Mon Apr 29 14:50:56 2013
@@ -0,0 +1,38 @@
+/*
+ * 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.ui;
+
+import org.apache.uima.ruta.ide.RutaIdePlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.dltk.ui.PluginImagesHelper;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+public class RutaImages {
+ private static final PluginImagesHelper helper = new PluginImagesHelper(RutaIdePlugin
+ .getDefault().getBundle(), new Path("/icons"));
+
+ public static final ImageDescriptor PROJECT_DECARATOR = helper.createUnManaged("", "tm_ovr.gif");
+
+ public static final ImageDescriptor DESC_WIZBAN_PROJECT_CREATION = helper.createUnManaged("",
+ "projectcreate_wiz.png");
+
+ public static final ImageDescriptor DESC_WIZBAN_FILE_CREATION = helper.createUnManaged("",
+ "filecreate_wiz.png");
+}