LazyRecord\TableParser\SqliteTableDefinitionParser::tryParseTypePrecision PHP Method

tryParseTypePrecision() protected method

protected tryParseTypePrecision ( )
    protected function tryParseTypePrecision()
    {
        $c = $this->str[$this->p];
        if ($c == '(') {
            if (preg_match('/\\( \\s* (\\d+) \\s* , \\s* (\\d+) \\s* \\)/x', $this->str, $matches, 0, $this->p)) {
                $this->p += strlen($matches[0]);
                return new Token('precision', [intval($matches[1]), intval($matches[2])]);
            } elseif (preg_match('/\\(  \\s* (\\d+) \\s* \\)/x', $this->str, $matches, 0, $this->p)) {
                $this->p += strlen($matches[0]);
                return new Token('precision', [intval($matches[1])]);
            } else {
                throw new Exception('Invalid precision syntax');
            }
        }
        return;
    }