The validate module


Validate all lexicons in this language.

Errors and warnings are printed to stdout. If there are errors, this function returns False, otherwise True.

class LexiconValidator(lexicon)[source]

Bases: object

error(msg, lexicon=None)[source]

Add message to errors.

warning(msg, lexicon=None)[source]

Add message to warnings.


Validate a lexicon.

Errors and warnings are left in the errors and warnings attributes, respectively.

validate_pattern(pattern, n)[source]

Validate a regular expression pattern.

validate_rule(rule, n)[source]

Validate a rule, which should be action, target[, target, …].

Does not look at the action, but checks whether all the targets are valid (either an integer or a Lexicon).


Check whether this default target could lead to circular references.

This could hang the parser, and we wouldn’t like to have that :-)