view lexer/Keyword.d @ 37:858b9805843d new_gen

Bug-fixes Void can now be used and is recognized as a keyword by lexer Fixed a problem with casting on pointer types The expression is now optional for a ReturnStmt (only legal in void funcs)
author Anders Halager <halager@gmail.com>
date Sun, 20 Apr 2008 23:53:05 +0200
parents ce17bea8e9bd
children 4e879f82dd64
line wrap: on
line source

module lexer.Keyword;

import lexer.Token;

Tok[char[]] keywords;

static this ()
{
    keywords =
    [
        // types
        "byte"[]    : Tok.Byte,
        "ubyte"     : Tok.Ubyte,
        "short"     : Tok.Short,
        "ushort"    : Tok.Ushort,
        "int"       : Tok.Int,
        "uint"      : Tok.Uint,
        "long"      : Tok.Long,
        "ulong"     : Tok.Ulong,

        "bool"      : Tok.Bool,

        "float"     : Tok.Float,
        "double"    : Tok.Double,

        "void"      : Tok.Void,

        // type related
        "struct"    : Tok.Struct,

        // control flow
        "if"        : Tok.If,
        "else"      : Tok.Else,
        "while"     : Tok.While,
        "switch"    : Tok.Switch,
        "case"      : Tok.Case,
        "default"   : Tok.Default,
        "return"    : Tok.Return
    ];
}