src/Console/ExceptionPrinter.php
public function printParseException(ParseException $e) : string
    {
        $syntax = $e->syntax();
        $error  = '';
        if ($syntax instanceof ObjectSyntax) {
            $i = $e->extra();
            if ($i['type'] == 'invalid-field')
                $error = "{$i['field']} is invalid!";
            if ($i['type'] == 'missing-field')
                $error = "{$i['field']} is missing!";
            if ($i['type'] == 'additional-items') {
                $items = implode($syntax->separator(), $i['items']);
                $error = "additional items {$items}";
            }
        }
        $syntax = $this->printSyntax($e->syntax());

        $output = "<reset>Failed to parse <warn>'{$e->input()}'</warn> as <info>{$syntax}</info>";
        if ('' != $error)
            $output .= " <error>{$error}</error>";

        $previous = $e->previous();
        if ($previous) {
            $output .= '<br>' . $this->printParseException($previous);
        }

        return $output;
    }
public function printParseException(ParseException $e) : string
    {
        $syntax = $e->syntax();
        $error  = '';
        if ($syntax instanceof ObjectSyntax) {
            $i = $e->extra();
            if ($i['type'] == 'invalid-field')
                $error = "{$i['field']} is invalid!";
            if ($i['type'] == 'missing-field')
                $error = "{$i['field']} is missing!";
            if ($i['type'] == 'additional-items') {
                $items = implode($syntax->separator(), $i['items']);
                $error = "additional items {$items}";
            }
        }
        $syntax = $this->printSyntax($e->syntax());

        $output = "<reset>Failed to parse <warn>'{$e->input()}'</warn> as <info>{$syntax}</info>";
        if ('' != $error)
            $output .= " <error>{$error}</error>";

        $previous = $e->previous();
        if ($previous) {
            $output .= '<br>' . $this->printParseException($previous);
        }

        return $output;
    }
public function printParseException ( ParseException $ e ) : string { $ syntax = $ e -> syntax ( ) ; $ error = '' ; if ( $ syntax instanceof ObjectSyntax ) { $ i = $ e -> extra ( ) ; if ( $ i [ 'type' ] == 'invalid-field' ) $ error = "{$i['field']} is invalid!" ; if ( $ i [ 'type' ] == 'missing-field' ) $ error = "{$i['field']} is missing!" ; if ( $ i [ 'type' ] == 'additional-items' ) { $ items = implode ( $ syntax -> separator ( ) , $ i [ 'items' ] ) ; $ error = "additional items {$items}" ; } } $ syntax = $ this -> printSyntax ( $ e -> syntax ( ) ) ; $ output = "<reset>Failed to parse <warn>'{$e->input()}'</warn> as <info>{$syntax}</info>" ; if ( '' != $ error ) $ output .= " <error>{$error}</error>" ; $ previous = $ e -> previous ( ) ; if ( $ previous ) { $ output .= '<br>' . $ this -> printParseException ( $ previous ) ; } return $ output ; }
Converts a parse exception to a string.

@param  Tarsana\Syntax\Exceptions\ParseException $e
@return string
Converts a parse exception to a string .