PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/enumbodyunit.d

http://github.com/wilkie/djehuty
D | 64 lines | 39 code | 12 blank | 13 comment | 7 complexity | f41ec28a2f50f8900fe31db13f722b05 MD5 | raw file
 1/*
 2 * expressionunit.d
 3 *
 4 * This module parses expressions.
 5 *
 6 */
 7
 8module parsing.d.enumbodyunit;
 9
10import parsing.parseunit;
11import parsing.token;
12
13import parsing.d.tokens;
14import parsing.d.nodes;
15
16import parsing.d.assignexprunit;
17
18import io.console;
19
20import djehuty;
21
22class EnumBodyUnit : ParseUnit {
23	override bool tokenFound(Token current) {
24		switch (current.type) {
25
26			// Looking for a new member name
27			case DToken.Identifier:
28				if (this.state == 1) {
29					// Error: A name next to a name??
30				}
31				this.state = 1;
32				Console.putln("Member: ", current.value);
33				break;
34			case DToken.RightCurly:
35				// Done.
36				return false;
37			case DToken.Comma:
38				if (this.state != 1) {
39					// Error: A comma by itself?
40				}
41				this.state = 0;
42				break;
43			case DToken.Assign:
44				if (this.state != 1) {
45					// Error: An equals by itself?
46				}
47
48				// Look for an assignment expression.
49				auto tree = expand!(AssignExprUnit)();
50
51				// Stay in the same state and wait for a comma.
52				break;
53			default:
54				break;
55		}
56		return true;
57	}
58
59protected:
60	string cur_string = "";
61
62	static const string _common_error_msg = "";
63	static const string[] _common_error_usages = null;
64}