public function __construct($str) { $pos = 0; $state = 'stateNormal'; while (true) { $pos = $this->{$state}($str, $pos, $state); if ($pos === false) { break; } } return false; }