|
From: <jbo...@li...> - 2006-06-21 22:37:58
|
Author: KrisVerlaenen
Date: 2006-06-21 18:37:56 -0400 (Wed, 21 Jun 2006)
New Revision: 4800
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java
Log:
JBRULES-314: Lhs Rule completion should have better support for exists, not, eval, and, or
- extended parser so the end of and, or, exists, not and eval is registered
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java 2006-06-21 22:05:06 UTC (rev 4799)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java 2006-06-21 22:37:56 UTC (rev 4800)
@@ -4560,6 +4560,17 @@
}
+ if (d instanceof OrDescr) {
+ List l = ((OrDescr) d).getDescrs();
+ if (l != null && l.size() == 2) {
+ PatternDescr subDescr = (PatternDescr) l.get(1);
+ if (subDescr != null && (subDescr.getEndLine() != 0 || subDescr.getEndColumn() != 0)) {
+ Token end = input.LT(-1);
+ d.setEndLocation(offset(end.getLine()), end.getCharPositionInLine());
+ }
+ }
+ }
+
}
catch (RecognitionException re) {
reportError(re);
@@ -4646,7 +4657,18 @@
}
-
+
+ if (d instanceof AndDescr) {
+ List l = ((AndDescr) d).getDescrs();
+ if (l != null && l.size() == 2) {
+ PatternDescr subDescr = (PatternDescr) l.get(1);
+ if (subDescr != null && (subDescr.getEndLine() != 0 || subDescr.getEndColumn() != 0)) {
+ Token end = input.LT(-1);
+ d.setEndLocation(offset(end.getLine()), end.getCharPositionInLine());
+ }
+ }
+ }
+
}
catch (RecognitionException re) {
reportError(re);
@@ -4835,6 +4857,11 @@
}
+ if (column != null && (column.getEndLine() != 0 || column.getEndColumn() != 0)) {
+ Token end = input.LT(-1);
+ d.setEndLocation(offset(end.getLine()), end.getCharPositionInLine());
+ }
+
}
catch (RecognitionException re) {
reportError(re);
@@ -4909,8 +4936,12 @@
d = new NotDescr( (ColumnDescr) column );
d.setLocation( offset(loc.getLine()), loc.getCharPositionInLine() );
-
}
+
+ if (column != null && (column.getEndLine() != 0 || column.getEndColumn() != 0)) {
+ Token end = input.LT(-1);
+ d.setEndLocation(offset(end.getLine()), end.getCharPositionInLine());
+ }
}
catch (RecognitionException re) {
@@ -4954,6 +4985,9 @@
}
+
+ Token end = input.LT(-1);
+ d.setEndLocation(offset(end.getLine()), end.getCharPositionInLine());
}
catch (RecognitionException re) {
|