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 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 }