annotate trunk/src/dil/CompilerInfo.d @ 495:b60450804b6e

Attributes are evaluated during the parsing phase now. Renamed parseDeclarationDefinitionsBlock to parseDeclarationDefinitionsBody. Renamed parseDeclaration to parseVariableOrFunction. Removed class Linkage, renamed parseLinkage to parseLinkageType and modified it so that it returns a value from enum LinkageType. Fix in parseStorageAttribute(): class invariants are recognized now. Modified parseAlignAttribute() so that returns an uint - the alignment size. Removed classes AttributeStatement and ExternStatement. Using Declarations instead in parseAttributeStatement(). Added LinkageType to module Enums. Added StorageClassDeclaration and renamed ExternDeclaration to LinkageDeclaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 08 Dec 2007 22:20:34 +0100
parents e0d24e05a9ee
children 6160ab7b1816
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
465
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
1 /++
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
2 Author: Aziz Köksal
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
3 License: GPL3
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
4 +/
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
5 module dil.CompilerInfo;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
6 import std.metastrings : FormatT = Format, ToString;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
7
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
8 template Pad(char[] str, uint amount)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
9 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
10 static if (str.length >= amount)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
11 const char[] Pad = str;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
12 else
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
13 const char[] Pad = "0" ~ Pad!(str, amount-1);
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
14 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
15
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
16 template Pad(int num, uint amount)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
17 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
18 const char[] Pad = Pad!(ToString!(num), amount);
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
19 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
20
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
21 version(D2)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
22 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
23 const VERSION_MAJOR = 2;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
24 const VERSION_MINOR = 0;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
25 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
26 else
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
27 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
28 const VERSION_MAJOR = 1;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
29 const VERSION_MINOR = 0;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
30 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
31
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
32 const VERSION = FormatT!("%s.%s", VERSION_MAJOR, Pad!(VERSION_MINOR, 3));
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
33 const VENDOR = "dil";
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
34
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
35 /// Used in main help message.
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
36 const COMPILED_WITH = __VENDOR__;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
37 /// ditto
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
38 const COMPILED_VERSION = FormatT!("%s.%s", __VERSION__/1000, Pad!(__VERSION__%1000, 3));
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
39 /// ditto
495
b60450804b6e Attributes are evaluated during the parsing phase now.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 465
diff changeset
40 const COMPILED_DATE = __TIMESTAMP__;
b60450804b6e Attributes are evaluated during the parsing phase now.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 465
diff changeset
41
b60450804b6e Attributes are evaluated during the parsing phase now.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 465
diff changeset
42 const DEFAULT_ALIGN_SIZE = 1; /// The global, default alignment size for struct fields.