Пример #1
0
  public void print(
      final PrintStream stream,
      final int indent,
      Value[] tests,
      Integer[] offsets,
      int defaultIndex) {
    Iterator it;

    Interpreter.indentLine(stream, indent);
    stream.println("<SCOPE>");

    Interpreter.indentLine(stream, indent + 1);
    stream.println("<VARIABLES>");

    it = this.getVariables();
    while (it.hasNext()) {
      Variable currentVar = (Variable) it.next();
      currentVar.print(stream, indent + 2);
    }

    Interpreter.indentLine(stream, indent + 1);
    stream.println("<COMMANDS>");

    int commandCount = this.commands.size();
    int testIndex = 0;
    int testCount = tests.length;

    for (int index = 0; index < commandCount; ++index) {
      while (testIndex < testCount) {
        Value test = tests[testIndex];
        Integer offset = offsets[testIndex];
        if (offset.intValue() != index) {
          break;
        }

        Interpreter.indentLine(stream, indent + 1);
        stream.println("<CASE>");
        test.print(stream, indent + 2);
        testIndex++;
      }

      if (defaultIndex == index) {
        Interpreter.indentLine(stream, indent + 1);
        stream.println("<DEFAULT>");
      }

      ParseTreeNode command = (ParseTreeNode) commands.get(index);
      command.print(stream, indent + 2);
    }
  }
  @Override
  public void print(final PrintStream stream, final int indent) {
    Interpreter.indentLine(stream, indent);
    stream.println("<INVOKE " + this.name.toString() + ">");
    this.type.print(stream, indent + 1);

    Iterator it = this.getValues();
    while (it.hasNext()) {
      Value current = (Value) it.next();
      current.print(stream, indent + 1);
    }
  }
Пример #3
0
 @Override
 public void print(final PrintStream stream, final int indent) {
   Interpreter.indentLine(stream, indent);
   stream.println("<VAR " + this.getType() + " " + this.getName() + ">");
 }
Пример #4
0
 @Override
 public void print(final PrintStream stream, final int indent) {
   Interpreter.indentLine(stream, indent);
   stream.println("<TYPE " + this.name + ">");
 }