PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/casestmtunit.d

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