Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) loc1, loc2, reference: CompilerObjects.Location; longmsg: Streams.Stream; END; VAR error: Events.EventType;
PROCEDURE Raise(errors: RelatedEvents.Object; at: CompilerObjects.Location; message: ARRAY OF CHAR);
PROCEDURE Open(VAR s: Streams.Stream); PROCEDURE At1(s: Streams.Stream; location: CompilerObjects.Location); PROCEDURE At2(s: Streams.Stream; location: CompilerObjects.Location); PROCEDURE Ref(s: Streams.Stream; location: CompilerObjects.Location); PROCEDURE AtObject1(s: Streams.Stream; object: CompilerObjects.Object); PROCEDURE AtObject2(s: Streams.Stream; object: CompilerObjects.Object); PROCEDURE RefObject(s: Streams.Stream; object: CompilerObjects.Object); PROCEDURE Close(s: Streams.Stream; errors: RelatedEvents.Object);
PROCEDURE GetSortedErrors(errors: RelatedEvents.Object; VAR it: Iterators.Iterator);
As all error events generated by CompilerErrors are passed to RelatedEvents, an error object is needed that collects all error events, i.e. RelatedEvents.QueueEvents must be called for it. This object may be an otherwise empty object or any other extension of RelatedEvents.Object that is permitted to receive other error events as well.
Error events are created in a short and simple way by Raise, or, in case of more elaborate messages, by Open, various location referencing procedures, and Close. Finally, GetSortedErrors may be called to extract all compilation error events from errors (but leaving all other events), sorted by their primary location.
All error events generated by CompilerErrors have following components:
Raise creates a simple error event referencing just one location and giving a message.
Open creates a stream where the error message may be written to and which, in addition, supports following operations: At1, At2, and Ref set the primary, secondary, and reference location, respectively. AtObject1, AtObject2, and RefObject work similarly but take the location from object.loc instead. Note that either At1 or AtObject1 must be called. If the error message has been printed to s and all locations are defined, Close generates the error event and relates it to errors.
GetSortedErrors removes all error events that are extensions of CompilerErrors.ErrorEvent from errors and returns them in sorted order (by their primary location) through it.
Oberon || Library || Module Index || Search Engine || Definition || Module