13#if !defined(ULTRA_SYMBOL_H)
16#include "utility/assert.h"
62 std::numeric_limits<category_t>::max();
72 enum format {c_format, cpp_format, python_format, sup_format};
83 [[nodiscard]] const
std::
string &
name() const noexcept;
85 [[nodiscard]] virtual
std::
string to_string(
format = c_format) const = 0;
91 [[nodiscard]] virtual
bool is_valid() const;
118 return dynamic_cast<const S *
>(s);
171[[nodiscard]]
bool is(
const symbol &s)
static constexpr category_t undefined_category
Sentinel value indicating that the category has not yet been assigned.
Definition symbol.h:61
category_t category() const noexcept
Definition symbol.cc:79
format
Supported rendering formats for symbol stringification.
Definition symbol.h:72
unsigned category_t
Definition symbol.h:55
opcode_t opcode() const noexcept
Definition symbol.cc:93
symbol(const std::string &, category_t=default_category)
Definition symbol.cc:30
unsigned opcode_t
Definition symbol.h:69
virtual bool is_valid() const
Definition symbol.cc:107
virtual ~symbol()=default
Virtual destructor to allow safe polymorphic deletion.
static constexpr category_t default_category
Default category assigned when typing is not used.
Definition symbol.h:58
const std::string & name() const noexcept
Definition symbol.cc:51
auto get_if(const symbol *s)
Definition symbol.h:116
bool is(const symbol *s)
Definition symbol.h:153