KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > groovy > syntax > RuntimeParserException


1 package org.codehaus.groovy.syntax;
2
3 import groovy.lang.GroovyRuntimeException;
4
5 import org.codehaus.groovy.ast.ASTNode;
6 import org.codehaus.groovy.syntax.SyntaxException;
7
8 /**
9  * A helper class to allow parser exceptions to be thrown anywhere in the code.
10  * Should be replaced when no longer required.
11  *
12  * @author <a HREF="mailto:james@coredevelopers.net">James Strachan</a>
13  * @version $Revision: 1.1 $
14  */

15 public class RuntimeParserException extends GroovyRuntimeException {
16     
17     public RuntimeParserException(String JavaDoc message, ASTNode node) {
18         super(message + ".\nNode: " + node.getClass().getName(), node);
19     }
20
21     public void throwParserException() throws SyntaxException {
22         throw new SyntaxException(getMessage(), getNode().getLineNumber(), getNode().getColumnNumber());
23     }
24     
25     /*
26     private Token token;
27
28     public RuntimeParserException(String message, Token token) {
29         super(message);
30         this.token = token;
31     }
32
33     public Token getToken() {
34         return token;
35     }
36
37     public void throwParserException() throws SyntaxException {
38         throw new TokenException(getMessage(), token);
39     }
40     */

41 }
42
Popular Tags