about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2012-02-09 11:50:54 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-02-09 11:58:08 +0100
commit50fb4c30ed02e72a715e093c8f87b0c179fb3ccb (patch)
treef94ca4759ed236f088971717c3d1cc4182002ac2 /src/comp/syntax/parse
parent1dc5e1aa94d1c82d12385dfcb95c75cbaaa318a9 (diff)
downloadrust-50fb4c30ed02e72a715e093c8f87b0c179fb3ccb.tar.gz
rust-50fb4c30ed02e72a715e093c8f87b0c179fb3ccb.zip
Increase precedence of as operator
Closes #1717
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index d15c333c5fe..a988557b84d 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1123,7 +1123,8 @@ type op_spec = {tok: token::token, op: ast::binop, prec: int};
 
 // FIXME make this a const, don't store it in parser state
 fn prec_table() -> @[op_spec] {
-    ret @[{tok: token::BINOP(token::STAR), op: ast::mul, prec: 11},
+    ret @[// 'as' sits between here with 12
+          {tok: token::BINOP(token::STAR), op: ast::mul, prec: 11},
           {tok: token::BINOP(token::SLASH), op: ast::div, prec: 11},
           {tok: token::BINOP(token::PERCENT), op: ast::rem, prec: 11},
           {tok: token::BINOP(token::PLUS), op: ast::add, prec: 10},
@@ -1134,7 +1135,6 @@ fn prec_table() -> @[op_spec] {
           {tok: token::BINOP(token::AND), op: ast::bitand, prec: 8},
           {tok: token::BINOP(token::CARET), op: ast::bitxor, prec: 7},
           {tok: token::BINOP(token::OR), op: ast::bitor, prec: 6},
-          // 'as' sits between here with 5
           {tok: token::LT, op: ast::lt, prec: 4},
           {tok: token::LE, op: ast::le, prec: 4},
           {tok: token::GE, op: ast::ge, prec: 4},
@@ -1151,7 +1151,7 @@ fn parse_binops(p: parser) -> @ast::expr {
 
 const unop_prec: int = 100;
 
-const as_prec: int = 5;
+const as_prec: int = 12;
 
 fn parse_more_binops(p: parser, plhs: pexpr, min_prec: int) ->
    @ast::expr {