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

/parsing/d/xorexprunit.d

http://github.com/wilkie/djehuty
D | 53 lines | 34 code | 11 blank | 8 comment | 5 complexity | 6747124922a71e6c9e84f696de42f6e4 MD5 | raw file
 1/*
 2 * expressionunit.d
 3 *
 4 * This module parses expressions.
 5 *
 6 */
 7
 8module parsing.d.xorexprunit;
 9
10import parsing.parseunit;
11import parsing.token;
12
13import parsing.d.tokens;
14import parsing.d.nodes;
15
16import parsing.d.andexprunit;
17
18import io.console;
19
20import djehuty;
21
22class XorExprUnit : ParseUnit {
23	override bool tokenFound(Token current) {
24		switch (current.type) {
25			case DToken.Xor:
26				if (this.state == 1) {
27					Console.putln("XOR");
28					this.state = 0;
29					break;
30				}
31
32				// Fall through
33				goto default;
34
35			default:
36				lexer.push(current);
37				if (this.state == 1) {
38					// Done.
39					return false;
40				}
41				auto tree = expand!(AndExprUnit)();
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}