fix(frontends/lean/parser): allow parenthesis in level expressions

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-12-23 13:31:55 -08:00
parent 5244ccafe8
commit 5043cc75f6
3 changed files with 12 additions and 0 deletions

View file

@ -558,10 +558,18 @@ class parser::imp {
return level() + val.get_unsigned_int();
}
level parse_level_lparen() {
next();
level r = parse_level();
check_rparen_next("invalid level expression, ')' expected");
return r;
}
level parse_level_nud() {
switch (curr()) {
case scanner::token::Id: return parse_level_nud_id();
case scanner::token::NatVal: return parse_level_nud_int();
case scanner::token::LeftParen: return parse_level_lparen();
default:
throw parser_error("invalid level expression", pos());
}

1
tests/lean/level1.lean Normal file
View file

@ -0,0 +1 @@
Variable T : (Type (max U+1 U+2)).

View file

@ -0,0 +1,3 @@
Set: pp::colors
Set: pp::unicode
Assumed: T