PhpPeg\Rule::parse_rule PHP Method

parse_rule() public method

* Manual parsing, because we can't bootstrap ourselves yet
public parse_rule ( )
    function parse_rule()
    {
        $rule = trim($this->rule);
        /* If this is a regex end-token, just mark it and return */
        if (substr($rule, 0, 1) == '/') {
            $this->parsed = new TokenRegex($rule);
        } else {
            $tokens = [];
            $this->tokenize($rule, $tokens);
            $this->parsed = count($tokens) == 1 ? array_pop($tokens) : new TokenSequence($tokens);
        }
    }