Beispiel #1
0
 public virtual void Print(AbstractMessage msg, bool showFullPath)
 {
     if (msg.IsWarning)
     {
         ++WarningsCount;
     }
     else
     {
         ++ErrorsCount;
     }
 }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            AbstractMessage msg = obj as AbstractMessage;

            if (msg == null)
            {
                return(false);
            }

            return(code == msg.code && location.Equals(msg.location) && message == msg.message);
        }
Beispiel #3
0
        public override void Print(AbstractMessage msg, bool showFullPath)
        {
            //
            // This line is useful when debugging recorded messages
            //
            // Console.WriteLine ("RECORDING: {0}", msg.Text);

            if (session_messages == null)
            {
                session_messages = new List <AbstractMessage> ();
            }

            session_messages.Add(msg);

            this.showFullPaths = showFullPath;
            base.Print(msg, showFullPath);
        }
Beispiel #4
0
        protected void Print(AbstractMessage msg, TextWriter output, bool showFullPath)
        {
            StringBuilder txt = new StringBuilder();

            if (!msg.Location.IsNull)
            {
                if (showFullPath)
                {
                    txt.Append(msg.Location.ToStringFullName());
                }
                else
                {
                    txt.Append(msg.Location.ToString());
                }

                txt.Append(" ");
            }

            txt.AppendFormat("{0} CS{1:0000}: {2}", msg.MessageType, msg.Code, msg.Text);

            if (!msg.IsWarning)
            {
                output.WriteLine(FormatText(txt.ToString()));
            }
            else
            {
                output.WriteLine(txt.ToString());
            }

            if (msg.RelatedSymbols != null)
            {
                foreach (string s in msg.RelatedSymbols)
                {
                    output.WriteLine(s + msg.MessageType + ")");
                }
            }
        }
Beispiel #5
0
 public override void Print(AbstractMessage msg, bool showFullPath)
 {
     Print(msg, writer, showFullPath);
     base.Print(msg, showFullPath);
 }
Beispiel #6
0
        public void EndSession()
        {
            if (session_messages == null)
            {
                return;
            }

            //
            // Handles the first session
            //
            if (common_messages == null)
            {
                common_messages  = new List <AbstractMessage> (session_messages);
                merged_messages  = session_messages;
                session_messages = null;
                return;
            }

            //
            // Store common messages if any
            //
            for (int i = 0; i < common_messages.Count; ++i)
            {
                AbstractMessage cmsg             = common_messages[i];
                bool            common_msg_found = false;
                foreach (AbstractMessage msg in session_messages)
                {
                    if (cmsg.Equals(msg))
                    {
                        common_msg_found = true;
                        break;
                    }
                }

                if (!common_msg_found)
                {
                    common_messages.RemoveAt(i);
                }
            }

            //
            // Merge session and previous messages
            //
            for (int i = 0; i < session_messages.Count; ++i)
            {
                AbstractMessage msg       = session_messages[i];
                bool            msg_found = false;
                for (int ii = 0; ii < merged_messages.Count; ++ii)
                {
                    if (msg.Equals(merged_messages[ii]))
                    {
                        msg_found = true;
                        break;
                    }
                }

                if (!msg_found)
                {
                    merged_messages.Add(msg);
                }
            }
        }
Beispiel #7
0
 public ErrorMessage(AbstractMessage aMsg)
     : base(aMsg)
 {
 }
Beispiel #8
0
		public override void Print (AbstractMessage msg, bool showFullPath)
		{
			//
			// This line is useful when debugging recorded messages
			//
			// Console.WriteLine ("RECORDING: {0}", msg.Text);

			if (session_messages == null)
				session_messages = new List<AbstractMessage> ();

			session_messages.Add (msg);

			this.showFullPaths = showFullPath;
			base.Print (msg, showFullPath);
		}
Beispiel #9
0
		public override void Print (AbstractMessage msg, bool showFullPath)
		{
			Print (msg, writer, showFullPath);
			base.Print (msg, showFullPath);
		}
Beispiel #10
0
		protected void Print (AbstractMessage msg, TextWriter output, bool showFullPath)
		{
			StringBuilder txt = new StringBuilder ();
			if (!msg.Location.IsNull) {
				if (showFullPath)
					txt.Append (msg.Location.ToStringFullName ());
				else
					txt.Append (msg.Location.ToString ());

				txt.Append (" ");
			}

			txt.AppendFormat ("{0} CS{1:0000}: {2}", msg.MessageType, msg.Code, msg.Text);

			if (!msg.IsWarning)
				output.WriteLine (FormatText (txt.ToString ()));
			else
				output.WriteLine (txt.ToString ());

			if (msg.RelatedSymbols != null) {
				foreach (string s in msg.RelatedSymbols)
					output.WriteLine (s + msg.MessageType + ")");
			}
		}
Beispiel #11
0
		public virtual void Print (AbstractMessage msg, bool showFullPath)
		{
			if (msg.IsWarning) {
				++WarningsCount;
			} else {
				++ErrorsCount;
			}
		}
Beispiel #12
0
		public ErrorMessage (AbstractMessage aMsg)
			: base (aMsg)
		{
		}
Beispiel #13
0
		protected AbstractMessage (AbstractMessage aMsg)
		{
			this.code = aMsg.code;
			this.location = aMsg.location;
			this.message = aMsg.message;
			this.extra_info = aMsg.extra_info;
		}
Beispiel #14
0
			public override void Print(AbstractMessage msg, bool showFullPath)
			{
				base.Print(msg, showFullPath);
				var newError = new Error(msg.IsWarning ? ErrorType.Warning : ErrorType.Error, msg.Text, new DomRegion(fileName, msg.Location.Row, msg.Location.Column));
				Errors.Add(newError);
			}