*/ class EnumLexer extends AbstractLexer { /** * {@inheritDoc} */ protected function getCatchablePatterns(): array { return [ '=|<|>', '[a-z]+', '\d+', ]; } /** * {@inheritDoc} */ protected function getNonCatchablePatterns(): array { return [ '\s+', '(.)', ]; } /** * {@inheritDoc} */ protected function getType(&$value): TokenType { if (is_numeric($value)) { $value = (int) $value; return TokenType::INT; } if (in_array($value, ['=', '<', '>'])) { return TokenType::OPERATOR; } return TokenType::STRING; } }