OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library servicec.types; | |
6 | |
7 enum TypeKind { | |
8 VOID, | |
9 BOOL, | |
10 | |
11 UINT8, | |
12 UINT16, | |
13 | |
14 INT8, | |
15 INT16, | |
16 INT32, | |
17 INT64, | |
18 | |
19 FLOAT32, | |
20 FLOAT64, | |
21 | |
22 STRING, | |
23 LIST, | |
24 | |
25 STRUCT, | |
26 POINTER | |
27 } | |
28 | |
29 final List<TypeKind> primitiveTypes = [ | |
30 TypeKind.VOID, | |
31 TypeKind.BOOL, | |
32 | |
33 TypeKind.UINT8, | |
34 TypeKind.UINT16, | |
35 | |
36 TypeKind.INT8, | |
37 TypeKind.INT16, | |
38 TypeKind.INT32, | |
39 TypeKind.INT64, | |
40 | |
41 TypeKind.FLOAT32, | |
42 TypeKind.FLOAT64 | |
43 ]; | |
44 | |
45 TypeKind lookupType(String identifier) { | |
46 Map<String, TypeKind> types = const { | |
47 'void' : TypeKind.VOID, | |
48 'bool' : TypeKind.BOOL, | |
49 | |
50 'uint8' : TypeKind.UINT8, | |
51 'uint16' : TypeKind.UINT16, | |
52 | |
53 'int8' : TypeKind.INT8, | |
54 'int16' : TypeKind.INT16, | |
55 'int32' : TypeKind.INT32, | |
56 'int64' : TypeKind.INT64, | |
57 | |
58 'float32' : TypeKind.FLOAT32, | |
59 'float64' : TypeKind.FLOAT64, | |
60 | |
61 'String' : TypeKind.STRING, | |
62 'List' : TypeKind.LIST, | |
63 }; | |
64 return types[identifier]; | |
65 } | |
OLD | NEW |