PageRenderTime 42ms CodeModel.GetById 26ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/parsing/d/basictypeunit.d

http://github.com/wilkie/djehuty
D | 77 lines | 50 code | 14 blank | 13 comment | 1 complexity | ee5f2e60829b79915d614a5c2fd12ea4 MD5 | raw file
 1/*
 2 * typedeclarationunit.d
 3 *
 4 */
 5
 6module parsing.d.basictypeunit;
 7
 8import parsing.parseunit;
 9import parsing.token;
10
11import parsing.d.tokens;
12import parsing.d.nodes;
13
14import parsing.d.staticunit;
15import parsing.d.declaratorunit;
16
17import djehuty;
18
19import io.console;
20
21class BasicTypeUnit : ParseUnit {
22	override bool tokenFound(Token current) {
23
24		switch (current.type) {
25			case DToken.Bool:
26			case DToken.Byte:
27			case DToken.Ubyte:
28			case DToken.Short:
29			case DToken.Ushort:
30			case DToken.Int:
31			case DToken.Uint:
32			case DToken.Long:
33			case DToken.Ulong:
34			case DToken.Char:
35			case DToken.Wchar:
36			case DToken.Dchar:
37			case DToken.Float:
38			case DToken.Double:
39			case DToken.Real:
40			case DToken.Ifloat:
41			case DToken.Idouble:
42			case DToken.Ireal:
43			case DToken.Cfloat:
44			case DToken.Cdouble:
45			case DToken.Creal:
46			case DToken.Void:
47				// We have a basic type
48				Console.putln("BasicType ");
49
50				// Done.
51				return false;
52
53			case DToken.Identifier:
54				// Named Type, could be a scoped list
55				// TODO:
56				break;
57
58			// Scope Operator
59			case DToken.Dot:
60				// TODO:
61				break;
62
63			case DToken.Typeof:
64				// TypeOfExpression
65				// TODO: this
66				break;
67
68			default:
69
70				// We will pass this off to a Declarator
71				auto tree = expand!(DeclaratorUnit)();
72				this.state = 1;
73				break;
74		}
75		return true;
76	}
77}