fix(frontends/lean/structure_cmd): reject internal field names

Fixes #1539
This commit is contained in:
Sebastian Ullrich 2017-04-25 14:33:57 +02:00 committed by Leonardo de Moura
parent b27100ec5a
commit dd1f3e5f8c

View file

@ -800,7 +800,10 @@ struct structure_cmd_fn {
auto start_pos = m_p.pos();
while (m_p.curr_is_identifier()) {
auto p = m_p.pos();
names.emplace_back(p, m_p.check_atomic_id_next("invalid field, atomic identifier expected"));
auto n = m_p.check_atomic_id_next("invalid field, atomic identifier expected");
if (is_internal_subobject_field(n))
throw parser_error(sstream() << "invalid field name '" << n << "', identifiers starting with '_' are reserved to the system", p);
names.emplace_back(p, n);
}
if (names.empty())
throw parser_error("invalid field, identifier expected", m_p.pos());