Lexer.php
public function dump($input)
    {

        foreach ($this->lex($input) as $token) {

            $type = $token['type'];
            $line = $token['line'];
            $offset = $token['offset'];
            unset($token['type'], $token['line'], $token['offset']);

            echo "[$type($line:$offset)";
            $vals = implode(', ', array_map(function ($key, $value) {

                return "$key=$value";
            }, array_keys($token), $token));

            if (!empty($vals))
                echo " $vals";

            echo ']';

            if ($type === 'newLine')
                echo "\n";
        }
    }
public function dump($input)
    {

        foreach ($this->lex($input) as $token) {

            $type = $token['type'];
            $line = $token['line'];
            $offset = $token['offset'];
            unset($token['type'], $token['line'], $token['offset']);

            echo "[$type($line:$offset)";
            $vals = implode(', ', array_map(function ($key, $value) {

                return "$key=$value";
            }, array_keys($token), $token));

            if (!empty($vals))
                echo " $vals";

            echo ']';

            if ($type === 'newLine')
                echo "\n";
        }
    }
public function dump ( $ input ) { foreach ( $ this -> lex ( $ input ) as $ token ) { $ type = $ token [ 'type' ] ; $ line = $ token [ 'line' ] ; $ offset = $ token [ 'offset' ] ; unset ( $ token [ 'type' ] , $ token [ 'line' ] , $ token [ 'offset' ] ) ; echo "[$type($line:$offset)" ; $ vals = implode ( ', ' , array_map ( function ( $ key , $ value ) { return "$key=$value" ; } , array_keys ( $ token ) , $ token ) ) ; if ( ! empty ( $ vals ) ) echo " $vals" ; echo ']' ; if ( $ type === 'newLine' ) echo "\n" ; } }
Dumps jade-input into a set of string-represented tokens.

This makes debugging the lexer easier.

@param string $input the jade input to dump the tokens of
Dumps jade - input into a set of string - represented tokens .