feat(frontends/lean/builtin_cmds): allow many namespaces in the same 'using' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
d30f387e72
commit
b9d08ff28c
5 changed files with 48 additions and 48 deletions
|
@ -170,6 +170,7 @@ static void check_identifier(parser & p, environment const & env, name const & n
|
||||||
// using [class] id (id ...) (renaming id->id id->id) (hiding id ... id)
|
// using [class] id (id ...) (renaming id->id id->id) (hiding id ... id)
|
||||||
environment using_cmd(parser & p) {
|
environment using_cmd(parser & p) {
|
||||||
environment env = p.env();
|
environment env = p.env();
|
||||||
|
while (true) {
|
||||||
name cls = parse_class(p);
|
name cls = parse_class(p);
|
||||||
bool decls = cls.is_anonymous() || cls == g_decls || cls == g_declarations;
|
bool decls = cls.is_anonymous() || cls == g_decls || cls == g_declarations;
|
||||||
name ns = p.check_id_next("invalid 'using' command, identifier expected");
|
name ns = p.check_id_next("invalid 'using' command, identifier expected");
|
||||||
|
@ -217,6 +218,9 @@ environment using_cmd(parser & p) {
|
||||||
if (!found_explicit)
|
if (!found_explicit)
|
||||||
env = add_aliases(env, ns, name(), exceptions.size(), exceptions.data());
|
env = add_aliases(env, ns, name(), exceptions.size(), exceptions.data());
|
||||||
}
|
}
|
||||||
|
if (!p.curr_is_token(g_lbracket) && !p.curr_is_identifier())
|
||||||
|
break;
|
||||||
|
}
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import standard
|
import standard
|
||||||
using num
|
using num pair
|
||||||
using pair
|
|
||||||
|
|
||||||
definition H : inhabited (Bool × num × (num → num)) := _
|
definition H : inhabited (Bool × num × (num → num)) := _
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import standard
|
import standard
|
||||||
using num
|
using num pair
|
||||||
using pair
|
|
||||||
|
|
||||||
theorem H {A B : Type} (H1 : inhabited A) : inhabited (Bool × A × (B → num))
|
theorem H {A B : Type} (H1 : inhabited A) : inhabited (Bool × A × (B → num))
|
||||||
:= _
|
:= _
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import standard
|
import standard
|
||||||
using num
|
using num pair
|
||||||
using pair
|
|
||||||
|
|
||||||
section
|
section
|
||||||
parameter {A : Type}
|
parameter {A : Type}
|
||||||
|
|
|
@ -25,8 +25,7 @@ namespace nat
|
||||||
end
|
end
|
||||||
|
|
||||||
section
|
section
|
||||||
using algebra
|
using algebra nat
|
||||||
using nat
|
|
||||||
variables a b c : nat
|
variables a b c : nat
|
||||||
check a * b * c
|
check a * b * c
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue