PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/switchstmtunit.d

http://github.com/wilkie/djehuty
D | 61 lines | 41 code | 11 blank | 9 comment | 9 complexity | 05189bd7a6538d9c35cdd130c8d8b4d1 MD5 | raw file
 1/*
 2 * expressionunit.d
 3 *
 4 * This module parses expressions.
 5 *
 6 */
 7
 8module parsing.d.switchstmtunit;
 9
10import parsing.parseunit;
11import parsing.token;
12
13import parsing.d.tokens;
14import parsing.d.nodes;
15
16import parsing.d.expressionunit;
17import parsing.d.blockstmtunit;
18
19import io.console;
20
21import djehuty;
22
23class SwitchStmtUnit : ParseUnit {
24	override bool tokenFound(Token current) {
25		switch (current.type) {
26			case DToken.LeftParen:
27				if (this.state != 0) {
28				}
29
30				Console.putln("Switch:");
31				auto tree = expand!(ExpressionUnit)();
32				this.state = 1;
33				break;
34			case DToken.RightParen:
35				if (this.state != 1) {
36				}
37				this.state = 2;
38				break;
39			case DToken.LeftCurly:
40				if (this.state == 0) {
41				}
42				if (this.state == 1) {
43				}
44
45				auto tree = expand!(BlockStmtUnit)();
46				// Done.
47				return false;
48			default:
49				// Error
50				// TODO:
51				break;
52		}
53		return true;
54	}
55
56protected:
57	string cur_string = "";
58
59	static const string _common_error_msg = "";
60	static const string[] _common_error_usages = null;
61}