Phlexy\Lexer\TestAbstract::statelessTestsToStateful PHP Method

statelessTestsToStateful() protected method

protected statelessTestsToStateful ( array $tests )
$tests array
    protected function statelessTestsToStateful(array $tests)
    {
        foreach ($tests as &$test) {
            // just put all rules into a single state
            $test[0] = array('INITIAL' => $test[0]);
            // for the capturing group tests the stateful output is different because
            // the capturing groups are not returned, so this has to be adjusted here
            foreach ($test[2] as &$output) {
                foreach ($output as &$token) {
                    $token = array_slice($token, 0, 3);
                }
            }
        }
        return $tests;
    }