*** empty log message ***
1 parent 79edc5c commit c613b552945096c10431b3e4f0a2149968390db4
@glproj03 glproj03 authored on 20 Nov 2005
Showing 1 changed file
View
52
sources/zweic/Report.scala 0 → 100755
/* zweic -- a compiler for zwei
*
* Stephane Micheloud & LAMP
*
* $Id$
*/
 
package zweic;
 
 
/** This class provides functionality for printing error messages.
*/
object Report {
 
/** Number of errors.
*/
var errors: Int = 0;
 
/** Prints out an error message.
*/
def error(message: String): Unit = {
errors = errors + 1;
System.err.println(message);
}
 
/** Prints out an error message.
*/
def error(position: Int, message: String): Unit = {
errors = errors + 1;
print(position, message);
}
 
/** Prints out an error message and stops the program execution.
*/
def fail(message: String): Unit = {
error(message);
System.exit(-1);
}
 
/** Prints out an error message and stops the program execution.
*/
def fail(position: Int, message: String): Unit = {
error(position, message);
System.exit(-1);
}
 
/** Imprime la position et le message passés en argument. */
private def print(pos: Int, message: String): Unit =
System.err.println(Position.toString(pos) + ": " + message);
 
}