apache / incubator-kie-drools

Drools is a rule engine, DMN engine and complex event processing (CEP) engine for Java.
http://www.drools.org
5.85k stars 2.49k forks source link

[new-parser] Unify error reporting of DRLParser and DRL6Expressions #5959

Open yurloc opened 4 months ago

yurloc commented 4 months ago

DRL6Expressions is a bit ahead of DRLParser so I take that as a benchmark.

Impl

The code that registers error listeners is very different for both parsers. It could be unified and reused.

API

Contents of parser.getErrors() should be unified.

DRL6Expressions

org.drools.drl.parser.DroolsParserException: [ERR 102] Line 1:1 mismatched input '<EOF>' expecting {...}

DRLParser

org.drools.drl.parser.ParserError: [18,0]: mismatched input 'impot' expecting {...}

So while the problem occurs during parsing (mismatched input), parsers report different exception types with slightly different messages. This should be unified.

Tests