package primitive.node.impl.stmt;

import primitive.env.Enviroment;
import primitive.env.Memory;
import primitive.lexical.LexicalType;
import primitive.node.Node;

public class Loop implements Node {
    private Node stmtlist;
    private Enviroment env;

    public Loop(Enviroment env) {
        this.env = env;
    }

    @Override
    public char get() {
        Memory memory = env.getMemory();
        while (memory.get() != 0) {
            stmtlist.get();
            memory = env.getMemory();
        }
        return 0;
    }

    @Override
    public boolean parse() {
        stmtlist = new StmtList(env);
        if (stmtlist.parse()) {
            return env.getLexicalAnalyzer().get().getType() == LexicalType.JUMP;
        }
        return false;
    }

}

@@ -122,20 +122,100 @@
 .Lexical
-Type
+Analyzer;%0Aimport primitive.lexical.LexicalType;%0Aimport primitive.lexical.LexicalUnit
 ;%0Aimport
@@ -665,129 +665,266 @@
     
-stmtlist = new StmtList(env);%0A        if (stmtlist.parse()) %7B%0A            return env.getLexicalAnalyzer().get().getType()
+LexicalAnalyzer lex = env.getLexicalAnalyzer();%0A        LexicalUnit unit;%0A        LexicalType type;%0A        stmtlist = new StmtList(env);%0A        if (stmtlist.parse()) %7B%0A            unit = lex.get();%0A            type = unit.getType();%0A            return type
  == 

clean up Loop