changeset 103:09b4d74cb3f5 new_gen

Parsing char, wchar and dchar as basic types.
author Anders Johnsen <skabet@gmail.com>
date Thu, 08 May 2008 10:54:29 +0200
parents cd066f3b539a
children 7ff4bc2accf2 189c049cbfcc
files lexer/Keyword.d lexer/Token.d sema/DType.d sema/ScopeBuilder.d tests/parser/basic_type_char_1.d
diffstat 5 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lexer/Keyword.d	Thu May 08 10:32:41 2008 +0200
+++ b/lexer/Keyword.d	Thu May 08 10:54:29 2008 +0200
@@ -22,6 +22,10 @@
         "long"      : Tok.Long,
         "ulong"     : Tok.Ulong,
 
+        "char"      : Tok.Char,
+        "wchar"     : Tok.Wchar,
+        "dchar"     : Tok.Dchar,
+
         "bool"      : Tok.Bool,
 
         "float"     : Tok.Float,
--- a/lexer/Token.d	Thu May 08 10:32:41 2008 +0200
+++ b/lexer/Token.d	Thu May 08 10:54:29 2008 +0200
@@ -121,6 +121,8 @@
     Int, Uint,
     Long, Ulong,
 
+    Char, Wchar, Dchar,
+
     Float, Double,
 
     Bool,
@@ -155,6 +157,9 @@
         Tok.Short:"Short",
         Tok.Int:"Int",
         Tok.Long:"Long",
+        Tok.Char:"Char",
+        Tok.Wchar:"Wchar",
+        Tok.Dchar:"Dchar",
         Tok.Bool:"Bool",
         Tok.Void:"Void",
         Tok.Eq:"Eq",
--- a/sema/DType.d	Thu May 08 10:32:41 2008 +0200
+++ b/sema/DType.d	Thu May 08 10:54:29 2008 +0200
@@ -121,7 +121,8 @@
     static DInteger
         Bool,
         Byte, UByte, Short, UShort,
-        Int, UInt, Long, ULong;
+        Int, UInt, Long, ULong,
+        Char, WChar, DChar;
 
     static DType Void;
 
@@ -138,6 +139,9 @@
         UInt   = new DInteger("uint",   32, true);
         Long   = new DInteger("long",   64, false);
         ULong  = new DInteger("ulong",  64, true);
+        Char   = new DInteger("char",    8, true);
+        WChar  = new DInteger("wchar",  16, true);
+        DChar  = new DInteger("dchar",  32, true);
     }
 }
 
--- a/sema/ScopeBuilder.d	Thu May 08 10:32:41 2008 +0200
+++ b/sema/ScopeBuilder.d	Thu May 08 10:54:29 2008 +0200
@@ -100,6 +100,9 @@
         table[table.length-1].types["uint"]    = DType.UInt;
         table[table.length-1].types["long"]    = DType.Long;
         table[table.length-1].types["ulong"]   = DType.ULong;
+        table[table.length-1].types["char"]    = DType.Char;
+        table[table.length-1].types["wchar"]   = DType.WChar;
+        table[table.length-1].types["dchar"]   = DType.DChar;
 
         current().inModule = m;
         current().mHandle = mHandle;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/parser/basic_type_char_1.d	Thu May 08 10:54:29 2008 +0200
@@ -0,0 +1,10 @@
+
+
+int main()
+{
+    char c;
+    wchar w;
+    dchar d;
+
+    return 0;
+}