view trunk/src/dil/Information.d @ 532:50e64bab9c7a

Renamed InformationManager to InfoManager.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Mon, 17 Dec 2007 16:10:08 +0100
parents 8f86bb9ef715
children 7173ece1b696
line wrap: on
line source

/++
  Author: Aziz Köksal
  License: GPL3
+/
module dil.Information;

import dil.Messages;
import common;

public import dil.Location;

class Information
{

}

class InfoManager
{
  Information[] info;

  void opCatAssign(Information info)
  {
    this.info ~= info;
  }
}

class Problem : Information
{
  Location location;
  uint column; /// Cache variable for column.
  string message;

  this(Location location, string message)
  {
    assert(location !is null);
    this.location = location;
    this.message = message;
  }

  string getMsg()
  {
    return this.message;
  }

  /// Returns the line of code.
  size_t loc()
  {
    return location.lineNum;
  }

  /// Returns the column.
  size_t col()
  {
    if (column == 0)
      column = location.calculateColumn();
    return column;
  }

  /// Returns the file path.
  string filePath()
  {
    return location.filePath;
  }
}

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
{
  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);
  }
}