about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-08-18 11:35:12 -0700
committerGraydon Hoare <graydon@mozilla.com>2010-08-18 11:35:12 -0700
commita1b57e69cdffe699a59f1f09437ae161b32abc27 (patch)
treeea2eccd6d97a2707568f23c98a840127b0cd7baf /src/comp
parent49f668dff306ae76ad83f2f82c032940f723b26c (diff)
downloadrust-a1b57e69cdffe699a59f1f09437ae161b32abc27.tar.gz
rust-a1b57e69cdffe699a59f1f09437ae161b32abc27.zip
Add mod token to rustc.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/fe/token.rs160
-rw-r--r--src/comp/rustc.rc1
2 files changed, 161 insertions, 0 deletions
diff --git a/src/comp/fe/token.rs b/src/comp/fe/token.rs
new file mode 100644
index 00000000000..76142910221
--- /dev/null
+++ b/src/comp/fe/token.rs
@@ -0,0 +1,160 @@
+import util.common.ty_mach;
+
+type op = tag
+    (PLUS(),
+     MINUS(),
+     STAR(),
+     SLASH(),
+     PERCENT(),
+     EQ(),
+     LT(),
+     LE(),
+     EQEQ(),
+     NE(),
+     GE(),
+     GT(),
+     NOT(),
+     TILDE(),
+     CARET(),
+     AND(),
+     ANDAND(),
+     OR(),
+     OROR(),
+     LSL(),
+     LSR(),
+     ASR());
+
+type token = tag
+    (OP(op),
+     OPEQ(op),
+     AS(),
+     WITH(),
+
+     /* Structural symbols */
+     AT(),
+     DOT(),
+     COMMA(),
+     SEMI(),
+     COLON(),
+     RARROW(),
+     SEND(),
+     LARROW(),
+     LPAREN(),
+     RPAREN(),
+     LBRACKET(),
+     RBRACKET(),
+     LBRACE(),
+     RBRACE(),
+
+     /* Module and crate keywords */
+     MOD(),
+     USE(),
+     AUTH(),
+     META(),
+
+     /* Metaprogramming keywords */
+     SYNTAX(),
+     POUND(),
+
+     /* Statement keywords */
+     IF(),
+     ELSE(),
+     DO(),
+     WHILE(),
+     ALT(),
+     CASE(),
+
+     FAIL(),
+     DROP(),
+
+     IN(),
+     FOR(),
+     EACH(),
+     PUT(),
+     RET(),
+     BE(),
+
+     /* Type and type-state keywords */
+     TYPE(),
+     CHECK(),
+     CLAIM(),
+     PROVE(),
+
+     /* Effect keywords */
+     IO(),
+     STATE(),
+     UNSAFE(),
+
+     /* Type qualifiers */
+     NATIVE(),
+     AUTO(),
+     MUTABLE(),
+
+     /* Name management */
+     IMPORT(),
+     EXPORT(),
+
+     /* Value / stmt declarators */
+     LET(),
+
+     /* Magic runtime services */
+     LOG(),
+     SPAWN(),
+     BIND(),
+     THREAD(),
+     YIELD(),
+     JOIN(),
+
+     /* Literals */
+     LIT_INT(int),
+     LIT_UINT(int),
+     LIT_MACH_INT(ty_mach, int),
+     LIT_STR(str),
+     LIT_CHAR(int),
+     LIT_BOOL(bool),
+
+     /* Name components */
+     IDENT(str),
+     IDX(int),
+     UNDERSCORE(),
+
+     /* Reserved type names */
+     BOOL(),
+     INT(),
+     UINT(),
+     FLOAT(),
+     CHAR(),
+     STR(),
+     MACH(ty_mach),
+
+     /* Algebraic type constructors */
+     REC(),
+     TUP(),
+     TAG(),
+     VEC(),
+     ANY(),
+
+     /* Callable type constructors */
+     FN(),
+     ITER(),
+
+     /* Object type */
+     OBJ(),
+
+     /* Comm and task types */
+     CHAN(),
+     PORT(),
+     TASK(),
+
+     BRACEQUOTE(str),
+     EOF());
+
+
+
+// Local Variables:
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
+// End:
diff --git a/src/comp/rustc.rc b/src/comp/rustc.rc
index 70eb35d197d..6d845c71ea8 100644
--- a/src/comp/rustc.rc
+++ b/src/comp/rustc.rc
@@ -7,6 +7,7 @@ mod fe {
     mod ast;
     mod lexer;
     mod parser;
+    mod token;
 }
 
 mod driver {