QuackCompiler\Parser\Grammar::_letStmt PHP Method

_letStmt() public method

public _letStmt ( )
    public function _letStmt()
    {
        $this->parser->match(Tag::T_LET);
        $definitions = [];
        // First definition is required (without comma)
        // I could just use a goto, but, Satan would want my soul...
        $name = $this->identifier();
        if ($this->parser->consumeIf(':-')) {
            $value = $this->_expr();
            $definitions[] = [$name, $value];
        } else {
            $definitions[] = [$name, null];
        }
        while ($this->parser->consumeIf(',')) {
            $name = $this->identifier();
            if ($this->parser->consumeIf(':-')) {
                $value = $this->_expr();
                $definitions[] = [$name, $value];
            } else {
                $definitions[] = [$name, null];
            }
        }
        return new LetStmt($definitions);
    }