protected function consume($token, $typeName) { if (($p2 = stripos($this->str, $token, $this->p)) !== false && $p2 == $this->p) { $this->p += strlen($token); return new Token($typeName, $token); } return false; }