14 m(K_module, "module") \
15 m(K_import, "import") \
16 m(K_plugin, "plugin") \
22 m(K_where, "where" ) \
26 m(K_extern, "extern") \
53#define CODE(t, str) + size_t(1)
58 m(EoF, "<end of file>" ) \
60 m(L_s, "<signed integer literal>") \
61 m(L_u, "<integer literal>" ) \
62 m(L_i, "<index literal>" ) \
63 m(L_f, "<floating-point literal>") \
64 m(L_c, "<char literal>" ) \
65 m(L_str, "<string literal>" ) \
67 m(M_id, "<identifier>" ) \
68 m(M_anx, "<annex name>" ) \
89 m(T_colon_colon,"::") \
102 m("insert", K_ins ) \
126#define CODE(t, str) t,
152 , u_(
std::bit_cast<uint64_t>(s)) {}
156 , u_(
std::bit_cast<uint64_t>(d)) {}
165 assert(
tag == Tag::M_id ||
tag == Tag::M_anx ||
tag == Tag::L_str);
171 Loc
loc()
const {
return loc_; }
172 explicit operator bool()
const {
return tag_ != Tag::Nil; }
175 char8_t lit_c()
const { assert(
isa(Tag::L_c));
return c_; }
176 uint64_t
lit_u()
const { assert(
isa(Tag::L_u ) ||
isa(Tag::L_s ) ||
isa(Tag::L_f ));
return u_; }
177 Sym
sym()
const { assert(
isa(Tag::M_anx) ||
isa(Tag::M_id) ||
isa(Tag::L_str));
return sym_; }
179 std::string
str()
const;
friend std::ostream & operator<<(std::ostream &, Tok)
const Lit * lit_i() const
Tok(Loc loc, Tag tag, Sym sym)
Tok(Loc loc, const Lit *i)
static constexpr Tok::Tag delim_l2r(Tag tag)
friend std::ostream & operator<<(std::ostream &os, Tok::Tag tag)
static const char * tag2str(Tok::Tag)
constexpr bool is_rassoc(Prec p)