Michael,
I started to work on this issue and have a couple questions for you:
1. What I'm doing is creating the following method in NLGrammar:
/**
* Validades the mapping returning a list of errors found
* or an empty list in case of no errors
*
* @return a List of MappingError's found or an empty list in case no one
was found
*/
public List validateMapping(NLMappingItem item);
This method will internally call several private validation methods for the
validations we want to do and return a consolidated list of all errors found.
The errors, right now are instances of a new class I created:
public class MappingError extends DroolsError
* Is that approach ok?
* Besides having a String error message, should this MappingError class
store an error code? or even an error level (warning, error, etc)?
2. I saw that in some parts of code you make use of regex and in the others you
don't. I guess this method will be called in DSL compilation time (optionally)
and by IDE (on demand) to validate mappings. Do you see any problem in using
regex to make the validations?
3. Right now I'm validating unmatched "{", illegal "token" names, unused tokens
declared on the expression and tokens used in the mapping but not found in the
expression. Anything else?
Obs: I'm considering legal tokens those that follow this pattern: "\\{(\\w*)\\}"
4. Any other recomendation before I commit the code?
Thanks,
Edson