Add a predicate that determines whether a token can begin an expression
This commit is contained in:
parent
48a69d2100
commit
6369807ffe
1 changed files with 21 additions and 0 deletions
|
@ -172,6 +172,27 @@ fn to_str(lexer::reader r, token t) -> str {
|
|||
case (EOF) { ret "<eof>"; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pred can_begin_expr(token t) -> bool {
|
||||
alt (t) {
|
||||
case (LPAREN) { true }
|
||||
case (LBRACE) { true }
|
||||
case (IDENT(_,_)) { true }
|
||||
case (UNDERSCORE) { true }
|
||||
case (TILDE) { true }
|
||||
case (LIT_INT(_)) { true }
|
||||
case (LIT_UINT(_)) { true }
|
||||
case (LIT_MACH_INT(_,_)) { true }
|
||||
case (LIT_FLOAT(_)) { true }
|
||||
case (LIT_MACH_FLOAT(_,_)) { true }
|
||||
case (LIT_STR(_)) { true }
|
||||
case (LIT_CHAR(_)) { true }
|
||||
case (POUND) { true }
|
||||
case (AT) { true }
|
||||
case (_) { false }
|
||||
}
|
||||
}
|
||||
// Local Variables:
|
||||
// fill-column: 78;
|
||||
// indent-tabs-mode: nil
|
||||
|
|
Loading…
Reference in a new issue