Blex will use Pattern objects to match it's pattern definition (a regular expression) against the input. When a pattern is recognized (matches the input), a Token instance will be generated, and the related pattern action will be called.
The pattern class defined in Blex contains information related to the pattern definition. Pattern class properties are:
- pattern: An string containing the regular expression definition that this pattern will match. E.g. '[A-Za-z]+'
- re: It's a compiled regular expression python object (it's compiled for faster matching on succesive input tests) of the previous pattern property.
- hook: It's the function that will be called just after this pattern has been matched. This function is referred as Token hook.
- token: The Token.id the generated tokens will have when this pattern is matched. E.g. SEPARATOR or IDENTIFIER.