diff options
| author | Kiet Tran <ktt3ja@gmail.com> | 2013-12-08 02:55:28 -0500 |
|---|---|---|
| committer | Kiet Tran <ktt3ja@gmail.com> | 2013-12-08 02:55:28 -0500 |
| commit | 1755408d1a58684b6c9bce11aeceb18a1ec2d66e (patch) | |
| tree | 9d781272021fe4ead382ffc8f87c048f194e25b5 /src/libsyntax/parse | |
| parent | c06dd0e0afb4b78ab4e482a7488adcf1c865bd19 (diff) | |
| download | rust-1755408d1a58684b6c9bce11aeceb18a1ec2d66e.tar.gz rust-1755408d1a58684b6c9bce11aeceb18a1ec2d66e.zip | |
Remove dead codes
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 100 |
2 files changed, 0 insertions, 113 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 9c35bb838a3..22a999ab744 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -273,8 +273,6 @@ pub fn nextch(rdr: @mut StringReader) -> char { } else { return unsafe { transmute(-1u32) }; } // FIXME: #8971: unsound } -fn dec_digit_val(c: char) -> int { return (c as int) - ('0' as int); } - fn hex_digit_val(c: char) -> int { if in_range(c, '0', '9') { return (c as int) - ('0' as int); } if in_range(c, 'a', 'f') { return (c as int) - ('a' as int) + 10; } @@ -282,13 +280,6 @@ fn hex_digit_val(c: char) -> int { fail!(); } -fn oct_digit_val(c: char) -> int { - if in_range(c, '0', '7') { return (c as int) - ('0' as int); } - fail!(); -} - -fn bin_digit_value(c: char) -> int { if c == '0' { return 0; } return 1; } - pub fn is_whitespace(c: char) -> bool { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; } @@ -304,10 +295,6 @@ fn is_hex_digit(c: char) -> bool { in_range(c, 'A', 'F'); } -fn is_oct_digit(c: char) -> bool { return in_range(c, '0', '7'); } - -fn is_bin_digit(c: char) -> bool { return c == '0' || c == '1'; } - // EFFECT: eats whitespace and comments. // returns a Some(sugared-doc-attr) if one exists, None otherwise. fn consume_whitespace_and_comments(rdr: @mut StringReader) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8c4bf5d87ab..62bfd7c80f9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -135,13 +135,6 @@ pub enum item_or_view_item { iovi_view_item(view_item) } -#[deriving(Eq)] -enum view_item_parse_mode { - VIEW_ITEMS_AND_ITEMS_ALLOWED, - FOREIGN_ITEMS_ALLOWED, - IMPORTS_AND_ITEMS_ALLOWED -} - /* The expr situation is not as complex as I thought it would be. The important thing is to make sure that lookahead doesn't balk at INTERPOLATED tokens */ @@ -3455,18 +3448,6 @@ impl Parser { }) } - fn parse_optional_purity(&self) -> ast::purity { - if self.eat_keyword(keywords::Unsafe) { - ast::unsafe_fn - } else { - ast::impure_fn - } - } - - fn parse_optional_onceness(&self) -> ast::Onceness { - if self.eat_keyword(keywords::Once) { ast::Once } else { ast::Many } - } - // matches optbounds = ( ( : ( boundseq )? )? ) // where boundseq = ( bound + boundseq ) | bound // and bound = 'static | ty @@ -3531,15 +3512,6 @@ impl Parser { } } - // parse a generic use site - fn parse_generic_values(&self) -> (OptVec<ast::Lifetime>, ~[P<Ty>]) { - if !self.eat(&token::LT) { - (opt_vec::Empty, ~[]) - } else { - self.parse_generic_values_after_lt() - } - } - fn parse_generic_values_after_lt(&self) -> (OptVec<ast::Lifetime>, ~[P<Ty>]) { let lifetimes = self.parse_lifetimes(); let result = self.parse_seq_to_gt( @@ -4080,13 +4052,6 @@ impl Parser { None) } - fn token_is_pound_or_doc_comment(&self, tok: token::Token) -> bool { - match tok { - token::POUND | token::DOC_COMMENT(_) => true, - _ => false - } - } - // parse a structure field declaration pub fn parse_single_struct_field(&self, vis: visibility, @@ -4556,26 +4521,6 @@ impl Parser { (id, item_enum(enum_definition, generics), None) } - fn parse_fn_ty_sigil(&self) -> Option<Sigil> { - match *self.token { - token::AT => { - self.bump(); - Some(ManagedSigil) - } - token::TILDE => { - self.bump(); - Some(OwnedSigil) - } - token::BINOP(token::AND) => { - self.bump(); - Some(BorrowedSigil) - } - _ => { - None - } - } - } - fn fn_expr_lookahead(&self, tok: &token::Token) -> bool { match *tok { token::LPAREN | token::AT | token::TILDE | token::BINOP(_) => true, @@ -4983,51 +4928,6 @@ impl Parser { return vp; } - fn is_view_item(&self) -> bool { - if !self.is_keyword(keywords::Pub) && !self.is_keyword(keywords::Priv) { - token::is_keyword(keywords::Use, self.token) - || (token::is_keyword(keywords::Extern, self.token) && - self.look_ahead(1, - |t| token::is_keyword(keywords::Mod, t))) - } else { - self.look_ahead(1, |t| token::is_keyword(keywords::Use, t)) - || (self.look_ahead(1, - |t| token::is_keyword(keywords::Extern, - t)) && - self.look_ahead(2, - |t| token::is_keyword(keywords::Mod, t))) - } - } - - // parse a view item. - fn parse_view_item( - &self, - attrs: ~[Attribute], - vis: visibility - ) -> view_item { - let lo = self.span.lo; - let node = if self.eat_keyword(keywords::Use) { - self.parse_use() - } else if self.eat_keyword(keywords::Extern) { - self.expect_keyword(keywords::Mod); - let ident = self.parse_ident(); - let path = if *self.token == token::EQ { - self.bump(); - Some(self.parse_str()) - } - else { None }; - let metadata = self.parse_optional_meta(); - view_item_extern_mod(ident, path, metadata, ast::DUMMY_NODE_ID) - } else { - self.bug("expected view item"); - }; - self.expect(&token::SEMI); - ast::view_item { node: node, - attrs: attrs, - vis: vis, - span: mk_sp(lo, self.last_span.hi) } - } - // Parses a sequence of items. Stops when it finds program // text that can't be parsed as an item // - mod_items uses extern_mod_allowed = true |
