KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > core > PySyntaxError


1 // Copyright (c) Corporation for National Research Initiatives
2
package org.python.core;
3
4 /**
5  * A convience class for creating Syntax errors. Note that the
6  * syntax error is still taken from Py.SyntaxError.
7  * <p>
8  * Generally subclassing from PyException is not the right way
9  * of creating new exception classes.
10  */

11
12 public class PySyntaxError extends PyException {
13     int lineno, column;
14     String JavaDoc text;
15     String JavaDoc filename;
16
17
18     public PySyntaxError(String JavaDoc s, int line, int column, String JavaDoc text,
19                          String JavaDoc filename)
20     {
21         super(Py.SyntaxError);
22         PyObject[] tmp = new PyObject[] {
23             new PyString(filename), new PyInteger(line),
24             new PyInteger(column), new PyString(text)
25         };
26
27         this.value = new PyTuple(new PyObject[] {
28             new PyString(s), new PyTuple(tmp)
29         });
30
31         this.lineno = line;
32         this.column = column;
33         this.text = text;
34         this.filename = filename;
35     }
36 }
37
Popular Tags