/// <summary> Create a ParseErrorException with the given ParseException.
        ///
        /// </summary>
        /// <param name="pex">the parsing exception
        /// </param>
        /// <since> 1.5
        /// </since>
        public ParseErrorException(VelocityException pex)
            : base(pex.Message)
        {
            // Don't use a second C'tor, TemplateParseException is a subclass of
            // ParseException...
            if (pex is IExtendedParseException)
            {
                IExtendedParseException xpex = (IExtendedParseException)pex;

                columnNumber = xpex.ColumnNumber;
                lineNumber   = xpex.LineNumber;
                templateName = xpex.TemplateName;
            }
            else if (pex.GetType().Equals(typeof(ParseException)))
            {
                ParseException pex2 = (ParseException)pex.InnerException;

                if (pex2.currentToken != null && pex2.currentToken.Next != null)
                {
                    columnNumber = pex2.currentToken.Next.BeginColumn;
                    lineNumber   = pex2.currentToken.Next.BeginLine;
                }
            }
        }
        /// <summary> Create a ParseErrorException with the given ParseException.
        ///
        /// </summary>
        /// <param name="pex">the parsing exception
        /// </param>
        /// <since> 1.5
        /// </since>
        public ParseErrorException(ParseException pex)
            : base(pex.Message)
        {
            // Don't use a second C'tor, TemplateParseException is a subclass of
            // ParseException...
            if (pex is IExtendedParseException)
            {
                IExtendedParseException xpex = (IExtendedParseException)pex;

                columnNumber = xpex.ColumnNumber;
                lineNumber   = xpex.LineNumber;
                templateName = xpex.TemplateName;
            }
            else
            {
                //  ugly, ugly, ugly...

                if (pex.currentToken != null && pex.currentToken.Next != null)
                {
                    columnNumber = pex.currentToken.Next.BeginColumn;
                    lineNumber   = pex.currentToken.Next.BeginLine;
                }
            }
        }