PageRenderTime 18ms CodeModel.GetById 9ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/addexprunit.d

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