Mozilla/mozilla/js/js2/java/Interpreter.java
rogerl%netscape.com 382f120d73 Changes for try/catch handling
git-svn-id: svn://10.0.0.236/trunk@27801 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-16 02:54:56 +00:00

35 lines
731 B
Java

public class Interpreter {
void executeScript(Node node)
{
Node child = node.getFirstChild();
while (child != null) {
if (child.getType() != TokenStream.FUNCTION)
executeCode(child);
child = child.getNextSibling();
}
}
void executeCode(Node top)
{
PostorderNodeIterator ni = new PostorderNodeIterator(top);
JSStack theStack = new JSStack();
Node n = ni.nextNode();
while (n != null) {
ni = n.execute(theStack, ni);
n = ni.nextNode();
}
while (!theStack.isEmpty()) {
System.out.println("Stack Slot contains " + theStack.pop());
}
}
}