1(**************************************************************************** 2*Copyright 2008 3* Andrew Gacek, Steven Holte, Gopalan Nadathur, Xiaochu Qi, Zach Snow 4****************************************************************************) 5(**************************************************************************** 6* This file is part of Teyjus. 7* 8* Teyjus is free software: you can redistribute it and/or modify 9* it under the terms of the GNU General Public License as published by 10* the Free Software Foundation, either version 3 of the License, or 11* (at your option) any later version. 12* 13* Teyjus is distributed in the hope that it will be useful, 14* but WITHOUT ANY WARRANTY; without even the implied warranty of 15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16* GNU General Public License for more details. 17* 18* You should have received a copy of the GNU General Public License 19* along with Teyjus. If not, see <http://www.gnu.org/licenses/>. 20****************************************************************************) 21(********************************************************************** 22*Errormsg Module: 23* In the short run this is used simply to output meaningful error 24* messages with respect to character and line position. In the long 25* run this will eventually allow for such things as specifying warnings 26* to ignore and the like. 27**********************************************************************) 28exception InternalError 29 30type pos = Lexing.position 31 32(* none: indicates a lack of error information. *) 33val none : pos 34 35(********************************************************************** 36*string_of_pos: 37* Produces a human-readable representation of a position. 38**********************************************************************) 39val string_of_pos : pos -> string 40 41(********************************************************************** 42*anyErrors: 43* This flag is set to true any time an error is encountered. It remains 44* true until it is manually reset. 45**********************************************************************) 46val anyErrors : bool ref 47 48(********************************************************************** 49*errorsEnabled/warningsEnabled/loggingEnabled: 50* These flags specify whether the various output modes are enabled. 51**********************************************************************) 52val errorsEnabled : bool ref 53val warningsEnabled : bool ref 54val loggingEnabled : bool ref 55 56(********************************************************************** 57*warningsAsErrors: 58* This flag causes calls to warning to be forwarded to error. 59**********************************************************************) 60val warningsAsErrors : bool ref 61 62(********************************************************************** 63*info: 64* Given an error string and information to add to the error string, 65* produces a new error string with all necessary information. Amounts 66* to including tabs in the relevant places. 67**********************************************************************) 68val info : string -> string 69 70(********************************************************************** 71*log: 72* Outputs logging information. Can be enabled/disabled with the 73* loggingEnabled flag. 74**********************************************************************) 75val log : pos -> string -> unit 76 77(********************************************************************** 78*warning: 79* Outputs warning information. Can be enabled/disabled with the 80* warningEnabled flag. 81**********************************************************************) 82val warning : pos -> string -> unit 83 84(********************************************************************** 85*error: 86* Outputs error information. Can be enabled/disabled with the 87* errorsEnabled flag. 88**********************************************************************) 89val error : pos -> string -> unit 90 91(********************************************************************** 92*impossible: 93* Outputs internal error information. Cannot be disabled. Raises 94* InternalError. 95**********************************************************************) 96val impossible : pos -> string -> 'a 97 98(********************************************************************** 99*see: 100* Given a position and an information string, returns a string with 101* the relevant position information included. 102**********************************************************************) 103val see : pos -> string -> string 104