view trunk/src/dil/Information.d @ 744:7173ece1b696

Wrapped some macro functions inside struct MacroExpander. Warning messages from the macro expansion pass are collected now. Tidied up predefined.ddoc a bit, and added some macros. Added two messages to struct MSG. Added another opCatAssign to class InfoManager.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 09 Feb 2008 22:54:31 +0100
parents 50e64bab9c7a
children 9c47f377ca0b
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;
  }

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