Exemple #1
0
    public function __construct()
    {
        parent::__construct(new \JMS\Parser\SimpleLexer('/
                # PHP Class Names
                ((?:[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*\\\\)*[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)

                # Strings
                |("(?:[^"]|"")*"|\'(?:[^\']|\'\')*\')

                # Ignore whitespace
                |\\s*

                # Terminals
                |(.)
            /x', array(self::T_NAME => 'T_NAME', self::T_STRING => 'T_STRING', self::T_OPEN_BRACKET => 'T_OPEN_BRACKET', self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'), function ($value) {
            switch ($value[0]) {
                case '"':
                case "'":
                    return array(TypeParser::T_STRING, substr($value, 1, -1));
                case '<':
                    return array(TypeParser::T_OPEN_BRACKET, '<');
                case '>':
                    return array(TypeParser::T_CLOSE_BRACKET, '>');
                case ',':
                    return array(TypeParser::T_COMMA, ',');
                default:
                    if (preg_match('/^(?:[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*\\\\)*[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $value)) {
                        return array(TypeParser::T_NAME, $value);
                    }
                    return array(TypeParser::T_NONE, $value);
            }
        }));
    }
Exemple #2
0
 public function __construct(Factory $factory)
 {
     $this->factory = $factory;
     parent::__construct(new Lexer());
 }
 public function __construct()
 {
     parent::__construct(new ExpressionLexer());
 }
 public function __construct(TypeRegistry $registry)
 {
     parent::__construct(new TypeLexer());
     $this->registry = $registry;
 }