PageRenderTime 162ms CodeModel.GetById 155ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 1ms

/parsing/d/shiftexprunit.d

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