Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens?rev=1229085&r1=1229084&r2=1229085&view=diff ============================================================================== --- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens (original) +++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerLexer.tokens Mon Jan 9 10:22:03 2012 @@ -52,101 +52,103 @@ FEATURE=54 FILL=55 FILTERMARKUP=56 FILTERTYPE=57 -FloatTypeSuffix=58 -FloatingPointLiteral=59 -GATHER=60 -GET=61 -GETFEATURE=62 -GETLIST=63 -GREATER=64 -GREATEREQUAL=65 -HexDigit=66 -HexLiteral=67 -IF=68 -INLIST=69 -INTLIST=70 -IS=71 -ISINTAG=72 -Identifier=73 -IntString=74 -IntegerTypeSuffix=75 -JavaIDDigit=76 -LAST=77 -LBRACK=78 -LCURLY=79 -LESS=80 -LESSEQUAL=81 -LINE_COMMENT=82 -LOG=83 -LOGN=84 -LPAREN=85 -Letter=86 -ListIdentifier=87 -LogLevel=88 -MARK=89 -MARKFAST=90 -MARKLAST=91 -MARKONCE=92 -MARKSCORE=93 -MARKTABLE=94 -MATCHEDTEXT=95 -MERGE=96 -MINUS=97 -MOFN=98 -NEAR=99 -NOT=100 -NOTEQUAL=101 -OR=102 -OctalEscape=103 -OctalLiteral=104 -OldColor=105 -PARSE=106 -PARTOF=107 -PARTOFNEQ=108 -PERCENT=109 -PLUS=110 -POSITION=111 -PackageString=112 -QUESTION=113 -RBRACK=114 -RCURLY=115 -REGEXP=116 -REMOVE=117 -REMOVEDUPLICATE=118 -REMOVESTRING=119 -REPLACE=120 -RETAINMARKUP=121 -RETAINTYPE=122 -RPAREN=123 -RessourceLiteral=124 -SCORE=125 -SEMI=126 -SETFEATURE=127 -SIN=128 -SIZE=129 -SLASH=130 -STAR=131 -STARTSWITH=132 -STRINGLIST=133 -ScriptString=134 -StringLiteral=135 -StringString=136 -SymbolString=137 -TAN=138 -THEN=139 -TOTALCOUNT=140 -TRANSFER=141 -TRIE=142 -TRUE=143 -TYPELIST=144 -TypeString=145 -TypeSystemString=146 -UNMARK=147 -UNMARKALL=148 -UnicodeEscape=149 -VBAR=150 -VOTE=151 -WORDLIST=152 -WORDTABLE=153 -WS=154 -XOR=155 +FLOATLIST=58 +FloatString=59 +FloatTypeSuffix=60 +FloatingPointLiteral=61 +GATHER=62 +GET=63 +GETFEATURE=64 +GETLIST=65 +GREATER=66 +GREATEREQUAL=67 +HexDigit=68 +HexLiteral=69 +IF=70 +INLIST=71 +INTLIST=72 +IS=73 +ISINTAG=74 +Identifier=75 +IntString=76 +IntegerTypeSuffix=77 +JavaIDDigit=78 +LAST=79 +LBRACK=80 +LCURLY=81 +LESS=82 +LESSEQUAL=83 +LINE_COMMENT=84 +LOG=85 +LOGN=86 +LPAREN=87 +Letter=88 +ListIdentifier=89 +LogLevel=90 +MARK=91 +MARKFAST=92 +MARKLAST=93 +MARKONCE=94 +MARKSCORE=95 +MARKTABLE=96 +MATCHEDTEXT=97 +MERGE=98 +MINUS=99 +MOFN=100 +NEAR=101 +NOT=102 +NOTEQUAL=103 +OR=104 +OctalEscape=105 +OctalLiteral=106 +OldColor=107 +PARSE=108 +PARTOF=109 +PARTOFNEQ=110 +PERCENT=111 +PLUS=112 +POSITION=113 +PackageString=114 +QUESTION=115 +RBRACK=116 +RCURLY=117 +REGEXP=118 +REMOVE=119 +REMOVEDUPLICATE=120 +REMOVESTRING=121 +REPLACE=122 +RETAINMARKUP=123 +RETAINTYPE=124 +RPAREN=125 +RessourceLiteral=126 +SCORE=127 +SEMI=128 +SETFEATURE=129 +SIN=130 +SIZE=131 +SLASH=132 +STAR=133 +STARTSWITH=134 +STRINGLIST=135 +ScriptString=136 +StringLiteral=137 +StringString=138 +SymbolString=139 +TAN=140 +THEN=141 +TOTALCOUNT=142 +TRANSFER=143 +TRIE=144 +TRUE=145 +TYPELIST=146 +TypeString=147 +TypeSystemString=148 +UNMARK=149 +UNMARKALL=150 +UnicodeEscape=151 +VBAR=152 +VOTE=153 +WORDLIST=154 +WORDTABLE=155 +WS=156 +XOR=157
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerParser.g URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerParser.g?rev=1229085&r1=1229084&r2=1229085&view=diff ============================================================================== --- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerParser.g (original) +++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/parser/TextMarkerParser.g Mon Jan 9 10:22:03 2012 @@ -258,6 +258,11 @@ variableDeclaration returns [TextMarkerS (COMMA {!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {addVariable($blockDeclaration::env, id.getText(), type.getText());} )* (ASSIGN_EQUAL value2 = numberExpression)? {setValue($blockDeclaration::env, id.getText(), value2);} SEMI | + type = FloatString + {!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {addVariable($blockDeclaration::env, id.getText(), type.getText());} + (COMMA {!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {addVariable($blockDeclaration::env, id.getText(), type.getText());} + )* (ASSIGN_EQUAL value2 = numberExpression)? {setValue($blockDeclaration::env, id.getText(), value2);} SEMI + | type = StringString {!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {addVariable($blockDeclaration::env, id.getText(), type.getText());} (COMMA {!ownsVariable($blockDeclaration::env, input.LT(1).getText())}? id = Identifier {addVariable($blockDeclaration::env, id.getText(), type.getText());} @@ -297,6 +302,10 @@ variableDeclaration returns [TextMarkerS {!isVariableOfType($blockDeclaration::env, input.LT(1).getText(), type.getText())}? name = Identifier (ASSIGN_EQUAL dl = numberListExpression)? SEMI {addVariable($blockDeclaration::env, name.getText(), type.getText());if(dl != null){setValue($blockDeclaration::env, name.getText(), dl);}} | + type = FLOATLIST + {!isVariableOfType($blockDeclaration::env, input.LT(1).getText(), type.getText())}? + name = Identifier (ASSIGN_EQUAL dl = numberListExpression)? SEMI {addVariable($blockDeclaration::env, name.getText(), type.getText());if(dl != null){setValue($blockDeclaration::env, name.getText(), dl);}} + | type = TYPELIST {!isVariableOfType($blockDeclaration::env, input.LT(1).getText(), type.getText())}? name = Identifier (ASSIGN_EQUAL tl = typeListExpression)? SEMI {addVariable($blockDeclaration::env, name.getText(), type.getText());if(tl != null){setValue($blockDeclaration::env, name.getText(), tl);}} @@ -353,6 +362,7 @@ List featureNames = new ArrayList(); obj1 = annotationType{featureTypes.add(obj1.getText());} | obj2 = StringString{featureTypes.add(obj2.getText());} | obj3 = DoubleString{featureTypes.add(obj3.getText());} + | obj6 = FloatString{featureTypes.add(obj6.getText());} | obj4 = IntString{featureTypes.add(obj4.getText());} | obj5 = BooleanString{featureTypes.add(obj5.getText());} ) @@ -363,6 +373,7 @@ List featureNames = new ArrayList(); obj1 = annotationType{featureTypes.add(obj1.getText());} | obj2 = StringString{featureTypes.add(obj2.getText());} | obj3 = DoubleString{featureTypes.add(obj3.getText());} + | obj6 = FloatString{featureTypes.add(obj6.getText());} | obj4 = IntString{featureTypes.add(obj4.getText());} | obj5 = BooleanString{featureTypes.add(obj5.getText());} ) @@ -620,6 +631,7 @@ listExpression returns [ListExpression e (booleanListExpression)=> bl = booleanListExpression {expr = bl;} | (intListExpression)=> il = intListExpression {expr = il;} | (doubleListExpression)=> dl = doubleListExpression {expr = dl;} + | (floatListExpression)=> dl = floatListExpression {expr = dl;} | (stringListExpression)=> sl = stringListExpression {expr = sl;} | (typeListExpression)=> tl = typeListExpression {expr = tl;} ; @@ -662,6 +674,8 @@ numberListExpression returns [NumberList : (e1 = doubleListExpression)=> e1 = doubleListExpression {expr = e1;} | + (e1 = floatListExpression)=> e1 = floatListExpression {expr = e1;} + | e2 = intListExpression {expr = e2;} ; @@ -681,6 +695,22 @@ simpleDoubleListExpression returns [Numb {expr = ExpressionFactory.createReferenceDoubleListExpression(var);} ; + +floatListExpression returns [NumberListExpression expr = null] + : + e = simpleFloatListExpression {expr = e;} + ; + +simpleFloatListExpression returns [NumberListExpression expr = null] +@init{ + List<NumberExpression> list = new ArrayList<NumberExpression>(); +} : + LCURLY (e = simpleNumberExpression {list.add(e);} (COMMA e = simpleNumberExpression {list.add(e);})*)? RCURLY + {expr = ExpressionFactory.createNumberListExpression(list);} + | + {isVariableOfType($blockDeclaration::env,input.LT(1).getText(), "FLOATLIST")}? var = Identifier + {expr = ExpressionFactory.createReferenceFloatListExpression(var);} + ; stringListExpression returns [StringListExpression expr = null] : @@ -763,6 +793,7 @@ listVariable returns [Token var = null] {isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "BOOLEANLIST") ||isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "INTLIST") ||isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "DOUBLELIST") + ||isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "FLOATLIST") ||isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "STRINGLIST") ||isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "TYPELIST") }? v = Identifier {var = v;} @@ -1362,6 +1393,10 @@ actionAssign returns [AbstractTextMarker nv = Identifier COMMA e4 = numberExpression {action = ActionFactory.createAssignAction(nv, e4,$blockDeclaration::env);} | + {isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "FLOAT")}? + nv = Identifier COMMA e6 = numberExpression + {action = ActionFactory.createAssignAction(nv, e6,$blockDeclaration::env);} + | {isVariableOfType($blockDeclaration::env, input.LT(1).getText(), "DOUBLE")}? nv = Identifier COMMA e5 = numberExpression {action = ActionFactory.createAssignAction(nv, e5,$blockDeclaration::env);} @@ -1609,6 +1644,7 @@ numberVariable returns [Token ref = null : {isVariableOfType($blockDeclaration::env,input.LT(1).getText(), "INT")}? token1 = Identifier {ref = token1;} | {isVariableOfType($blockDeclaration::env,input.LT(1).getText(), "DOUBLE")}? token2 = Identifier {ref = token2;} + | {isVariableOfType($blockDeclaration::env,input.LT(1).getText(), "FLOAT")}? token2 = Identifier {ref = token2;} ; @@ -1642,6 +1678,7 @@ numberExpressionInPar returns [NumberExp simpleNumberExpression returns [NumberExpression expr = null] : m = MINUS? lit = DecimalLiteral {expr = ExpressionFactory.createIntegerExpression(lit,m);} + // TODO what about float numbers? | m = MINUS? lit = FloatingPointLiteral {expr = ExpressionFactory.createDoubleExpression(lit,m);} | m = MINUS? var = numberVariable {expr = ExpressionFactory.createReferenceNumberExpression(var,m);} | e = numberExpressionInPar {expr = e;}
