fix(frontends/lean/parser): allow parenthesis in level expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
5244ccafe8
commit
5043cc75f6
3 changed files with 12 additions and 0 deletions
|
@ -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
1
tests/lean/level1.lean
Normal file
|
@ -0,0 +1 @@
|
|||
Variable T : (Type (max U+1 U+2)).
|
3
tests/lean/level1.lean.expected.out
Normal file
3
tests/lean/level1.lean.expected.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
Set: pp::colors
|
||||
Set: pp::unicode
|
||||
Assumed: T
|
Loading…
Reference in a new issue