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 2012/07/09 14:30:23 UTC

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/codeassist/ src/main/java/org/apache/uima/textmarker/ide/...

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
+	:	'OR'
+	;
+
+PARTOF
+	:	'PARTOF'
+	;
+	
+PARTOFNEQ
+	:	'PARTOFNEQ'
+	;
+
+POSITION
+	:	'POSITION'
+	;
+
+REGEXP
+	:	'REGEXP'
+	;
+
+SCORE
+	:	'SCORE'
+	;
+
+VOTE
+	:	'VOTE'
+	;
+
+IF
+	:	'IF'
+	;
+
+FEATURE
+	:	'FEATURE'
+	;
+
+PARSE
+	:	'PARSE'
+	;
+
+CREATE
+	:	'CREATE'
+	;
+
+GATHER
+	:	'GATHER'
+	;
+
+FILL
+	:	'FILL'
+	;
+
+ATTRIBUTE
+	:	'ATTRIBUTE'
+	;
+
+COLOR
+	:	'COLOR'
+	;
+
+DEL
+	:	'DEL'
+	;
+
+LOG
+	:	'LOG'
+	;
+
+MARK
+	:	'MARK'
+	;
+
+MARKSCORE
+	:	'MARKSCORE'
+	;
+
+MARKONCE
+	:	'MARKONCE'
+	;
+
+MARKFAST
+	:	'MARKFAST'
+	;
+	
+MARKTABLE
+	:	'MARKTABLE'
+	;
+	
+MARKLAST
+	:	'MARKLAST'
+	;
+
+REPLACE
+	:	'REPLACE'
+	;
+
+RETAINTYPE
+	:	'RETAINTYPE'
+	;
+
+FILTERTYPE
+	:	'FILTERTYPE'
+	;
+
+CALL
+	:	'CALL'
+	;
+
+
+EXEC
+	:	'EXEC'
+	;
+
+CONFIGURE
+	:	'CONFIGURE'
+	;
+
+ASSIGN
+	:	'ASSIGN'
+	;
+
+SETFEATURE
+	:	'SETFEATURE'
+	;
+
+GETFEATURE
+	:	'GETFEATURE'
+	;
+
+UNMARK
+	:	'UNMARK'
+	;
+
+UNMARKALL
+	:	'UNMARKALL'
+	;
+
+TRANSFER
+	:	'TRANSFER'
+	;
+
+
+EXPAND 	
+	:	'EXPAND'	 
+	;
+
+DYNAMICANCHORING 	
+	:	'DYNAMICANCHORING'	 
+	;
+
+BEFORE
+	:	'BEFORE'
+	;
+
+AFTER
+	:	'AFTER'
+	;
+
+IS 	
+	:	'IS'	 
+	;
+
+
+STARTSWITH 	
+	:	'STARTSWITH'	 
+	;
+
+ENDSWITH 	
+	:	'ENDSWITH'	 
+	;
+
+
+
+NOT
+	:	'NOT'
+	;
+
+ADD	:	'ADD';
+REMOVE	:	'REMOVE';
+REMOVEDUPLICATE	:	'REMOVEDUPLICATE';
+MERGE 	:	'MERGE';
+GET	:	'GET';
+GETLIST	:	'GETLIST';
+SIZE	:	'SIZE';
+MATCHEDTEXT	:	'MATCHEDTEXT';
+REMOVESTRING	:	'REMOVESTRING';
+CLEAR 	:	 'CLEAR';
+
+THEN 
+	: 	'->'
+	;
+
+BasicAnnotationType 
+	: 'COLON'| 'SW' | 'MARKUP' | 'PERIOD' | 'CW'| 'NUM' | 'QUESTION' | 'SPECIAL' | 'CAP' | 'COMMA' | 'EXCLAMATION' | 'SEMICOLON' | 'NBSP'| 'AMP' |
+	'_' | 'SENTENCEEND' | 'W' | 'PM' | 'ANY' | 'ALL' | 'SPACE' | 'BREAK' 
+	;
+	
+LogLevel:
+	'finest' | 'finer' | 'fine' | 'config' | 'info' | 'warning' | 'severe'
+	;	
+
+OldColor 
+	: 'black' | 'maroon' | 'green' | 'olive' | 'navy' | 'purple' | 'teal' | 'gray' | 'silver' | 'red' | 'lime' | 'yellow' | 'blue' | 'fuchsia' | 'aqua'
+	;
+
+PackageString   :	'PACKAGE';
+ScriptString	:	'SCRIPT';
+EngineString	:	'ENGINE';
+BlockString 	:	'BLOCK';
+AutomataBlockString 	:	'RULES';
+TypeString 	:	'TYPE';
+IntString	:	'INT';
+DoubleString	:	'DOUBLE';
+FloatString	:	'FLOAT';
+StringString	:	'STRING';
+BooleanString	:	'BOOLEAN';
+TypeSystemString:	'TYPESYSTEM';	
+SymbolString	:	'SYMBOL';
+CONDITION	:	'CONDITION';	
+ACTION		:	'ACTION';
+BOOLEANLIST 
+	:	 'BOOLEANLIST';
+INTLIST :	'INTLIST';
+DOUBLELIST
+	:	 'DOUBLELIST';
+FLOATLIST
+	:	 'FLOATLIST';
+STRINGLIST
+	:	'STRINGLIST';	
+TYPELIST:	'TYPELIST';
+
+
+
+EXP 	:	'EXP';
+LOGN	:	'LOGN';
+SIN	:	'SIN';
+COS	:	'COS';
+TAN	:	'TAN';
+XOR	: 	'XOR';
+TRUE 	:	'true';
+FALSE 	:	'false';
+
+HexLiteral : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
+
+DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
+
+OctalLiteral : '0' ('0'..'7')+ IntegerTypeSuffix? ;
+
+fragment
+HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
+
+fragment
+IntegerTypeSuffix : ('l'|'L') ;
+
+FloatingPointLiteral
+    :   ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
+    |   '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
+    //|   ('0'..'9')+ Exponent FloatTypeSuffix?
+    //|   ('0'..'9')+ Exponent? FloatTypeSuffix
+	;
+	
+fragment
+Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
+
+fragment
+FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
+
+CharacterLiteral
+    :   '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
+    ;
+
+StringLiteral
+    :  '"' ( EscapeSequence | ~('\\'|'"') )* '"'
+    ;
+
+RessourceLiteral
+    :  '\'' ( EscapeSequence | ~('\\'|'\'') )* '\''
+    ;
+
+fragment
+EscapeSequence
+    :   '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
+    |   UnicodeEscape
+    |   OctalEscape
+    ;
+
+fragment
+OctalEscape
+    :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
+    |   '\\' ('0'..'7') ('0'..'7')
+    |   '\\' ('0'..'7')
+    ;
+
+fragment
+UnicodeEscape
+    :   '\\' 'u' HexDigit HexDigit HexDigit HexDigit
+    ;
+
+	
+Identifier 
+    :   Letter (Letter|JavaIDDigit)*
+    ;
+
+
+fragment
+Letter
+    :  '\u0024' |
+       '\u0041'..'\u005a' |
+       '\u005f' |
+       '\u0061'..'\u007a' |
+       '\u00c0'..'\u00d6' |
+       '\u00d8'..'\u00f6' |
+       '\u00f8'..'\u00ff' |
+       '\u0100'..'\u1fff' |
+       '\u3040'..'\u318f' |
+       '\u3300'..'\u337f' |
+       '\u3400'..'\u3d2d' |
+       '\u4e00'..'\u9fff' |
+       '\uf900'..'\ufaff'
+    ;
+
+fragment
+JavaIDDigit
+    :  '\u0030'..'\u0039' |
+       '\u0660'..'\u0669' |
+       '\u06f0'..'\u06f9' |
+       '\u0966'..'\u096f' |
+       '\u09e6'..'\u09ef' |
+       '\u0a66'..'\u0a6f' |
+       '\u0ae6'..'\u0aef' |
+       '\u0b66'..'\u0b6f' |
+       '\u0be7'..'\u0bef' |
+       '\u0c66'..'\u0c6f' |
+       '\u0ce6'..'\u0cef' |
+       '\u0d66'..'\u0d6f' |
+       '\u0e50'..'\u0e59' |
+       '\u0ed0'..'\u0ed9' |
+       '\u1040'..'\u1049'
+   ;
+
+
+
+LPAREN	: '(' {implicitLineJoiningLevel++;} ;
+
+RPAREN	: ')' {implicitLineJoiningLevel--;} ;
+
+LBRACK	: '[' {implicitLineJoiningLevel++;} ;
+
+RBRACK	: ']' {implicitLineJoiningLevel--;} ;
+
+LCURLY	: '{' {implicitLineJoiningLevel++;} ;
+
+RCURLY	: '}' {implicitLineJoiningLevel--;} ;
+
+CIRCUMFLEX	: '^' ;
+
+AT : '@' ;
+
+DOT : '.' ;
+
+COLON 	: ':' ;
+
+COMMA	: ',' ;
+
+SEMI	: ';' ;
+
+PLUS	: '+' ;
+
+MINUS	: '-' ;
+
+STAR	: '*' ;
+
+SLASH	: '/' ;
+
+VBAR	: '|' ;
+
+AMPER	: '&' ;
+
+LESS	: '<' ;
+
+GREATER	: '>' ;
+
+ASSIGN_EQUAL	: '=' ;
+
+PERCENT	: '%' ;
+
+QUESTION	: '?' ;
+
+EQUAL	: '==' ;
+
+NOTEQUAL	: '!=' ;
+
+ALT_NOTEQUAL: '<>' ;
+
+LESSEQUAL	: '<=' ;
+
+
+GREATEREQUAL	: '>=' ;
+
+WS  :  (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
+    ;
+
+
+
+
+
+
+
+COMMENT
+    :   '/*'{if (input.LA(1)=='*') $type=DocComment; else $channel=HIDDEN;} ( options {greedy=false;} : . )* '*/' 
+    ;
+
+LINE_COMMENT
+    : '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
+    ;
+
+
+
+    

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.tokens
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.tokens?rev=1359109&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.tokens (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerLexer.tokens Mon Jul  9 12:30:22 2012
@@ -0,0 +1,151 @@
+STAR=138
+FloatTypeSuffix=113
+OctalLiteral=111
+LOG=37
+CONTAINS=8
+REMOVE=65
+GREATEREQUAL=151
+MARKFAST=41
+MATCHEDTEXT=71
+CONDITION=91
+COUNT=14
+LOGN=100
+DYNAMICANCHORING=57
+NOT=63
+Identifier=123
+ACTION=92
+NOTEQUAL=148
+CLEAR=73
+VBAR=140
+DOUBLELIST=95
+ENDSWITH=62
+RPAREN=125
+CREATE=31
+GREATER=143
+SIN=101
+EXP=99
+CURRENTCOUNT=16
+COS=102
+TAN=103
+TYPELIST=98
+FloatString=86
+LESS=142
+REGEXP=25
+GET=68
+PARTOF=22
+UNMARK=53
+LAST=18
+COMMENT=153
+REMOVEDUPLICATE=66
+UNMARKALL=54
+RBRACK=127
+NEAR=20
+LINE_COMMENT=154
+IntegerTypeSuffix=108
+MARKSCORE=39
+REMOVESTRING=72
+TRANSFER=55
+LCURLY=128
+TRIE=7
+FILTERTYPE=46
+STRINGLIST=97
+MARKONCE=40
+ScriptString=79
+EngineString=80
+WS=152
+WORDTABLE=11
+WORDLIST=10
+AutomataBlockString=82
+FloatingPointLiteral=114
+INTLIST=94
+OR=21
+JavaIDDigit=122
+FLOATLIST=96
+CALL=47
+Annotation=5
+FALSE=106
+LESSEQUAL=150
+RessourceLiteral=118
+VOTE=27
+Letter=121
+EscapeSequence=115
+SIZE=70
+BasicAnnotationType=75
+LBRACK=126
+CharacterLiteral=116
+DEL=36
+ATTRIBUTE=34
+TypeString=83
+Exponent=112
+ASSIGN_EQUAL=144
+RETAINTYPE=45
+AND=12
+TypeSystemString=89
+EXPAND=56
+BlockString=81
+IntString=84
+HexDigit=107
+COLOR=35
+LPAREN=124
+POSITION=24
+IF=28
+AT=131
+LogLevel=76
+CONFIGURE=49
+SLASH=139
+THEN=74
+FILL=33
+COMMA=134
+IS=60
+AMPER=141
+REPLACE=44
+GETLIST=69
+EQUAL=147
+GATHER=32
+INLIST=17
+PLUS=136
+BooleanString=88
+GETFEATURE=52
+DOT=132
+ListIdentifier=6
+PARTOFNEQ=23
+BOOLEANLIST=93
+ADD=64
+MARKTABLE=42
+HexLiteral=109
+XOR=104
+PERCENT=145
+MARK=38
+PARSE=30
+PackageString=78
+OldColor=77
+MARKLAST=43
+MERGE=67
+CONTEXTCOUNT=13
+BEFORE=58
+EXEC=48
+MINUS=137
+AFTER=59
+DecimalLiteral=110
+SEMI=135
+TRUE=105
+FEATURE=29
+SymbolString=90
+COLON=133
+StringLiteral=117
+StringString=87
+SCORE=26
+QUESTION=146
+UnicodeEscape=119
+RCURLY=129
+STARTSWITH=61
+ASSIGN=50
+TOTALCOUNT=15
+DECLARE=9
+DocComment=4
+MOFN=19
+OctalEscape=120
+SETFEATURE=51
+DoubleString=85
+CIRCUMFLEX=130
+ALT_NOTEQUAL=149

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=1359109&r1=1359108&r2=1359109&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 12:30:22 2012
@@ -602,9 +602,23 @@ ruleElementComposed returns [ComposedRul
 	;
 
 ruleElementType returns [TextMarkerRuleElement re = null] 
-    :
+@init{
+List<TextMarkerCondition> dummyConds = new ArrayList<TextMarkerCondition>();
+}
+  :
     (typeExpression)=>idRef=typeExpression quantifier = quantifierPart? 
-        (LCURLY c = conditions? (THEN a = actions)? end = RCURLY)?
+        (LCURLY 
+        {
+        
+        dummyConds.add(ConditionFactory.createEmptyCondition(input.LT(1)));
+        } 
+        c = conditions? 
+        {
+        if(c==null) {
+        	c = dummyConds;
+        }
+        }
+        (THEN a = actions)? end = RCURLY)?
         {
         // TODO handle quantifierPart.
         re = ScriptFactory.createRuleElement(idRef,quantifier,c,a,end);}
@@ -614,7 +628,11 @@ ruleElementType returns [TextMarkerRuleE
 ruleElementLiteral returns [TextMarkerRuleElement re = null] 
     :
     (simpleStringExpression)=>idRef=simpleStringExpression quantifier = quantifierPart? 
-        (LCURLY c = conditions? (THEN a = actions)? end = RCURLY)?
+        (LCURLY 
+
+        c = conditions? 
+        (THEN a = actions)? 
+        end = RCURLY)?
         {
         // TODO handle quantifierPart.
         re = ScriptFactory.createRuleElement(idRef,quantifier,c,a,end);}
@@ -622,8 +640,11 @@ ruleElementLiteral returns [TextMarkerRu
     ;
     
 conditions returns [List<TextMarkerCondition> conds = new ArrayList<TextMarkerCondition>()]
+@init {
+conds.add(ConditionFactory.createEmptyCondition(input.LT(1)));
+}
     :
-    c = condition {conds.add(c);} (COMMA c = condition {conds.add(c);} )*
+    c = condition {conds.remove(0);conds.add(c);} (COMMA c = condition {conds.add(c);} )*
     ;
 
   
@@ -760,6 +781,9 @@ simpleTypeListExpression returns [Expres
 	;	
 	
 typeExpression returns [Expression expr = null]
+@init {
+expr = ExpressionFactory.createEmptyTypeExpression(input.LT(1));
+}
 	:
 	tf = typeFunction {expr = tf;}
 	| st = simpleTypeExpression 
@@ -823,6 +847,9 @@ quantifierPart returns [List<Expression>
 	
 	
 condition returns [TextMarkerCondition result = null]
+@init {
+result = ConditionFactory.createEmptyCondition(input.LT(1));
+}
 	:
 	(
 	c = conditionAnd
@@ -853,20 +880,20 @@ condition returns [TextMarkerCondition r
 	| c = conditionPartOfNeq
 	| c = conditionSize
 	| (c = externalCondition)=> c = externalCondition
-	//| c = variableCondition
+	| c = variableCondition
 	) {result = c;}
 	;
 	
 //TODO added rule
-//variableCondition returns [TextMarkerCondition condition = null]
-//	:		
-//	// also create condition for auto-completion
-//	//{isVariableOfType(input.LT(1).getText(), "CONDITION")}? 
-//	id = Identifier
-//	{
-//		condition = ConditionFactory.createCondition(id);
-//	}
-//	;	
+variableCondition returns [TextMarkerCondition condition = null]
+	:		
+	// also create condition for auto-completion
+	//{isVariableOfType(input.LT(1).getText(), "CONDITION")}? 
+	id = Identifier
+	{
+		condition = ConditionFactory.createCondition(id);
+	}
+	;	
 	
 	
 externalCondition returns [TextMarkerCondition condition = null]
@@ -1109,6 +1136,9 @@ conditionSize returns [TextMarkerConditi
 
 	
 action returns [TextMarkerAction result = null]
+@init {
+result = ActionFactory.createEmptyAction(input.LT(1));
+}
 	:
 	(
 	a = actionColor
@@ -1147,20 +1177,20 @@ action returns [TextMarkerAction result 
 	| a = actionConfigure
 	| a = actionDynamicAnchoring
 	| (a = externalAction)=> a = externalAction
-	//| a = variableAction
+	| a = variableAction
 	) {result = a;}
 	;
 
 
-//variableAction returns [TextMarkerAction action = null]
-//	:
-//	// also create an dummy action for auto-completion
-//	//{isVariableOfType(input.LT(1).getText(), "ACTION")}?
-//	 id = Identifier
-//	{
-//		action = ActionFactory.createAction(id);
-//	}
-//	;
+variableAction returns [TextMarkerAction action = null]
+	:
+	// also create an dummy action for auto-completion
+	//{isVariableOfType(input.LT(1).getText(), "ACTION")}?
+	 id = Identifier
+	{
+		action = ActionFactory.createAction(id);
+	}
+	;
 	
 externalAction returns [TextMarkerAction action = null]
 	:
@@ -1777,6 +1807,9 @@ wordTableExpression returns [Expression 
 
 //seems OK
 numberExpression returns [Expression expr = null]
+@init {
+expr = ExpressionFactory.createEmptyNumberExpression(input.LT(1));
+}
 	:
 	e = additiveExpression
 	{if(e!=null) expr = ExpressionFactory.createNumberExpression(e);}
@@ -1853,8 +1886,12 @@ numberVariable returns [Expression expr 
 	
 //OK - interface to flag stringExpressions?
 stringExpression returns [Expression expr = null]
-@init {List<Expression> exprList = new ArrayList<Expression>();}
+@init {
+List<Expression> exprList = new ArrayList<Expression>();
+{expr = ExpressionFactory.createEmptyStringExpression(input.LT(1));}
+}
 	:
+	
 	e = stringFunction {expr = e;} 
 	|
 	strExpr1 = simpleStringExpression {if (strExpr1!=null) exprList.add(strExpr1);}
@@ -1906,6 +1943,9 @@ simpleStringExpression returns [Expressi
 
 //OK - interface to flag booleanExpressions?
 booleanExpression returns [Expression expr = null]
+@init{
+expr = ExpressionFactory.createEmptyBooleanExpression(input.LT(1));
+}
 	:
 	bcE = composedBooleanExpression {expr = bcE;}
 	| sbE = simpleBooleanExpression {expr = sbE;}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.tokens
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.tokens?rev=1359109&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.tokens (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/antlr3/org/apache/uima/textmarker/ide/core/parser/TextMarkerParser.tokens Mon Jul  9 12:30:22 2012
@@ -0,0 +1,151 @@
+STAR=138
+FloatTypeSuffix=113
+OctalLiteral=111
+LOG=37
+CONTAINS=8
+REMOVE=65
+GREATEREQUAL=151
+MARKFAST=41
+MATCHEDTEXT=71
+CONDITION=91
+COUNT=14
+LOGN=100
+DYNAMICANCHORING=57
+NOT=63
+Identifier=123
+ACTION=92
+NOTEQUAL=148
+CLEAR=73
+VBAR=140
+DOUBLELIST=95
+ENDSWITH=62
+RPAREN=125
+CREATE=31
+GREATER=143
+SIN=101
+EXP=99
+CURRENTCOUNT=16
+COS=102
+TAN=103
+TYPELIST=98
+FloatString=86
+LESS=142
+REGEXP=25
+GET=68
+PARTOF=22
+UNMARK=53
+LAST=18
+COMMENT=153
+REMOVEDUPLICATE=66
+UNMARKALL=54
+RBRACK=127
+NEAR=20
+LINE_COMMENT=154
+IntegerTypeSuffix=108
+MARKSCORE=39
+REMOVESTRING=72
+TRANSFER=55
+LCURLY=128
+TRIE=7
+FILTERTYPE=46
+STRINGLIST=97
+MARKONCE=40
+ScriptString=79
+EngineString=80
+WS=152
+WORDTABLE=11
+WORDLIST=10
+AutomataBlockString=82
+FloatingPointLiteral=114
+INTLIST=94
+OR=21
+JavaIDDigit=122
+FLOATLIST=96
+CALL=47
+Annotation=5
+FALSE=106
+LESSEQUAL=150
+RessourceLiteral=118
+VOTE=27
+Letter=121
+EscapeSequence=115
+SIZE=70
+BasicAnnotationType=75
+LBRACK=126
+CharacterLiteral=116
+DEL=36
+ATTRIBUTE=34
+TypeString=83
+Exponent=112
+ASSIGN_EQUAL=144
+RETAINTYPE=45
+AND=12
+TypeSystemString=89
+EXPAND=56
+BlockString=81
+IntString=84
+HexDigit=107
+COLOR=35
+LPAREN=124
+POSITION=24
+IF=28
+AT=131
+LogLevel=76
+CONFIGURE=49
+SLASH=139
+THEN=74
+FILL=33
+COMMA=134
+IS=60
+AMPER=141
+REPLACE=44
+GETLIST=69
+EQUAL=147
+GATHER=32
+INLIST=17
+PLUS=136
+BooleanString=88
+GETFEATURE=52
+DOT=132
+ListIdentifier=6
+PARTOFNEQ=23
+BOOLEANLIST=93
+ADD=64
+MARKTABLE=42
+HexLiteral=109
+XOR=104
+PERCENT=145
+MARK=38
+PARSE=30
+PackageString=78
+OldColor=77
+MARKLAST=43
+MERGE=67
+CONTEXTCOUNT=13
+BEFORE=58
+EXEC=48
+MINUS=137
+AFTER=59
+DecimalLiteral=110
+SEMI=135
+TRUE=105
+FEATURE=29
+SymbolString=90
+COLON=133
+StringLiteral=117
+StringString=87
+SCORE=26
+QUESTION=146
+UnicodeEscape=119
+RCURLY=129
+STARTSWITH=61
+ASSIGN=50
+TOTALCOUNT=15
+DECLARE=9
+DocComment=4
+MOFN=19
+OctalEscape=120
+SETFEATURE=51
+DoubleString=85
+CIRCUMFLEX=130
+ALT_NOTEQUAL=149

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerCompletionEngine.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerCompletionEngine.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerCompletionEngine.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerCompletionEngine.java Mon Jul  9 12:30:22 2012
@@ -42,6 +42,7 @@ import org.apache.uima.textmarker.ide.co
 import org.apache.uima.textmarker.ide.core.parser.TextMarkerParseUtils;
 import org.apache.uima.textmarker.ide.parser.ast.ComponentDeclaration;
 import org.apache.uima.textmarker.ide.parser.ast.ComponentReference;
+import org.apache.uima.textmarker.ide.parser.ast.TMExpressionConstants;
 import org.apache.uima.textmarker.ide.parser.ast.TMTypeConstants;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerAction;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerCondition;
@@ -56,6 +57,7 @@ import org.eclipse.core.resources.IResou
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
 import org.eclipse.dltk.codeassist.RelevanceConstants;
 import org.eclipse.dltk.codeassist.ScriptCompletionEngine;
 import org.eclipse.dltk.compiler.CharOperation;
@@ -66,8 +68,10 @@ import org.eclipse.dltk.core.IMethod;
 import org.eclipse.dltk.core.IModelElement;
 import org.eclipse.dltk.core.IType;
 import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.internal.core.ModelManager;
 import org.eclipse.dltk.internal.core.SourceField;
 import org.eclipse.dltk.internal.core.SourceMethod;
+import org.eclipse.dltk.internal.core.SourceModule;
 
 public class TextMarkerCompletionEngine extends ScriptCompletionEngine {
 
@@ -100,7 +104,7 @@ public class TextMarkerCompletionEngine 
   }
 
   public void complete(IModuleSource module, int position, int i) {
-    this.sourceModule =  module;
+    this.sourceModule = module;
     this.actualCompletionPosition = position;
     this.offset = i;
     this.requestor.beginReporting();
@@ -134,7 +138,7 @@ public class TextMarkerCompletionEngine 
           doCompletionOnVarRef(module, parsed, startPart, type,
                   ((TextMarkerVariableReference) node).getName());
           // TODO: only if first rule element
-          doCompletionOnDeclaration(module, startPart);
+          // doCompletionOnDeclaration(module, startPart);
         } else if (node instanceof ComponentDeclaration) {
           doCompletionOnComponentDeclaration(module, parsed, startPart,
                   ((ComponentDeclaration) node).getType(), startPart);
@@ -197,8 +201,8 @@ public class TextMarkerCompletionEngine 
           TextMarkerModuleDeclaration parsed, String startPart, int type, String complString)
           throws CoreException {
     if (type == ComponentDeclaration.SCRIPT) {
-      List<IFolder> scriptFolders = TextMarkerProjectUtils.getAllScriptFolders(sourceModule.getModelElement()
-              .getScriptProject());
+      List<IFolder> scriptFolders = TextMarkerProjectUtils.getAllScriptFolders(sourceModule
+              .getModelElement().getScriptProject());
 
       List<String> scripts = new ArrayList<String>();
       for (IFolder folder : scriptFolders) {
@@ -213,8 +217,8 @@ public class TextMarkerCompletionEngine 
         }
       }
     } else if (type == ComponentDeclaration.ENGINE) {
-      List<IFolder> descriptorFolders = TextMarkerProjectUtils.getAllDescriptorFolders(sourceModule.getModelElement()
-              .getScriptProject().getProject());
+      List<IFolder> descriptorFolders = TextMarkerProjectUtils.getAllDescriptorFolders(sourceModule
+              .getModelElement().getScriptProject().getProject());
       List<String> engines = new ArrayList<String>();
       for (IFolder folder : descriptorFolders) {
         try {
@@ -228,8 +232,8 @@ public class TextMarkerCompletionEngine 
         }
       }
     } else {
-      List<IFolder> descriptorFolders = TextMarkerProjectUtils.getAllDescriptorFolders(sourceModule.getModelElement()
-              .getScriptProject().getProject());
+      List<IFolder> descriptorFolders = TextMarkerProjectUtils.getAllDescriptorFolders(sourceModule
+              .getModelElement().getScriptProject().getProject());
       List<String> tss = new ArrayList<String>();
       for (IFolder folder : descriptorFolders) {
         try {
@@ -390,7 +394,7 @@ public class TextMarkerCompletionEngine 
     String[] keywords = TextMarkerKeywordsManager.getKeywords(ITextMarkerKeywords.ACTION);
     for (String string : keywords) {
       if (match(complString, string)) {
-        addProposal(complString, string, CompletionProposal.METHOD_NAME_REFERENCE);
+        addProposal(complString, string + "()", string, CompletionProposal.METHOD_NAME_REFERENCE);
       }
     }
   }
@@ -403,7 +407,7 @@ public class TextMarkerCompletionEngine 
     String[] keywords = TextMarkerKeywordsManager.getKeywords(ITextMarkerKeywords.CONDITION);
     for (String string : keywords) {
       if (match(complString, string)) {
-        addProposal(complString, string, CompletionProposal.METHOD_NAME_REFERENCE);
+        addProposal(complString, string + "()", string, CompletionProposal.METHOD_NAME_REFERENCE);
       }
     }
   }
@@ -411,47 +415,44 @@ public class TextMarkerCompletionEngine 
   private void doCompletionOnVarRef(IModuleSource cu, TextMarkerModuleDeclaration parsed,
           String startPart, int type, String complString) {
     Collection<String> types = new HashSet<String>();
-    try {
-      IPath path = sourceModule.getModelElement().getPath();
-      path = path.removeFirstSegments(2);
-      types = importTypeSystem(path.toPortableString(), sourceModule.getModelElement().getScriptProject()
-              .getProject());
-    } catch (Exception e) {
-    }
-    for (String string : types) {
-      if (match(complString, string)) {
-        addProposal(complString, string, CompletionProposal.TYPE_REF);
+    if (type == TMTypeConstants.TM_TYPE_AT) {
+      try {
+        IPath path = sourceModule.getModelElement().getPath();
+        path = path.removeFirstSegments(2);
+        types = importTypeSystem(path.toPortableString(), sourceModule.getModelElement()
+                .getScriptProject().getProject());
+      } catch (Exception e) {
+      }
+      for (String string : types) {
+        if (match(complString, string)) {
+          addProposal(complString, string, CompletionProposal.TYPE_REF);
+        }
+      }
+    } else {
+      IModelElement modelElement = sourceModule.getModelElement();
+      if (modelElement instanceof SourceModule) {
+        SourceModule sm = (SourceModule) modelElement;
+        try {
+          IField[] fields = sm.getFields();
+          for (IField iField : fields) {
+            SourceField f = (SourceField) iField;
+            int fieldType = TextMarkerParseUtils.getTypeOfIModelElement(f);
+            if (TMTypeConstants.TM_TYPE_N == type) {
+              if (fieldType == TMTypeConstants.TM_TYPE_N || fieldType == TMTypeConstants.TM_TYPE_I
+                      || fieldType == TMTypeConstants.TM_TYPE_D
+                      || fieldType == TMTypeConstants.TM_TYPE_F) {
+                addProposal(complString, f.getElementName(), CompletionProposal.LOCAL_VARIABLE_REF);
+              }
+            } else if (type == fieldType) {
+              addProposal(complString, f.getElementName(), CompletionProposal.LOCAL_VARIABLE_REF);
+            }
+
+          }
+        } catch (ModelException e) {
+        }
+
       }
     }
-//    try {
-//      if (cu != null) {
-//        IField[] fieldsArray = sourceModule.getModelElement().getFields();
-//        for (IField field : fieldsArray) {
-//          // if (type != TMTypeConstants.TM_TYPE_AT && Flags.isPrivate(field.getFlags())
-//          // || (type & TMTypeConstants.TM_TYPE_AT) != 0 && Flags.isPublic(field.getFlags())) {
-//          if ((type & TextMarkerParseUtils.getTypeOfIModelElement(field)) != 0) {
-//            addProposal(complString, new ArrayList<String>(), field);
-//          }
-//        }
-//        List<IField> fields = new ArrayList<IField>();
-//        IModelElement[] children = sourceModule.getModelElement().getChildren();
-//        for (IModelElement iModelElement : children) {
-//          if (iModelElement instanceof SourceMethod) {
-//            collectFields((SourceMethod) iModelElement, fields);
-//          }
-//        }
-//        for (IField field : fields) {
-//          // if (type != TMTypeConstants.TM_TYPE_AT && Flags.isPrivate(field.getFlags())
-//          // || (type & TMTypeConstants.TM_TYPE_AT) != 0 && Flags.isPublic(field.getFlags())) {
-//          // if ((type & TextMarkerParseUtils.getTypeOfIModelElement(field)) != 0) {
-//          if (!types.contains(field.getElementName())) {
-//            addProposal(complString, new ArrayList<String>(), field);
-//          }
-          // }
-//        }
-//      }
-//    } catch (ModelException e) {
-//    }
   }
 
   private boolean match(String complString, String string) {
@@ -498,35 +499,35 @@ public class TextMarkerCompletionEngine 
    * @param cu
    */
   private void suggestFields(IModuleSource cu) {
-//    try {
-//      if (cu != null) {
-//        IField[] fieldsArray = sourceModule.getFields();
-//        for (IField field : fieldsArray) {
-//          int relevance = RelevanceConstants.R_EXACT_EXPECTED_TYPE;
-//          // accept result
-//          super.noProposal = false;
-//          int kind = CompletionProposal.LOCAL_VARIABLE_REF;
-//          if (!super.requestor.isIgnored(kind)) {
-//            CompletionProposal proposal = super.createProposal(kind, actualCompletionPosition);
-//            proposal.setRelevance(relevance);
-//            proposal.setModelElement(field);
-//            proposal.setName(field.getElementName());
-//            proposal.setCompletion(field.getElementName());
-//            proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition
-//                    - this.offset);
-//            try {
-//              proposal.setFlags(field.getFlags());
-//            } catch (ModelException e) {
-//            }
-//            this.requestor.accept(proposal);
-//            if (DEBUG) {
-//              this.printDebug(proposal);
-//            }
-//          }
-//        }
-//      }
-//    } catch (ModelException e) {
-//    }
+    // try {
+    // if (cu != null) {
+    // IField[] fieldsArray = sourceModule.getFields();
+    // for (IField field : fieldsArray) {
+    // int relevance = RelevanceConstants.R_EXACT_EXPECTED_TYPE;
+    // // accept result
+    // super.noProposal = false;
+    // int kind = CompletionProposal.LOCAL_VARIABLE_REF;
+    // if (!super.requestor.isIgnored(kind)) {
+    // CompletionProposal proposal = super.createProposal(kind, actualCompletionPosition);
+    // proposal.setRelevance(relevance);
+    // proposal.setModelElement(field);
+    // proposal.setName(field.getElementName());
+    // proposal.setCompletion(field.getElementName());
+    // proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition
+    // - this.offset);
+    // try {
+    // proposal.setFlags(field.getFlags());
+    // } catch (ModelException e) {
+    // }
+    // this.requestor.accept(proposal);
+    // if (DEBUG) {
+    // this.printDebug(proposal);
+    // }
+    // }
+    // }
+    // }
+    // } catch (ModelException e) {
+    // }
   }
 
   /**
@@ -541,7 +542,7 @@ public class TextMarkerCompletionEngine 
     if (CharOperation.camelCaseMatch(complString.toCharArray(), fieldName)
             || match(complString, field.getElementName())) {
 
-      int relevance = RelevanceConstants.R_DEFAULT +1;
+      int relevance = RelevanceConstants.R_DEFAULT + 1;
       relevance += computeRelevanceForCaseMatching(complFragment, field.getElementName());
 
       // accept result
@@ -567,6 +568,10 @@ public class TextMarkerCompletionEngine 
   }
 
   private void addProposal(String complString, String string, int kind) {
+    addProposal(complString, string, string, kind);
+  }
+
+  private void addProposal(String complString, String string, String name, int kind) {
     char[] fieldName = string.toCharArray();
     char[] complFragment = complString.toCharArray();
 
@@ -576,7 +581,7 @@ public class TextMarkerCompletionEngine 
     }
     if (CharOperation.camelCaseMatch(pattern, fieldName) || match(complString, string)) {
 
-      int relevance = RelevanceConstants.R_DEFAULT +1;
+      int relevance = RelevanceConstants.R_DEFAULT + 1;
       relevance += computeRelevanceForCaseMatching(complFragment, string);
 
       // accept result
@@ -584,7 +589,7 @@ public class TextMarkerCompletionEngine 
       if (!super.requestor.isIgnored(kind)) {
         CompletionProposal proposal = super.createProposal(kind, actualCompletionPosition);
         proposal.setRelevance(relevance);
-        proposal.setName(string);
+        proposal.setName(name);
         proposal.setCompletion(string);
         proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
         // try {
@@ -608,9 +613,7 @@ public class TextMarkerCompletionEngine 
     for (int a = 0; a < keywords.size(); a++) {
       keyWordsArray[a] = keywords.get(a).toCharArray();
     }
-    findKeywords(startPart.toCharArray(), keywords.toArray( new String[0]), true);
+    findKeywords(startPart.toCharArray(), keywords.toArray(new String[0]), true);
   }
 
- 
-
 }

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerReferenceVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerReferenceVisitor.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerReferenceVisitor.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/codeassist/TextMarkerReferenceVisitor.java Mon Jul  9 12:30:22 2012
@@ -23,6 +23,7 @@ import org.apache.uima.textmarker.ide.pa
 import org.apache.uima.textmarker.ide.parser.ast.ComponentReference;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerAction;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerCondition;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerExpression;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerVariableReference;
 import org.eclipse.dltk.ast.ASTNode;
 import org.eclipse.dltk.ast.ASTVisitor;
@@ -57,10 +58,19 @@ public class TextMarkerReferenceVisitor 
     } else if (s instanceof TextMarkerAction && ((TextMarkerAction) s).getNameStart() <= start
             && start <= ((TextMarkerAction) s).getNameEnd()) {
       result = s;
+    } else if (s instanceof TextMarkerAction && ((TextMarkerAction) s).getNameStart()-1 == start
+            && start == ((TextMarkerAction) s).getNameEnd()-1) {
+      result = s;
     } else if (s instanceof TextMarkerCondition
             && ((TextMarkerCondition) s).getNameStart() <= start
             && start <= ((TextMarkerCondition) s).getNameEnd()) {
       result = s;
+    } else if (s instanceof TextMarkerCondition
+            && ((TextMarkerCondition) s).getNameStart()-1 == start
+            && start == ((TextMarkerCondition) s).getNameEnd()-1) {
+      result = s;
+    } else if(s instanceof TextMarkerExpression && s.sourceStart() == start && s.sourceEnd() == start) {
+      result = s;
     }
     return super.visit(s);
   }

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/textmarker/ide/formatter/TextMarkerFormatter.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/formatter/TextMarkerFormatter.java Mon Jul  9 12:30:22 2012
@@ -90,8 +90,8 @@ public class TextMarkerFormatter extends
     if (!reporter.gotProblems()) {
 
       BitSet bs = new BitSet();
-      bs.add(TextMarkerParser.LINE_COMMENT);
-      bs.add(TextMarkerParser.COMMENT);
+      bs.add(org.apache.uima.textmarker.parser.TextMarkerParser.LINE_COMMENT);
+      bs.add(org.apache.uima.textmarker.parser.TextMarkerParser.COMMENT);
       List<CommonToken> comments = tokenStream.getTokens(0, tokenStream.size(), bs);
 
       final String output = format(input, (ModuleDeclaration)md, comments, indent);

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ActionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ActionFactory.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ActionFactory.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ActionFactory.java Mon Jul  9 12:30:22 2012
@@ -66,6 +66,12 @@ public class ActionFactory extends Abstr
     return createAction(type, listOfExpressions);
   }
 
+  public static TextMarkerAction createEmptyAction(Token token) {
+    int bounds[] = getBounds(token);
+    return new TextMarkerAction(bounds[0], bounds[0], new ArrayList<Expression>(),
+            TMConditionConstants.CONSTANT_OFFSET, "", bounds[0], bounds[0]);
+  }
+  
   public static TextMarkerAction createAction(Token type, Map<Expression, Expression> map,
           Expression... exprsArray) {
     List<Expression> listOfExpressions = new ArrayList<Expression>();

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ConditionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ConditionFactory.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ConditionFactory.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ConditionFactory.java Mon Jul  9 12:30:22 2012
@@ -15,7 +15,7 @@
  * 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.parser.ast;
 
@@ -25,7 +25,6 @@ import java.util.List;
 import org.antlr.runtime.Token;
 import org.eclipse.dltk.ast.expressions.Expression;
 
-
 public class ConditionFactory extends AbstractFactory {
 
   public static TextMarkerCondition createCondition(Token type, List exprs) {
@@ -59,6 +58,12 @@ public class ConditionFactory extends Ab
     return createCondition(type, exprL);
   }
 
+  public static TextMarkerCondition createEmptyCondition(Token token) {
+    int bounds[] = getBounds(token);
+    return new TextMarkerCondition(bounds[0], bounds[0], new ArrayList<Expression>(),
+            TMConditionConstants.CONSTANT_OFFSET, "", bounds[0], bounds[0]);
+  }
+
   // public static TextMarkerCondition createConditionAnd(int start, int end,
   // DLTKToken token, List<TextMarkerCondition> conds,
   // TextMarkerBlock parent) {

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ExpressionFactory.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ExpressionFactory.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/parser/ast/ExpressionFactory.java Mon Jul  9 12:30:22 2012
@@ -113,6 +113,22 @@ public class ExpressionFactory extends A
     return new TextMarkerExpression(e.sourceStart(), e.sourceEnd(), e, TMTypeConstants.TM_TYPE_AT);
   }
 
+  public static Expression createEmptyTypeExpression(Token token) {
+    int bounds[] = getBounds(token);
+    return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_AT);
+  }
+  public static Expression createEmptyStringExpression(Token token) {
+    int bounds[] = getBounds(token);
+    return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_S);
+  }
+  public static Expression createEmptyNumberExpression(Token token) {
+    int bounds[] = getBounds(token);
+    return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_N);
+  }
+  public static Expression createEmptyBooleanExpression(Token token) {
+    int bounds[] = getBounds(token);
+    return new TextMarkerVariableReference(bounds[0], bounds[0], "", TMTypeConstants.TM_TYPE_B);
+  }
   // public static Expression createSimpleTypeExpression(Token at, TextMarkerBlock env) {
   // int bounds[] = getBounds(at);
   // return new TextMarkerSimpleTypeExpression(bounds[0], bounds[1], at.getText());
@@ -325,4 +341,6 @@ public class ExpressionFactory extends A
     return createStringExpression(list);
   }
 
+  
+
 }

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerCheckerProblemFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerCheckerProblemFactory.java?rev=1359109&r1=1359108&r2=1359109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerCheckerProblemFactory.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/validator/TextMarkerCheckerProblemFactory.java Mon Jul  9 12:30:22 2012
@@ -22,6 +22,8 @@ package org.apache.uima.textmarker.ide.v
 import java.util.List;
 
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerAbstractDeclaration;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerAction;
+import org.apache.uima.textmarker.ide.parser.ast.TextMarkerCondition;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerFeatureDeclaration;
 import org.apache.uima.textmarker.ide.parser.ast.TextMarkerVariableReference;
 import org.eclipse.dltk.ast.ASTListNode;
@@ -80,7 +82,8 @@ public class TextMarkerCheckerProblemFac
             getLine(node), severity);
   }
 
-  public IProblem createDuplicateShortName(TextMarkerAbstractDeclaration var, ProblemSeverity severity) {
+  public IProblem createDuplicateShortName(TextMarkerAbstractDeclaration var,
+          ProblemSeverity severity) {
     return new TextMarkerCheckerDefaultProblem(this.fileName, "The type " + var.getName()
             + " conflicts with other types with same short name, but different namespace.", var,
             getLine(var), severity);
@@ -159,4 +162,15 @@ public class TextMarkerCheckerProblemFac
             + "\" is final and cannot be used as a parent type.";
     return new TextMarkerCheckerDefaultProblem(this.fileName, message, parent, getLine(parent));
   }
+
+  public IProblem createUnknownConditionProblem(TextMarkerCondition cond) {
+    String message = "error: Condition \"" + cond.getName() + "\" is not defined.";
+    return new TextMarkerCheckerDefaultProblem(this.fileName, message, cond, getLine(cond));
+  }
+
+  public IProblem createUnknownActionProblem(TextMarkerAction action) {
+    String message = "error: Action \"" + action.getName() + "\" is not defined.";
+    return new TextMarkerCheckerDefaultProblem(this.fileName, message, action, getLine(action));
+  }
+
 }

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=1359109&r1=1359108&r2=1359109&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:30:22 2012
@@ -34,6 +34,9 @@ import org.apache.uima.resource.Resource
 import org.apache.uima.resource.metadata.FeatureDescription;
 import org.apache.uima.resource.metadata.TypeDescription;
 import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.textmarker.ide.core.ITextMarkerKeywords;
+import org.apache.uima.textmarker.ide.core.TextMarkerKeywords;
+import org.apache.uima.textmarker.ide.core.TextMarkerKeywordsManager;
 import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
 import org.apache.uima.textmarker.ide.parser.ast.TMActionConstants;
 import org.apache.uima.textmarker.ide.parser.ast.TMTypeConstants;
@@ -199,6 +202,16 @@ 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[] keywords = TextMarkerKeywordsManager.getKeywords(ITextMarkerKeywords.ACTION);
+        List<String> asList = Arrays.asList(keywords);
+        if(!"".equals(actionName) && !asList.contains(actionName)) {
+          IProblem problem = problemFactory.createUnknownActionProblem(tma);
+          rep.reportProblem(problem);
+        }
+        
         if (tma.getKind() == TMActionConstants.A_ASSIGN) {
           List<?> childs = tma.getChilds();
           try {
@@ -248,6 +261,13 @@ public class TextMarkerVarRefChecker imp
         TextMarkerCondition cond = (TextMarkerCondition) s;
         String conditionName = currentFile.getSource().substring(cond.getNameStart(),
                 cond.getNameEnd());
+        String[] keywords = TextMarkerKeywordsManager.getKeywords(ITextMarkerKeywords.CONDITION);
+        List<String> asList = Arrays.asList(keywords);
+        if(!"".equals(conditionName) && !asList.contains(conditionName)) {
+          IProblem problem = problemFactory.createUnknownConditionProblem(cond);
+          rep.reportProblem(problem);
+        }
+        
         if (conditionName.equals("FEATURE")) {
           if (matchedType != null) {
             List<?> args = cond.getChilds();