Skip to content

Commit

Permalink
Add DescrDumperTest and fix the expression parser grammar (#48)
Browse files Browse the repository at this point in the history
* Add DescrDumperTest

* Fix it
  • Loading branch information
yurloc authored and mariofusco committed Feb 14, 2024
1 parent e41fbdc commit be33de7
Show file tree
Hide file tree
Showing 3 changed files with 384 additions and 6 deletions.
12 changes: 12 additions & 0 deletions drools-drl/drools-drl10-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
<version>${version.ch.qos.logback}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${version.org.drools}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-mvel</artifactId>
<version>${version.org.drools}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ catch (RecognitionException re) {
// --------------------------------------------------------
literal
: STRING_LITERAL { helper.emit($STRING_LITERAL, DroolsEditorType.STRING_CONST); }
| DRL_STRING_LITERAL { helper.emit($DRL_STRING_LITERAL, DroolsEditorType.STRING_CONST); }
| DECIMAL_LITERAL { helper.emit($DECIMAL_LITERAL, DroolsEditorType.NUMERIC_CONST); }
| HEX_LITERAL { helper.emit($HEX_LITERAL, DroolsEditorType.NUMERIC_CONST); }
| FLOAT_LITERAL { helper.emit($FLOAT_LITERAL, DroolsEditorType.NUMERIC_CONST); }
Expand Down Expand Up @@ -731,9 +732,6 @@ selector

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

Expand Down Expand Up @@ -832,15 +830,16 @@ new_key
;

not_key
: {(helper.validateIdentifierKey(DroolsSoftKeywords.NOT))}? id=IDENTIFIER { helper.emit($id, DroolsEditorType.KEYWORD); }
: {(helper.validateIdentifierKey(DroolsSoftKeywords.NOT))}? id=DRL_NOT { helper.emit($id, DroolsEditorType.KEYWORD); }
;

in_key
: {(helper.validateIdentifierKey(DroolsSoftKeywords.IN))}? id=IDENTIFIER { helper.emit($id, DroolsEditorType.KEYWORD); }
: {(helper.validateIdentifierKey(DroolsSoftKeywords.IN))}? id=DRL_IN { helper.emit($id, DroolsEditorType.KEYWORD); }
;

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

neg_operator_key
Expand Down

0 comments on commit be33de7

Please sign in to comment.