svn commit: r1359228 - in /uima/sandbox/trunk/TextMarker: uimaj-ep-textmarker-caseditor/ uimaj-ep-textmarker-engine/ uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/

2012-07-09 Thread pkluegl
Author: pkluegl
Date: Mon Jul  9 15:45:31 2012
New Revision: 1359228

URL: http://svn.apache.org/viewvc?rev=1359228&view=rev
Log:
UIMA-2331
- enabled matching on string literals, also for disjunctive expressions

Added:

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerDisjunctiveMatcher.java
  - copied, changed from r1357559, 
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerDisjunctiveTypeMatcher.java

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/LiteralStringMatchTest.java

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LiteralStringMatchTest.tm

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/resources/org/apache/uima/textmarker/LiteralStringMatchTest.txt
Removed:

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerDisjunctiveTypeMatcher.java
Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/   (props 
changed)
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/   (props changed)

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-textruler/   (props 
changed)

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/antlr3/org/apache/uima/textmarker/parser/TextMarkerParser.g

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerScriptFactory.java

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/rule/TextMarkerLiteralMatcher.java

uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/
--
--- svn:ignore (added)
+++ svn:ignore Mon Jul  9 15:45:31 2012
@@ -0,0 +1,4 @@
+.settings
+.classpath
+.project
+META-INF

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/
--
--- svn:ignore (added)
+++ svn:ignore Mon Jul  9 15:45:31 2012
@@ -0,0 +1,5 @@
+.settings
+target
+.classpath
+.project
+META-INF

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g?rev=1359228&r1=1359227&r2=1359228&view=diff
==
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g
 Mon Jul  9 15:45:31 2012
@@ -592,9 +592,14 @@ ruleElementComposed returns [ComposedRul
:
LPAREN
 
-   ((ruleElementType VBAR)=> re1 = ruleElementType {disjunctive = true; 
res = new ArrayList(); res.add(re1);} 
-   VBAR re2 = ruleElementType {res.add(re2);}
-   (VBAR re3 = ruleElementType {res.add(re3);})*
+   (((ruleElementType | ruleElementLiteral) VBAR)=>  (re11 
=ruleElementType| re12 = ruleElementLiteral) 
+   {disjunctive = true; res = new ArrayList(); if(re11!=null) 
res.add(re11);if(re12!=null) res.add(re12);} 
+   VBAR (re21 = ruleElementType| re22 = ruleElementLiteral) 
+   { if(re21!=null) res.add(re21);if(re22!=null) res.add(re22);}
+   (
+   VBAR (re31 = ruleElementType| re32 = ruleElementLiteral) 
+   { if(re31!=null) res.add(re31);if(re32!=null) res.add(re32);}
+   )*
 |(ruleElements)=>res = ruleElements)

RPAREN q = quantifierPart? (LCURLY c = conditions? (THEN a = actions)? 
RCURLY)?

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textm

svn commit: r1359133 - in /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons: ./ src/main/java/org/apache/uima/textmarker/utils/apply/AbstractApplyScriptHandlerJob.java

2012-07-09 Thread pkluegl
Author: pkluegl
Date: Mon Jul  9 13:04:49 2012
New Revision: 1359133

URL: http://svn.apache.org/viewvc?rev=1359133&view=rev
Log:
UIMA-2359
- replaced method for loading text files

Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/   (props changed)

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/utils/apply/AbstractApplyScriptHandlerJob.java

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/
--
--- svn:ignore (added)
+++ svn:ignore Mon Jul  9 13:04:49 2012
@@ -0,0 +1,4 @@
+.settings
+.classpath
+.project
+META-INF

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/utils/apply/AbstractApplyScriptHandlerJob.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/utils/apply/AbstractApplyScriptHandlerJob.java?rev=1359133&r1=1359132&r2=1359133&view=diff
==
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/utils/apply/AbstractApplyScriptHandlerJob.java
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/utils/apply/AbstractApplyScriptHandlerJob.java
 Mon Jul  9 13:04:49 2012
@@ -37,6 +37,7 @@ import org.apache.uima.resource.Resource
 import org.apache.uima.textmarker.engine.TextMarkerEngine;
 import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
 import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
+import org.apache.uima.util.FileUtils;
 import org.apache.uima.util.XMLInputSource;
 import org.apache.uima.util.XMLSerializer;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -225,7 +226,7 @@ public abstract class AbstractApplyScrip
 
   private static String getText(String each) {
 try {
-  return org.apache.uima.pear.util.FileUtil.loadTextFile(new File(each), 
"UTF-8");
+  return FileUtils.file2String(new File(each), "UTF-8");
 } catch (IOException e) {
   DLTKCore.error(e.getMessage(), e);
 }




svn commit: r1359125 - /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java

2012-07-09 Thread pkluegl
Author: pkluegl
Date: Mon Jul  9 12:53:29 2012
New Revision: 1359125

URL: http://svn.apache.org/viewvc?rev=1359125&view=rev
Log:
UIMA-2428
- ignoring "-" prefix for conditions when validating their names

Modified:

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java?rev=1359125&r1=1359124&r2=1359125&view=diff
==
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java
 Mon Jul  9 12:53:29 2012
@@ -202,16 +202,15 @@ public class TextMarkerVarRefChecker imp
   // check assign types
   if (s instanceof TextMarkerAction) {
 TextMarkerAction tma = (TextMarkerAction) s;
-
-String actionName = 
currentFile.getSource().substring(tma.getNameStart(),
-tma.getNameEnd());
+
+String actionName = 
currentFile.getSource().substring(tma.getNameStart(), tma.getNameEnd());
 String[] keywords = 
TextMarkerKeywordsManager.getKeywords(ITextMarkerKeywords.ACTION);
 List asList = Arrays.asList(keywords);
-if(!"".equals(actionName) && !asList.contains(actionName)) {
+if (!"".equals(actionName) && !"-".equals(actionName) && 
!asList.contains(actionName)) {
   IProblem problem = problemFactory.createUnknownActionProblem(tma);
   rep.reportProblem(problem);
 }
-
+
 if (tma.getKind() == TMActionConstants.A_ASSIGN) {
   List childs = tma.getChilds();
   try {
@@ -236,8 +235,7 @@ public class TextMarkerVarRefChecker imp
   Expression struct = sa.getStructure();
   String structure = null;
   if (struct != null) {
-structure = currentFile.getSource().substring(struct.sourceStart(),
-struct.sourceEnd());
+structure = 
currentFile.getSource().substring(struct.sourceStart(), struct.sourceEnd());
   }
   Map assignments = sa.getAssignments();
   // hotfix... correct name in ast
@@ -263,11 +261,12 @@ public class TextMarkerVarRefChecker imp
 cond.getNameEnd());
 String[] keywords = 
TextMarkerKeywordsManager.getKeywords(ITextMarkerKeywords.CONDITION);
 List asList = Arrays.asList(keywords);
-if(!"".equals(conditionName) && !asList.contains(conditionName)) {
+if (!"".equals(conditionName) && !"-".equals(conditionName)
+&& !asList.contains(conditionName)) {
   IProblem problem = 
problemFactory.createUnknownConditionProblem(cond);
   rep.reportProblem(problem);
 }
-
+
 if (conditionName.equals("FEATURE")) {
   if (matchedType != null) {
 List args = cond.getChilds();




svn commit: r1359109 - in /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide: ./ src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/ src/main/java/org/apache/uima/textmarker/ide/core/codea

2012-07-09 Thread pkluegl
Author: pkluegl
Date: Mon Jul  9 12:30:22 2012
New Revision: 1359109

URL: http://svn.apache.org/viewvc?rev=1359109&view=rev
Log:
UIMA-2428
- added dummy ast elements for context identification
- added checker for condition and action names
- added parentheses when completing conditions and actions

Added:

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.g

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.tokens

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.tokens
Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/   (props changed)

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.g

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerCompletionEngine.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerReferenceVisitor.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ActionFactory.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ConditionFactory.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ExpressionFactory.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerCheckerProblemFactory.java

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerVarRefChecker.java

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/
--
--- svn:ignore (added)
+++ svn:ignore Mon Jul  9 12:30:22 2012
@@ -0,0 +1,5 @@
+.settings
+target
+.classpath
+.project
+META-INF

Added: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.g
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.g?rev=1359109&view=auto
==
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.g
 (added)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.g
 Mon Jul  9 12:30:22 2012
@@ -0,0 +1,519 @@
+lexer grammar TextMarkerLexer;
+options {
+   language = Java;
+}
+
+
+tokens {
+   DocComment;
+   Annotation;
+   ListIdentifier;
+}
+
+@lexer::header {
+/*
+ * 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.textmarker.ide.core.parser;
+}
+
+@lexer::members {
+   public int implicitLineJoiningLevel = 0;
+   public int startPos=-1;
+   public void emitErrorMessage(String msg) {
+   }
+}
+
+
+TRIE
+   :   'TRIE'
+   ;
+
+CONTAINS
+   :   'CONTAINS'
+   ;
+
+DECLARE
+   :   'DECLARE'
+   ;
+
+WORDLIST
+   :   'WORDLIST'
+   ;
+
+WORDTABLE
+   :   'WORDTABLE'
+   ;
+
+AND
+   :   'AND'
+   ;
+
+CONTEXTCOUNT
+   :   'CONTEXTCOUNT'
+   ;
+
+COUNT
+   :   'COUNT'
+   ;
+
+TOTALCOUNT
+   :   'TOTALCOUNT'
+   ;
+
+CURRENTCOUNT
+   :   'CURRENTCOUNT'
+   ;
+
+INLIST
+   :   'INLIST'
+   ;
+
+
+LAST
+   :   'LAST'
+   ;
+
+MOFN
+   :   'MOFN'
+   ;
+
+NEAR
+   :   'NEAR'
+   ;
+
+OR
+