Add "<->" to the token definition and the lexer.

This commit is contained in:
Michael Sullivan 2011-06-13 15:48:55 -07:00 committed by Graydon Hoare
parent 32895ad990
commit e8d2d27a88
2 changed files with 9 additions and 1 deletions

View File

@ -389,8 +389,14 @@ fn next_token(&reader rdr) -> token::token {
alt (rdr.curr()) {
case ('=') { rdr.bump(); ret token::LE; }
case ('<') { ret binop(rdr, token::LSL); }
case ('-') { rdr.bump(); ret token::LARROW; }
case ('|') { rdr.bump(); ret token::SEND; }
case ('-') {
rdr.bump();
alt (rdr.curr()) {
case ('>') { rdr.bump(); ret token::DARROW; }
case (_) { ret token::LARROW; }
}
}
case (_) { ret token::LT; }
}
}

View File

@ -52,6 +52,7 @@ tag token {
SEND;
RECV;
LARROW;
DARROW;
LPAREN;
RPAREN;
LBRACKET;
@ -124,6 +125,7 @@ fn to_str(lexer::reader r, token t) -> str {
case (SEND) { ret "<|"; }
case (RECV) { ret "<|"; }
case (LARROW) { ret "<-"; }
case (DARROW) { ret "<->"; }
case (LPAREN) { ret "("; }
case (RPAREN) { ret ")"; }
case (LBRACKET) { ret "["; }