summaryrefslogtreecommitdiff
path: root/Shenanigans/src/org/archphantom/shenanigans/elements/Program.java
blob: ea133746696179e24fad83be39a17691701a8ed9 (plain)
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
package org.archphantom.shenanigans.elements;
import java.io.Serializable;
import java.util.Hashtable;

import org.archphantom.shenanigans.elements.expressions.statements.NamespaceCall;
import org.archphantom.shenanigans.elements.values.Namespace;
import org.archphantom.shenanigans.elements.variables.VarTable;

public class Program implements Runnable, Serializable {
	private static final long serialVersionUID = 4309390632410676282L;
	private VarTable globalVars;
	private Hashtable<String, Namespace> namespaces;
	
	public Program (Hashtable<String, Namespace> namespaces) {
		this.globalVars = new VarTable();
		this.namespaces = namespaces;
	}
	
	public Namespace getNamespace (String name) {
		return namespaces.get(name.toLowerCase());
	}
	
	public VarTable getGlobalVars () {
		return globalVars;
	}
	
	public void run () {
		new NamespaceCall("main").evaluate(globalVars, this);
	}
	
}