1<?php 2 3namespace Doctrine\Tests\Common\Lexer; 4 5use Doctrine\Common\Lexer\AbstractLexer; 6 7class ConcreteLexer extends AbstractLexer 8{ 9 const INT = 'int'; 10 11 protected function getCatchablePatterns() 12 { 13 return array( 14 '=|<|>', 15 '[a-z]+', 16 '\d+', 17 ); 18 } 19 20 protected function getNonCatchablePatterns() 21 { 22 return array( 23 '\s+', 24 '(.)', 25 ); 26 } 27 28 protected function getType(&$value) 29 { 30 if (is_numeric($value)) { 31 $value = (int)$value; 32 33 return 'int'; 34 } 35 if (in_array($value, array('=', '<', '>'))) { 36 return 'operator'; 37 } 38 if (is_string($value)) { 39 return 'string'; 40 } 41 42 return; 43 } 44 45 protected function getModifiers() 46 { 47 return parent::getModifiers().'u'; 48 } 49} 50