PageRenderTime 46ms CodeModel.GetById 36ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/parsing/d/functionbodyunit.d

http://github.com/wilkie/djehuty
D | 73 lines | 45 code | 14 blank | 14 comment | 9 complexity | 196ee39cd304c65fe0a272a7d1081c4f MD5 | raw file
 1/*
 2 * expressionunit.d
 3 *
 4 * This module parses expressions.
 5 *
 6 */
 7
 8module parsing.d.functionbodyunit;
 9
10import parsing.parseunit;
11import parsing.token;
12
13import parsing.d.tokens;
14import parsing.d.nodes;
15
16import parsing.d.parameterlistunit;
17import parsing.d.functionbodyunit;
18import parsing.d.statementunit;
19
20import io.console;
21
22import djehuty;
23
24class FunctionBodyUnit : ParseUnit {
25	override bool tokenFound(Token current) {
26		switch (current.type) {
27
28			// We always look FIRST for a left curly brace
29			case DToken.LeftCurly:
30				if (this.state % 2 == 1) {
31					// Error: Left curly already found.
32					// TODO:
33				}
34				this.state = this.state + 1;
35				break;
36
37			// We are always looking for the end of the block.
38			case DToken.RightCurly:
39				if (this.state % 2 == 0) {
40					// Error: Left curly not found!
41					// TODO:
42				}
43				this.state = this.state - 1;
44
45				if (this.state == 0) {
46					// Done.
47					return false;
48				}
49
50			// TODO: in, out, body, blockstatement foo
51			case DToken.In:
52				break;
53			case DToken.Out:
54				break;
55			case DToken.Body:
56				break;
57
58			default:
59				lexer.push(current);
60				if (this.state % 2 == 0) {
61				}
62				auto tree = expand!(StatementUnit)();
63				break;
64		}
65		return true;
66	}
67
68protected:
69	string cur_string = "";
70
71	static const string _common_error_msg = "";
72	static const string[] _common_error_usages = null;
73}