about summary refs log tree commit diff
path: root/src/comp/pretty/pprust.rs
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-05-13 21:30:08 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-05-13 22:00:13 +0200
commit57ffa2a487ef12a4abf538efc2dd8192ca308271 (patch)
treef3a82a1076c93c6ad6200391cc838cf2e7e6999d /src/comp/pretty/pprust.rs
parentbe9aa1cc5ecb59c62a80db9e5be355deac90d08e (diff)
Make the parser more careful about keywords
Keywords are now only recognized in contexts where they are valid. The
lexer no longer recognizes them, all words are lexed as IDENT tokens,
that get interpreted by the parser.
Diffstat (limited to 'src/comp/pretty/pprust.rs')
-rw-r--r--src/comp/pretty/pprust.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs
index 3c959b999c2..0bdd5c8379f 100644
--- a/src/comp/pretty/pprust.rs
+++ b/src/comp/pretty/pprust.rs
@@ -9,7 +9,6 @@ import util::common;
 import pp::end; import pp::wrd; import pp::space; import pp::line;
 
 const uint indent_unit = 4u;
-const int as_prec = 5;
 const uint default_columns = 78u;
 
 type ps = @rec(pp::ps s,
@@ -494,7 +493,7 @@ fn print_expr(ps s, &@ast::expr expr) {
             print_literal(s, lit);
         }
         case (ast::expr_cast(?expr,?ty,_)) {
-            print_maybe_parens(s, expr, as_prec);
+            print_maybe_parens(s, expr, front::parser::as_prec);
             space(s.s);
             wrd1(s, "as");
             print_type(s, ty);
@@ -888,7 +887,7 @@ fn print_maybe_parens(ps s, @ast::expr expr, int outer_prec) {
             add_them = operator_prec(op) < outer_prec;
         }
         case (ast::expr_cast(_,_,_)) {
-            add_them = as_prec < outer_prec;
+            add_them = front::parser::as_prec < outer_prec;
         }
         case (_) {
             add_them = false;