feat(frontends/lean/parser): allow _
at level expressions
This commit is contained in:
parent
3775d07d5f
commit
71077f5c89
3 changed files with 8 additions and 0 deletions
|
@ -528,6 +528,9 @@ level parser::parse_level_nud() {
|
|||
return parse_max_imax(true);
|
||||
} else if (curr_is_token_or_id(get_imax_tk())) {
|
||||
return parse_max_imax(false);
|
||||
} else if (curr_is_token_or_id(get_placeholder_tk())) {
|
||||
next();
|
||||
return mk_level_placeholder();
|
||||
} else if (curr_is_token(get_lparen_tk())) {
|
||||
next();
|
||||
level l = parse_level();
|
||||
|
|
|
@ -8,6 +8,7 @@ Author: Leonardo de Moura
|
|||
|
||||
namespace lean {
|
||||
static name * g_period = nullptr;
|
||||
static name * g_placeholder = nullptr;
|
||||
static name * g_colon = nullptr;
|
||||
static name * g_dcolon = nullptr;
|
||||
static name * g_lparen = nullptr;
|
||||
|
@ -86,6 +87,7 @@ static name * g_root = nullptr;
|
|||
|
||||
void initialize_tokens() {
|
||||
g_period = new name(".");
|
||||
g_placeholder = new name("_");
|
||||
g_colon = new name(":");
|
||||
g_dcolon = new name("::");
|
||||
g_lparen = new name("(");
|
||||
|
@ -239,10 +241,12 @@ void finalize_tokens() {
|
|||
delete g_lparen;
|
||||
delete g_colon;
|
||||
delete g_dcolon;
|
||||
delete g_placeholder;
|
||||
delete g_period;
|
||||
}
|
||||
|
||||
name const & get_period_tk() { return *g_period; }
|
||||
name const & get_placeholder_tk() { return *g_placeholder; }
|
||||
name const & get_colon_tk() { return *g_colon; }
|
||||
name const & get_dcolon_tk() { return *g_dcolon; }
|
||||
name const & get_lparen_tk() { return *g_lparen; }
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace lean {
|
|||
void initialize_tokens();
|
||||
void finalize_tokens();
|
||||
name const & get_period_tk();
|
||||
name const & get_placeholder_tk();
|
||||
name const & get_colon_tk();
|
||||
name const & get_dcolon_tk();
|
||||
name const & get_lparen_tk();
|
||||
|
|
Loading…
Reference in a new issue