/* Copyright (c) 2015 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #pragma once #include #include "kernel/environment.h" #include "library/attribute_manager.h" #include "library/io_state.h" namespace lean { unsigned get_default_priority(options const & opts); class parser; class decl_attributes { public: struct entry { attribute const * m_attr; attr_data_ptr m_params; bool deleted() const { return !static_cast(m_params); } }; private: bool m_persistent; bool m_parsing_only; list m_entries; optional m_prio; void parse_core(parser & p, bool compact); public: decl_attributes(bool persistent = true): m_persistent(persistent), m_parsing_only(false) {} void set_attribute(environment const & env, name const & attr_name); /* attributes: zero-or-more [ ... ] */ void parse(parser & p); /* Parse attributes after `@[` ... ] */ void parse_compact(parser & p); environment apply(environment env, io_state const & ios, name const & d) const; list const & get_entries() const { return m_entries; } bool is_parsing_only() const { return m_parsing_only; } optional get_priority() const { return m_prio; } bool ok_for_inductive_type() const; bool has_class() const; operator bool() const { return static_cast(m_entries); } }; void initialize_decl_attributes(); void finalize_decl_attributes(); }