PageRenderTime 18ms CodeModel.GetById 8ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/interfacedeclunit.d

http://github.com/wilkie/djehuty
D | 85 lines | 45 code | 16 blank | 24 comment | 9 complexity | 4bd4b48fafc67093a4216e489662cdf9 MD5 | raw file
 1/*
 2 * expressionunit.d
 3 *
 4 * This module parses expressions.
 5 *
 6 */
 7
 8module parsing.d.interfacedeclunit;
 9
10import parsing.parseunit;
11import parsing.token;
12
13import parsing.d.tokens;
14import parsing.d.nodes;
15
16import parsing.d.declarationunit;
17import parsing.d.interfacebodyunit;
18
19import io.console;
20
21import djehuty;
22
23class InterfaceDeclUnit : ParseUnit {
24	override bool tokenFound(Token current) {
25		switch (current.type) {
26			// The start of the body
27			case DToken.LeftCurly:
28				auto tree = expand!(InterfaceBodyUnit)();
29
30				// Done.
31				return false;
32
33			// Look for a template parameter list
34			case DToken.LeftParen:
35				if (cur_string == "") {
36					// Error: No name?
37					// TODO:
38				}
39				if (this.state >= 1) {
40					// Error: Already have base class list or template parameters
41					// TODO:
42				}
43				this.state = 1;
44
45				// TODO: expand out parameter list				
46				break;
47
48			// Look for inherited classes
49			case DToken.Colon:
50				if (cur_string == "") {
51					// Error: No name?
52					// TODO:
53				}
54				if (this.state >= 2) {
55					// Error: Already have base class list
56					// TODO:
57				}
58				this.state = 2;
59
60				// TODO: expand out base class list
61				break;
62
63			// Name
64			case DToken.Identifier:
65				if (cur_string != "") {
66					// Error: Two names?
67					// TODO:
68				}
69				cur_string = current.value.toString();
70				Console.putln("Interface: ", current.value);
71				break;
72
73			default:
74				// Error: Unrecognized foo.
75				break;
76		}
77		return true;
78	}
79
80protected:
81	string cur_string = "";
82
83	static const string _common_error_msg = "";
84	static const string[] _common_error_usages = null;
85}