about summary refs log tree commit diff
path: root/src/comp/front
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-04-19 11:21:23 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-04-19 16:57:13 +0200
commit6d3a423094c77b25b20afe3a812a67f03080cc3d (patch)
treea2293502572a511ba35253830574632105b0b40d /src/comp/front
parent9bfc8bf11e15b7b9a782f1757f9a0ebe324b16e4 (diff)
add log_err to rustc
Diffstat (limited to 'src/comp/front')
-rw-r--r--src/comp/front/ast.rs2
-rw-r--r--src/comp/front/lexer.rs1
-rw-r--r--src/comp/front/parser.rs11
-rw-r--r--src/comp/front/token.rs2
4 files changed, 13 insertions, 3 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index b0a1a0d6d5f..2ecd49922bc 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -289,7 +289,7 @@ tag expr_ {
     expr_ret(option.t[@expr], ann);
     expr_put(option.t[@expr], ann);
     expr_be(@expr, ann);
-    expr_log(@expr, ann);
+    expr_log(int, @expr, ann);
     expr_check_expr(@expr, ann);
     expr_port(ann);
     expr_chan(@expr, ann);
diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs
index 36269515f62..8d4c464d5c9 100644
--- a/src/comp/front/lexer.rs
+++ b/src/comp/front/lexer.rs
@@ -152,6 +152,7 @@ fn keyword_table() -> std.map.hashmap[str, token.token] {
     keywords.insert("const", token.CONST);
 
     keywords.insert("log", token.LOG);
+    keywords.insert("log_err", token.LOG_ERR);
     keywords.insert("spawn", token.SPAWN);
     keywords.insert("thread", token.THREAD);
     keywords.insert("yield", token.YIELD);
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 2e6e7c29358..2c21c957f75 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -810,7 +810,14 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
             p.bump();
             auto e = parse_expr(p);
             auto hi = e.span.hi;
-            ex = ast.expr_log(e, ast.ann_none);
+            ex = ast.expr_log(1, e, ast.ann_none);
+        }
+
+        case (token.LOG_ERR) {
+            p.bump();
+            auto e = parse_expr(p);
+            auto hi = e.span.hi;
+            ex = ast.expr_log(0, e, ast.ann_none);
         }
 
         case (token.CHECK) {
@@ -1669,7 +1676,7 @@ fn stmt_ends_with_semi(@ast.stmt stmt) -> bool {
                 case (ast.expr_ret(_,_))        { ret true; }
                 case (ast.expr_put(_,_))        { ret true; }
                 case (ast.expr_be(_,_))         { ret true; }
-                case (ast.expr_log(_,_))        { ret true; }
+                case (ast.expr_log(_,_,_))        { ret true; }
                 case (ast.expr_check_expr(_,_)) { ret true; }
             }
         }
diff --git a/src/comp/front/token.rs b/src/comp/front/token.rs
index dcfafadf202..078467b5d0e 100644
--- a/src/comp/front/token.rs
+++ b/src/comp/front/token.rs
@@ -119,6 +119,7 @@ tag token {
 
     /* Magic runtime services */
     LOG;
+    LOG_ERR;
     SPAWN;
     BIND;
     THREAD;
@@ -291,6 +292,7 @@ fn to_str(token t) -> str {
 
         /* Magic runtime services */
         case (LOG) { ret "log"; }
+        case (LOG_ERR) { ret "log_err"; }
         case (SPAWN) { ret "spawn"; }
         case (BIND) { ret "bind"; }
         case (THREAD) { ret "thread"; }