From 57ffa2a487ef12a4abf538efc2dd8192ca308271 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 13 May 2011 21:30:08 +0200 Subject: 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. --- src/comp/pretty/pprust.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/comp/pretty') diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index 3c959b99..0bdd5c83 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; -- cgit v1.2.3