view lexer/Keyword.d @ 94:48bb2287c035 new_gen

Added Modules. Right now it's very simple - will grow with time and need.
author Anders Johnsen <skabet@gmail.com>
date Tue, 06 May 2008 16:24:14 +0200
parents 381975d76baf
children 09b4d74cb3f5
line wrap: on
line source

module lexer.Keyword;

import lexer.Token;

/**
  A list of keywords in an associative array that link a string
  representation of the keyword to a Tok
  */
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,
        "cast"      : Tok.Cast,

        // modules
        "module"    : Tok.Module,
        "import"    : Tok.Import
    ];
}