public function throwException($message, $code = 0, TokenInterface $relatedToken = null, $previous = null)
    {
        $pattern = "Failed to parse: %s \nNear: %s \nLine: %s \nOffset: %s";

        $lexer = $this->parser->getLexer();
        //This will basically check for a source location for this Node. The process is like:
        //- If there's a related token, we use the cloned token's source location
        //- If not, we check if we're still lexing right now, so we can assume the node is somewhere
        //  around the current lexing location, we get it from the lexer state directly
        //- If none is found, we create an empty source location
        $location = $relatedToken && $relatedToken->getSourceLocation()
            ? clone $relatedToken->getSourceLocation()
            : ($lexer->hasState()
                ? $lexer->getState()->createCurrentSourceLocation()
                : new SourceLocation(null, 0, 0)
            );

        $near = $lexer->hasState()
            ? $lexer->getState()->getReader()->peek(20)
            : '[No clue]';

        //We know where it occured!
        $path = $location->getPath();

        if ($path) {
            $pattern .= "\nPath: $path";
        }

        throw new ParserException(
            $location,
            vsprintf($pattern, [
                $message,
                $near,
                $location->getLine(),
                $location->getOffset(),
            ]),
            $code,
            $relatedToken,
            $previous
        );
    }