Skip to content

Commit 518739f

Browse files
committed
---
yaml --- r: 56492 b: refs/heads/auto c: 1b4ced8 h: refs/heads/master v: v3
1 parent caf57ac commit 518739f

File tree

6 files changed

+35
-59
lines changed

6 files changed

+35
-59
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 9f8d30a128aa8a75a3304e0e91178dcfb5535554
17+
refs/heads/auto: 1b4ced8bcb39ab29ba1caaea0a44e881ccbbc9e1
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libsyntax/ast_util.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ pub fn operator_prec(op: ast::binop) -> uint {
355355
}
356356
}
357357
358+
/// Precedence of the `as` operator, which is a binary operator
359+
/// not appearing in the prior table.
360+
pub static as_prec: uint = 11u;
361+
358362
pub fn dtor_ty() -> @ast::Ty {
359363
@ast::Ty {id: 0, node: ty_nil, span: dummy_sp()}
360364
}

branches/auto/src/libsyntax/parse/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ pub mod attr;
3636
/// Common routines shared by parser mods
3737
pub mod common;
3838

39-
/// Functions dealing with operator precedence
40-
pub mod prec;
41-
4239
/// Routines the parser uses to classify AST nodes
4340
pub mod classify;
4441

branches/auto/src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use ast::{view_item_, view_item_extern_mod, view_item_use};
5858
use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
5959
use ast::visibility;
6060
use ast;
61-
use ast_util::{ident_to_path, operator_prec};
61+
use ast_util::{as_prec, ident_to_path, operator_prec};
6262
use ast_util;
6363
use codemap::{span, BytePos, spanned, mk_sp};
6464
use codemap;
@@ -82,9 +82,8 @@ use parse::obsolete::ObsoleteMode;
8282
use parse::obsolete::{ObsoleteLifetimeNotation, ObsoleteConstManagedPointer};
8383
use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
8484
use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
85-
use parse::prec::{as_prec, token_to_binop};
8685
use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
87-
use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
86+
use parse::token::{is_plain_ident, INTERPOLATED, special_idents, token_to_binop};
8887
use parse::token;
8988
use parse::{new_sub_parser_from_file, next_node_id, ParseSess};
9089
use opt_vec;

branches/auto/src/libsyntax/parse/prec.rs

Lines changed: 0 additions & 52 deletions
This file was deleted.

branches/auto/src/libsyntax/parse/token.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,34 @@ impl<'self> to_bytes::IterBytes for StringRef<'self> {
364364
}
365365
}
366366
367+
/**
368+
* Maps a token to a record specifying the corresponding binary
369+
* operator
370+
*/
371+
pub fn token_to_binop(tok: Token) -> Option<ast::binop> {
372+
match tok {
373+
BINOP(STAR) => Some(ast::mul),
374+
BINOP(SLASH) => Some(ast::quot),
375+
BINOP(PERCENT) => Some(ast::rem),
376+
BINOP(PLUS) => Some(ast::add),
377+
BINOP(MINUS) => Some(ast::subtract),
378+
BINOP(SHL) => Some(ast::shl),
379+
BINOP(SHR) => Some(ast::shr),
380+
BINOP(AND) => Some(ast::bitand),
381+
BINOP(CARET) => Some(ast::bitxor),
382+
BINOP(OR) => Some(ast::bitor),
383+
LT => Some(ast::lt),
384+
LE => Some(ast::le),
385+
GE => Some(ast::ge),
386+
GT => Some(ast::gt),
387+
EQEQ => Some(ast::eq),
388+
NE => Some(ast::ne),
389+
ANDAND => Some(ast::and),
390+
OROR => Some(ast::or),
391+
_ => None
392+
}
393+
}
394+
367395
pub struct ident_interner {
368396
priv interner: Interner<@~str>,
369397
}

0 commit comments

Comments
 (0)