示例#1
0
        /// <summary>
        /// Creates a new error <see cref="Message"/> with the specified text.
        /// </summary>
        /// <param name="text">The message text.</param>
        /// <param name="range">The source range to which the message applies.</param>
        /// <returns>The created message.</returns>
        public static Message Error(string text, SourceRange range)
        {
            #region Contract
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }
            #endregion

            return(new Message(MessageSeverity.Error, text, range));
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Token{TType}"/> class.
        /// </summary>
        /// <param name="value">The token value.</param>
        /// <param name="type">The token type.</param>
        /// <param name="range">The token range; or an empty range for a virtual token.</param>
        public Token([CanBeNull] string value, TType type, SourceRange range)
        {
            #region Contract
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            #endregion

            this.Value = value;
            this.Type  = type;
            this.Range = range;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Message"/> class.
        /// </summary>
        /// <param name="severity">The message severity.</param>
        /// <param name="text">The message text.</param>
        /// <param name="range">The source range; or an empty range.</param>
        public Message(MessageSeverity severity, string text, SourceRange range)
        {
            #region Contract
            if (!Enum.IsDefined(typeof(MessageSeverity), severity))
            {
                throw new EnumArgumentException(nameof(severity), (int)severity, typeof(MessageSeverity));
            }
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }
            #endregion

            this.Severity = severity;
            this.Text     = text;
            this.Range    = range;
        }
示例#4
0
 /// <inheritdoc />
 public bool Equals(SourceRange other)
 {
     return(this.Start == other.Start &&
            this.End == other.End);
 }