view src/lexer/Keyword.d @ 206:d3c148ca429b

Major moving of files. all src now goes into src, all docs in docs.
author Anders Johnsen <skabet@gmail.com>
date Tue, 12 Aug 2008 18:14:56 +0200
parents
children e0551773a005
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,

        "char"      : Tok.Char,
        "wchar"     : Tok.Wchar,
        "dchar"     : Tok.Dchar,

        "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
    ];
}