PageRenderTime 72ms CodeModel.GetById 68ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/mulexprunit.d

http://github.com/wilkie/djehuty
D | 54 lines | 35 code | 11 blank | 8 comment | 5 complexity | 9278d302754eb5ea80bbdc5c88fb9dc4 MD5 | raw file
 1/*
 2 * expressionunit.d
 3 *
 4 * This module parses expressions.
 5 *
 6 */
 7
 8module parsing.d.mulexprunit;
 9
10import parsing.parseunit;
11import parsing.token;
12
13import parsing.d.tokens;
14import parsing.d.nodes;
15
16import parsing.d.unaryexprunit;
17
18import io.console;
19
20import djehuty;
21
22class MulExprUnit : ParseUnit {
23	override bool tokenFound(Token current) {
24		switch (current.type) {
25			case DToken.Mul:
26			case DToken.Div:
27			case DToken.Mod:
28				if (this.state == 1) {
29					Console.putln("MUL");
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!(UnaryExprUnit)();
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}