diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index bef5f6d1fd8..95831116258 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -389,7 +389,12 @@ fn next_token_inner(rdr: reader) -> token::token { if rdr.curr == '=' { rdr.bump(); ret token::EQEQ; - } else { ret token::EQ; } + } else if rdr.curr == '>' { + rdr.bump(); + ret token::FAT_ARROW; + } else { + ret token::EQ; + } } '!' { rdr.bump(); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fdc46601d94..8b40e2a8a97 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1281,6 +1281,7 @@ class parser { let pats = self.parse_pats(); let mut guard = none; if self.eat_keyword("if") { guard = some(self.parse_expr()); } + if self.token == token::FAT_ARROW { self.bump(); } let blk = self.parse_block(); arms += [{pats: pats, guard: guard, body: blk}]; } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 044509a5144..cb92aad04c7 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -45,6 +45,7 @@ enum token { RARROW, LARROW, DARROW, + FAT_ARROW, LPAREN, RPAREN, LBRACKET, @@ -111,6 +112,7 @@ fn to_str(in: interner, t: token) -> str { RARROW { ret "->"; } LARROW { ret "<-"; } DARROW { ret "<->"; } + FAT_ARROW { ret "=>"; } LPAREN { ret "("; } RPAREN { ret ")"; } LBRACKET { ret "["; }