-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathArgList.java
More file actions
33 lines (30 loc) · 754 Bytes
/
ArgList.java
File metadata and controls
33 lines (30 loc) · 754 Bytes
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
import java.util.ArrayList;
class ArgList extends ExampleToken implements Token
{
ArgList argList;
Arg arg;
public ArgList(Arg a, ArgList al)
{
arg = a;
argList = al;
}
public String toString(int t)
{
return arg.toString(t) + (argList != null ? " " + argList.toString(t) : "");
}
public ArrayList<Pair<String,FullType>> typeCheck() throws ExampleException
{
ArrayList<Pair<String,FullType>> list = new ArrayList<Pair<String,FullType>>();
list.add(arg.typeCheck());
if (argList != null)
list.addAll(argList.typeCheck());
return list;
}
public void execute(ArrayList<Object> list)
{
arg.execute(list.get(0));
list.remove(0);
if (argList != null)
argList.execute(list);
}
}