-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathAST.java
More file actions
39 lines (33 loc) · 1.05 KB
/
AST.java
File metadata and controls
39 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.python.antlr;
import org.python.core.Py;
import org.python.core.PyException;
import org.python.core.PyObject;
import org.python.core.PyType;
import org.python.core.Untraversable;
import org.python.expose.ExposedType;
@Untraversable
@ExposedType(name = "_ast.AST", base = PyObject.class)
public class AST extends PyObject {
public static final PyType TYPE = PyType.fromClass(AST.class);
public AST() {
}
public AST(PyType objtype) {
super(objtype);
}
public static boolean check(int nargs, int expected, boolean takesZeroArgs) {
if (nargs == expected) {
return true;
}
if (takesZeroArgs && nargs == 0) {
return true;
}
return false;
}
public static PyException unexpectedCall(int expected, String name) {
String message = " constructor takes 0 positional arguments";
if (expected != 0) {
message = " constructor takes either 0 or " + expected + " arguments";
}
return Py.TypeError(name + message);
}
}