PageRenderTime 13ms CodeModel.GetById 6ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/ooc/frontend/model/FlowControl.java

http://github.com/nddrylliog/ooc
Java | 50 lines | 37 code | 13 blank | 0 comment | 0 complexity | 3d70a779edb02ab2ee70f55baf07079c MD5 | raw file
 1package org.ooc.frontend.model;
 2
 3import java.io.IOException;
 4
 5import org.ooc.frontend.Visitor;
 6import org.ooc.frontend.model.tokens.Token;
 7
 8public class FlowControl extends ControlStatement {
 9
10	public static enum Mode {
11		BREAK,
12		CONTINUE,
13	}
14
15	private Mode mode;
16	
17	public FlowControl(Mode mode, Token startToken) {
18		super(startToken);
19		this.mode = mode;
20	}
21
22	@Override
23	public boolean replace(Node oldie, Node kiddo) {
24		return false;
25	}
26
27	public void accept(Visitor visitor) throws IOException {
28		visitor.visit(this);
29	}
30
31	public void acceptChildren(Visitor visitor) throws IOException {}
32
33	public boolean hasChildren() {
34		return false;
35	}
36	
37	public Mode getMode() {
38		return mode;
39	}
40
41	public String getKeyword() {
42		switch(mode) {
43		case CONTINUE:
44			return "continue";
45		case BREAK: default:
46			return "break";
47		}
48	}
49
50}