From a1b57e69cdffe699a59f1f09437ae161b32abc27 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Wed, 18 Aug 2010 11:35:12 -0700 Subject: [PATCH] Add mod token to rustc. --- src/comp/fe/token.rs | 160 +++++++++++++++++++++++++++++++++++++++++++ src/comp/rustc.rc | 1 + 2 files changed, 161 insertions(+) create mode 100644 src/comp/fe/token.rs 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 {