changeset 597:4d50267f59c9

Moved dil.TokensEnum to dil.lexer.TokensEnum.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 06 Jan 2008 00:28:26 +0100
parents 39fac5531b85
children 4ba8157bde1f
files trunk/src/dil/IdTable.d trunk/src/dil/Identifier.d trunk/src/dil/TokensEnum.d trunk/src/dil/lexer/Token.d trunk/src/dil/lexer/TokensEnum.d
diffstat 5 files changed, 223 insertions(+), 220 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/IdTable.d	Sun Jan 06 00:25:29 2008 +0100
+++ b/trunk/src/dil/IdTable.d	Sun Jan 06 00:28:26 2008 +0100
@@ -3,7 +3,8 @@
   License: GPL3
 +/
 module dil.IdTable;
-import dil.TokensEnum;
+
+import dil.lexer.TokensEnum;
 import dil.IdentsGenerator;
 import dil.Keywords;
 import common;
--- a/trunk/src/dil/Identifier.d	Sun Jan 06 00:25:29 2008 +0100
+++ b/trunk/src/dil/Identifier.d	Sun Jan 06 00:28:26 2008 +0100
@@ -3,7 +3,8 @@
   License: GPL3
 +/
 module dil.Identifier;
-import dil.TokensEnum;
+
+import dil.lexer.TokensEnum;
 import dil.IdentsEnum;
 import common;
 
--- a/trunk/src/dil/TokensEnum.d	Sun Jan 06 00:25:29 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-/++
-  Author: Aziz Köksal
-  License: GPL3
-+/
-module dil.TokensEnum;
-import common;
-
-enum TOK : ushort
-{
-  Invalid,
-
-  Illegal,
-  Comment,
-  Shebang,
-  HashLine,
-  Filespec,
-  Newline,
-  Empty,
-
-  Identifier,
-  String,
-  CharLiteral,
-
-  // Special tokens
-  FILE,
-  LINE,
-  DATE,
-  TIME,
-  TIMESTAMP,
-  VENDOR,
-  VERSION,
-
-  // Number literals
-  Int32, Int64, Uint32, Uint64,
-  // Floating point number scanner relies on this order. (FloatXY + 3 == ImaginaryXY)
-  Float32, Float64, Float80,
-  Imaginary32, Imaginary64, Imaginary80,
-
-
-  // Brackets
-  LParen,
-  RParen,
-  LBracket,
-  RBracket,
-  LBrace,
-  RBrace,
-
-  Dot, Slice, Ellipses,
-
-  // Floating point number operators
-  Unordered,
-  UorE,
-  UorG,
-  UorGorE,
-  UorL,
-  UorLorE,
-  LorEorG,
-  LorG,
-
-  // Normal operators
-  Assign, Equal, NotEqual, Not,
-  LessEqual, Less,
-  GreaterEqual, Greater,
-  LShiftAssign, LShift,
-  RShiftAssign,RShift,
-  URShiftAssign, URShift,
-  OrAssign, OrLogical, OrBinary,
-  AndAssign, AndLogical, AndBinary,
-  PlusAssign, PlusPlus, Plus,
-  MinusAssign, MinusMinus, Minus,
-  DivAssign, Div,
-  MulAssign, Mul,
-  ModAssign, Mod,
-  XorAssign, Xor,
-  CatAssign,
-  Tilde,
-
-  Colon,
-  Semicolon,
-  Question,
-  Comma,
-  Dollar,
-
-  /* Keywords:
-     NB.: Token.isKeyword() depends on this list being contiguous.
-  */
-  Abstract, Alias, Align, Asm, Assert, Auto, Body,
-  Break, Case, Cast, Catch,
-  Class, Const, Continue,
-  Debug, Default, Delegate, Delete, Deprecated, Do,
-  Else, Enum, Export, Extern, False, Final,
-  Finally, For, Foreach, Foreach_reverse, Function, Goto,
-  If, Import, In, Inout,
-  Interface, Invariant, Is, Lazy, Macro/+D2.0+/,
-  Mixin, Module, New, Null, Out, Override, Package,
-  Pragma, Private, Protected, Public, Ref/+D2.0+/, Return,
-  Scope, Static, Struct, Super, Switch, Synchronized,
-  Template, This, Throw, Traits/+D2.0+/, True, Try, Typedef, Typeid,
-  Typeof, Union, Unittest,
-  Version, Volatile, While, With,
-  // Integral types.
-  Char,   Wchar,   Dchar, Bool,
-  Byte,   Ubyte,   Short, Ushort,
-  Int,    Uint,    Long,  Ulong,
-  Cent,   Ucent,
-  Float,  Double,  Real,
-  Ifloat, Idouble, Ireal,
-  Cfloat, Cdouble, Creal, Void,
-
-  HEAD, // start of linked list
-  EOF,
-  MAX
-}
-
-alias TOK.Abstract KeywordsBegin;
-alias TOK.Void KeywordsEnd;
-alias TOK.Char IntegralTypeBegin;
-alias TOK.Void IntegralTypeEnd;
-alias TOK.FILE SpecialTokensBegin;
-alias TOK.VERSION SpecialTokensEnd;
-
-/// A table mapping each TOK to a string.
-const string[] tokToString = [
-  "Invalid",
-
-  "Illegal",
-  "Comment",
-  "#! /shebang/",
-  "#line",
-  `"filespec"`,
-  "Newline",
-  "Empty",
-
-  "Identifier",
-  "String",
-  "CharLiteral",
-
-  "__FILE__",
-  "__LINE__",
-  "__DATE__",
-  "__TIME__",
-  "__TIMESTAMP__",
-  "__VENDOR__",
-  "__VERSION__",
-
-  "Int32", "Int64", "Uint32", "Uint64",
-  "Float32", "Float64", "Float80",
-  "Imaginary32", "Imaginary64", "Imaginary80",
-
-  "(",
-  ")",
-  "[",
-  "]",
-  "{",
-  "}",
-
-  ".", "..", "...",
-
-  "!<>=", // Unordered
-  "!<>",  // UorE
-  "!<=",  // UorG
-  "!<",   // UorGorE
-  "!>=",  // UorL
-  "!>",   // UorLorE
-  "<>=",  // LorEorG
-  "<>",   // LorG
-
-  "=", "==", "!=", "!",
-  "<=", "<",
-  ">=", ">",
-  "<<=", "<<",
-  ">>=",">>",
-  ">>>=", ">>>",
-  "|=", "||", "|",
-  "&=", "&&", "&",
-  "+=", "++", "+",
-  "-=", "--", "-",
-  "/=", "/",
-  "*=", "*",
-  "%=", "%",
-  "^=", "^",
-  "~=",
-  "~",
-
-  ":",
-  ";",
-  "?",
-  ",",
-  "$",
-
-  "abstract","alias","align","asm","assert","auto","body",
-  "break","case","cast","catch",
-  "class","const","continue",
-  "debug","default","delegate","delete","deprecated","do",
-  "else","enum","export","extern","false","final",
-  "finally","for","foreach","foreach_reverse","function","goto",
-  "if","import","in","inout",
-  "interface","invariant","is","lazy","macro",
-  "mixin","module","new","null","out","override","package",
-  "pragma","private","protected","public","ref","return",
-  "scope","static","struct","super","switch","synchronized",
-  "template","this","throw","__traits","true","try","typedef","typeid",
-  "typeof","union","unittest",
-  "version","volatile","while","with",
-  // Integral types.
-  "char",   "wchar",   "dchar", "bool",
-  "byte",   "ubyte",   "short", "ushort",
-  "int",    "uint",    "long",  "ulong",
-  "cent",   "ucent",
-  "float",  "double",  "real",
-  "ifloat", "idouble", "ireal",
-  "cfloat", "cdouble", "creal", "void",
-
-  "HEAD",
-  "EOF"
-];
-static assert(tokToString.length == TOK.EOF+1);
--- a/trunk/src/dil/lexer/Token.d	Sun Jan 06 00:25:29 2008 +0100
+++ b/trunk/src/dil/lexer/Token.d	Sun Jan 06 00:28:26 2008 +0100
@@ -11,7 +11,7 @@
 import tango.core.Exception;
 import common;
 
-public import dil.TokensEnum;
+public import dil.lexer.TokensEnum;
 
 /++
   A Token is a sequence of characters formed by the lexical analyzer.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/dil/lexer/TokensEnum.d	Sun Jan 06 00:28:26 2008 +0100
@@ -0,0 +1,218 @@
+/++
+  Author: Aziz Köksal
+  License: GPL3
++/
+module dil.lexer.TokensEnum;
+
+import common;
+
+enum TOK : ushort
+{
+  Invalid,
+
+  Illegal,
+  Comment,
+  Shebang,
+  HashLine,
+  Filespec,
+  Newline,
+  Empty,
+
+  Identifier,
+  String,
+  CharLiteral,
+
+  // Special tokens
+  FILE,
+  LINE,
+  DATE,
+  TIME,
+  TIMESTAMP,
+  VENDOR,
+  VERSION,
+
+  // Number literals
+  Int32, Int64, Uint32, Uint64,
+  // Floating point number scanner relies on this order. (FloatXY + 3 == ImaginaryXY)
+  Float32, Float64, Float80,
+  Imaginary32, Imaginary64, Imaginary80,
+
+
+  // Brackets
+  LParen,
+  RParen,
+  LBracket,
+  RBracket,
+  LBrace,
+  RBrace,
+
+  Dot, Slice, Ellipses,
+
+  // Floating point number operators
+  Unordered,
+  UorE,
+  UorG,
+  UorGorE,
+  UorL,
+  UorLorE,
+  LorEorG,
+  LorG,
+
+  // Normal operators
+  Assign, Equal, NotEqual, Not,
+  LessEqual, Less,
+  GreaterEqual, Greater,
+  LShiftAssign, LShift,
+  RShiftAssign,RShift,
+  URShiftAssign, URShift,
+  OrAssign, OrLogical, OrBinary,
+  AndAssign, AndLogical, AndBinary,
+  PlusAssign, PlusPlus, Plus,
+  MinusAssign, MinusMinus, Minus,
+  DivAssign, Div,
+  MulAssign, Mul,
+  ModAssign, Mod,
+  XorAssign, Xor,
+  CatAssign,
+  Tilde,
+
+  Colon,
+  Semicolon,
+  Question,
+  Comma,
+  Dollar,
+
+  /* Keywords:
+     NB.: Token.isKeyword() depends on this list being contiguous.
+  */
+  Abstract, Alias, Align, Asm, Assert, Auto, Body,
+  Break, Case, Cast, Catch,
+  Class, Const, Continue,
+  Debug, Default, Delegate, Delete, Deprecated, Do,
+  Else, Enum, Export, Extern, False, Final,
+  Finally, For, Foreach, Foreach_reverse, Function, Goto,
+  If, Import, In, Inout,
+  Interface, Invariant, Is, Lazy, Macro/+D2.0+/,
+  Mixin, Module, New, Null, Out, Override, Package,
+  Pragma, Private, Protected, Public, Ref/+D2.0+/, Return,
+  Scope, Static, Struct, Super, Switch, Synchronized,
+  Template, This, Throw, Traits/+D2.0+/, True, Try, Typedef, Typeid,
+  Typeof, Union, Unittest,
+  Version, Volatile, While, With,
+  // Integral types.
+  Char,   Wchar,   Dchar, Bool,
+  Byte,   Ubyte,   Short, Ushort,
+  Int,    Uint,    Long,  Ulong,
+  Cent,   Ucent,
+  Float,  Double,  Real,
+  Ifloat, Idouble, Ireal,
+  Cfloat, Cdouble, Creal, Void,
+
+  HEAD, // start of linked list
+  EOF,
+  MAX
+}
+
+alias TOK.Abstract KeywordsBegin;
+alias TOK.Void KeywordsEnd;
+alias TOK.Char IntegralTypeBegin;
+alias TOK.Void IntegralTypeEnd;
+alias TOK.FILE SpecialTokensBegin;
+alias TOK.VERSION SpecialTokensEnd;
+
+/// A table mapping each TOK to a string.
+const string[] tokToString = [
+  "Invalid",
+
+  "Illegal",
+  "Comment",
+  "#! /shebang/",
+  "#line",
+  `"filespec"`,
+  "Newline",
+  "Empty",
+
+  "Identifier",
+  "String",
+  "CharLiteral",
+
+  "__FILE__",
+  "__LINE__",
+  "__DATE__",
+  "__TIME__",
+  "__TIMESTAMP__",
+  "__VENDOR__",
+  "__VERSION__",
+
+  "Int32", "Int64", "Uint32", "Uint64",
+  "Float32", "Float64", "Float80",
+  "Imaginary32", "Imaginary64", "Imaginary80",
+
+  "(",
+  ")",
+  "[",
+  "]",
+  "{",
+  "}",
+
+  ".", "..", "...",
+
+  "!<>=", // Unordered
+  "!<>",  // UorE
+  "!<=",  // UorG
+  "!<",   // UorGorE
+  "!>=",  // UorL
+  "!>",   // UorLorE
+  "<>=",  // LorEorG
+  "<>",   // LorG
+
+  "=", "==", "!=", "!",
+  "<=", "<",
+  ">=", ">",
+  "<<=", "<<",
+  ">>=",">>",
+  ">>>=", ">>>",
+  "|=", "||", "|",
+  "&=", "&&", "&",
+  "+=", "++", "+",
+  "-=", "--", "-",
+  "/=", "/",
+  "*=", "*",
+  "%=", "%",
+  "^=", "^",
+  "~=",
+  "~",
+
+  ":",
+  ";",
+  "?",
+  ",",
+  "$",
+
+  "abstract","alias","align","asm","assert","auto","body",
+  "break","case","cast","catch",
+  "class","const","continue",
+  "debug","default","delegate","delete","deprecated","do",
+  "else","enum","export","extern","false","final",
+  "finally","for","foreach","foreach_reverse","function","goto",
+  "if","import","in","inout",
+  "interface","invariant","is","lazy","macro",
+  "mixin","module","new","null","out","override","package",
+  "pragma","private","protected","public","ref","return",
+  "scope","static","struct","super","switch","synchronized",
+  "template","this","throw","__traits","true","try","typedef","typeid",
+  "typeof","union","unittest",
+  "version","volatile","while","with",
+  // Integral types.
+  "char",   "wchar",   "dchar", "bool",
+  "byte",   "ubyte",   "short", "ushort",
+  "int",    "uint",    "long",  "ulong",
+  "cent",   "ucent",
+  "float",  "double",  "real",
+  "ifloat", "idouble", "ireal",
+  "cfloat", "cdouble", "creal", "void",
+
+  "HEAD",
+  "EOF"
+];
+static assert(tokToString.length == TOK.EOF+1);