01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15: package org.griphyn.vdl.parser;
16:
17: import java.io.*;
18:
19: /**
20: * This class is used to signal errors while scanning or parsing.
21: * @see VDLtScanner
22: * @see VDLtParser
23: */
24: public class VDLtException extends java.lang.RuntimeException {
25: /**
26: * Contains the current line number when the exception was thrown.
27: */
28: private int m_lineno;
29:
30: /**
31: * Constructs a message that contains a line number prefix.
32: * @param lineno is the line number to prefix
33: * @param message is the message to attach when throwing.
34: */
35: public VDLtException(int lineno, String message) {
36: super ("line " + lineno + ": " + message);
37: this .m_lineno = lineno;
38: }
39:
40: /**
41: * Obtains the current line number as of the throw.
42: * @return a line number.
43: */
44: public int getLineNumber() {
45: return this.m_lineno;
46: }
47: }
|