Ejemplo n.º 1
0
        /// <summary>
        /// Creates and parameterizes and exception to be thrown by the name resolver.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        protected Exception CreateException(string message, Token token)
        {
            string msg;

            msg = String.Format(message, null, token.Line + 1, token.Pos + 1);

            NameResolverException ex = new NameResolverException(msg);
            ex.Token = token;

            return ex;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates and parameterizes and exception to be thrown by the name resolver.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="innerException"></param>
        /// <param name="objectName"></param>
        /// <param name="node"></param>
        /// <returns></returns>
        protected Exception CreateException(string message, Exception innerException, string objectName, Node node)
        {
            string msg;
            var id = node.FindDescendantRecursive<Identifier>();

            if (id != null)
            {
                msg = String.Format(message, objectName, id.Line + 1, id.Col + 1);
            }
            else
            {
                msg = String.Format(message, objectName, "?", "?");
            }

            NameResolverException ex = new NameResolverException(msg, innerException);
            ex.Token = id;

            return ex;
        }