Пример #1
0
        self::$filter_end = '/;/';
        self::$boolean = '/true|false/';
        self::$seperator = '/,/';
        self::$pipe = '/\\|/';
        self::$operator = '/\\s?(>|<|>=|<=|!=|==|!|and |not |or )\\s?/i';
        self::$number = '/\\d+(\\.\\d*)?/';
        self::$name = '/[a-zA-Z][a-zA-Z0-9-_]*(?:\\.[a-zA-Z_0-9][a-zA-Z0-9_-]*)*/';
        self::$string = '/(?:
                "([^"\\\\]*(?:\\\\.[^"\\\\]*)*)" |   # Double Quote string   
                \'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\' # Single Quote String
        )/xsm';
        self::$i18n_string = "/_\\({$r(self::$string)}\\) | {$r(self::$string)}/xsm";
        self::$named_args = "{\r\n            ({$r(self::$name)})(?:{$r(self::$whitespace)})?\r\n            : \r\n            (?:{$r(self::$whitespace)})?({$r(self::$i18n_string)}|{$r(self::$number)}|{$r(self::$name)})\r\n        }x";
    }
}
H2O_RE::init();
class ArgumentLexer
{
    private $source;
    private $match;
    private $pos = 0, $fpos, $eos;
    private $operator_map = array('!' => 'not', '!=' => 'ne', '==' => 'eq', '>' => 'gt', '<' => 'lt', '<=' => 'le', '>=' => 'ge');
    function __construct($source, $fpos = 0)
    {
        if (!is_null($source)) {
            $this->source = $source;
        }
        $this->fpos = $fpos;
    }
    function parse()
    {