parse minus before number literal

This commit is contained in:
csmoe
2018-12-30 21:51:40 +08:00
parent e422c2e2f4
commit 53c94e3ad8
3 changed files with 51 additions and 33 deletions

View File

@@ -48,11 +48,16 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> {
// test literal_pattern
// fn main() {
// match () {
// -1 => (),
// 92 => (),
// 'c' => (),
// "hello" => (),
// }
// }
if p.at(MINUS) && (p.nth(1) == INT_NUMBER || p.nth(1) == FLOAT_NUMBER) {
p.bump();
}
if let Some(m) = expressions::literal(p) {
return Some(m);
}