Neos\Eel\EelParser::match_Expression PHP Метод

match_Expression() публичный Метод

public match_Expression ( $stack = [] )
    function match_Expression($stack = array())
    {
        $matchrule = "Expression";
        $result = $this->construct($matchrule, $matchrule, null);
        $matcher = 'match_' . 'ConditionalExpression';
        $key = $matcher;
        $pos = $this->pos;
        $subres = $this->packhas($key, $pos) ? $this->packread($key, $pos) : $this->packwrite($key, $pos, $this->{$matcher}(array_merge($stack, array($result))));
        if ($subres !== FALSE) {
            $this->store($result, $subres, "exp");
            return $this->finalise($result);
        } else {
            return FALSE;
        }
    }

Usage Example

 /**
  * Check if $value is valid. If it is not valid, needs to add an error
  * to Result.
  *
  * @param mixed $value
  * @return void
  * @api
  */
 protected function isValid($value)
 {
     $parser = new EelParser($value);
     $result = $parser->match_Expression();
     if ($result === false) {
         $this->addError('Expression "%s" could not be parsed.', 1421940748, [$value]);
     } elseif ($parser->pos !== strlen($value)) {
         $this->addError('Expression "%s" could not be parsed. Error starting at character %d: "%s".', 1421940760, [$value, $parser->pos, substr($value, $parser->pos)]);
     }
 }