diff trunk/src/dil/Information.d @ 514:6ddff941862a

Added new error classes.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 14 Dec 2007 19:32:07 +0100
parents 47be6bfe39cd
children 8f86bb9ef715
line wrap: on
line diff
--- a/trunk/src/dil/Information.d	Fri Dec 14 19:08:21 2007 +0100
+++ b/trunk/src/dil/Information.d	Fri Dec 14 19:32:07 2007 +0100
@@ -3,31 +3,31 @@
   License: GPL3
 +/
 module dil.Information;
+
 import dil.Messages;
 import common;
 
 public import dil.Location;
 
-enum InfoType
-{
-  Lexer,
-  Parser,
-  Semantic
-}
-
 class Information
 {
-  MID id;
-  InfoType type;
+
+}
+
+class InformationManager
+{
+  Information[] info;
+}
+
+class Problem : Information
+{
   Location location;
-  uint column;
+  uint column; /// Cache variable for column.
   string message;
 
-  this(InfoType type, MID id, Location location, string message)
+  this(Location location, string message)
   {
     assert(location !is null);
-    this.id = id;
-    this.type = type;
     this.location = location;
     this.message = message;
   }
@@ -37,11 +37,13 @@
     return this.message;
   }
 
+  /// Returns the line of code.
   size_t loc()
   {
     return location.lineNum;
   }
 
+  /// Returns the column.
   size_t col()
   {
     if (column == 0)
@@ -49,13 +51,49 @@
     return column;
   }
 
+  /// Returns the file path.
   string filePath()
   {
     return location.filePath;
   }
 }
 
-class InformationManager
+class Warning : Problem
+{
+  this(Location location, string message)
+  {
+    super(location, message);
+  }
+}
+
+class Error : Problem
+{
+  this(Location location, string message)
+  {
+    super(location, message);
+  }
+}
+
+class LexerError : Error
 {
-  Information[] info;
+  this(Location location, string message)
+  {
+    super(location, message);
+  }
 }
+
+class ParserError : Error
+{
+  this(Location location, string message)
+  {
+    super(location, message);
+  }
+}
+
+class SemanticError : Error
+{
+  this(Location location, string message)
+  {
+    super(location, message);
+  }
+}