Skip to content

Commit f7c132a

Browse files
authored
Add DescrDumperTest and fix the expression parser grammar (apache#48)
* Add DescrDumperTest * Fix it
1 parent 8b641f8 commit f7c132a

File tree

3 files changed

+384
-6
lines changed

3 files changed

+384
-6
lines changed

drools-drl/drools-drl10-parser/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@
7575
<version>${version.ch.qos.logback}</version>
7676
<scope>test</scope>
7777
</dependency>
78+
<dependency>
79+
<groupId>org.drools</groupId>
80+
<artifactId>drools-compiler</artifactId>
81+
<version>${version.org.drools}</version>
82+
<scope>test</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.drools</groupId>
86+
<artifactId>drools-mvel</artifactId>
87+
<version>${version.org.drools}</version>
88+
<scope>test</scope>
89+
</dependency>
7890
</dependencies>
7991

8092
<build>

drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRL6Expressions.g4

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ catch (RecognitionException re) {
9999
// --------------------------------------------------------
100100
literal
101101
: STRING_LITERAL { helper.emit($STRING_LITERAL, DroolsEditorType.STRING_CONST); }
102+
| DRL_STRING_LITERAL { helper.emit($DRL_STRING_LITERAL, DroolsEditorType.STRING_CONST); }
102103
| DECIMAL_LITERAL { helper.emit($DECIMAL_LITERAL, DroolsEditorType.NUMERIC_CONST); }
103104
| HEX_LITERAL { helper.emit($HEX_LITERAL, DroolsEditorType.NUMERIC_CONST); }
104105
| FLOAT_LITERAL { helper.emit($FLOAT_LITERAL, DroolsEditorType.NUMERIC_CONST); }
@@ -731,9 +732,6 @@ selector
731732

732733
superSuffix
733734
: arguments
734-
// TODO syntactic predicates in the form of `(x) => x` can be safely removed but
735-
// there was originally `DOT ID ((LEFT_PAREN) => arguments)?`.
736-
// Not sure if removing `(LEFT_PAREN) =>` is correct.
737735
| DOT IDENTIFIER (arguments)?
738736
;
739737

@@ -832,15 +830,16 @@ new_key
832830
;
833831

834832
not_key
835-
: {(helper.validateIdentifierKey(DroolsSoftKeywords.NOT))}? id=IDENTIFIER { helper.emit($id, DroolsEditorType.KEYWORD); }
833+
: {(helper.validateIdentifierKey(DroolsSoftKeywords.NOT))}? id=DRL_NOT { helper.emit($id, DroolsEditorType.KEYWORD); }
836834
;
837835

838836
in_key
839-
: {(helper.validateIdentifierKey(DroolsSoftKeywords.IN))}? id=IDENTIFIER { helper.emit($id, DroolsEditorType.KEYWORD); }
837+
: {(helper.validateIdentifierKey(DroolsSoftKeywords.IN))}? id=DRL_IN { helper.emit($id, DroolsEditorType.KEYWORD); }
840838
;
841839

842840
operator_key
843-
: {(helper.isPluggableEvaluator(false))}? id=IDENTIFIER { helper.emit($id, DroolsEditorType.KEYWORD); }
841+
// TODO get rid of the DRL_MATCHES token or introduce DRL_CONTAINS etc. for consistency.
842+
: {(helper.isPluggableEvaluator(false))}? id=(IDENTIFIER|DRL_MATCHES) { helper.emit($id, DroolsEditorType.KEYWORD); }
844843
;
845844

846845
neg_operator_key

0 commit comments

Comments
 (0)