MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::ast::Tok Class Reference

#include <mim/ast/tok.h>

Public Member Functions

 Tok ()
 
 Tok (Loc loc, Tag tag)
 
 Tok (Loc loc, char8_t c)
 
 Tok (Loc loc, uint64_t u)
 
 Tok (Loc loc, int64_t s)
 
 Tok (Loc loc, double d)
 
 Tok (Loc loc, const Lit *i)
 
 Tok (Loc loc, Tag tag, Sym sym)
 
bool isa (Tag tag) const
 
Tag tag () const
 
Dbg dbg () const
 
Loc loc () const
 
 operator bool () const
 
const Litlit_i () const
 
char8_t lit_c () const
 
uint64_t lit_u () const
 
Sym sym () const
 
std::string str () const
 

Friends

std::ostream & operator<< (std::ostream &os, Tok tok)
 
std::ostream & operator<< (std::ostream &os, Tok::Tag tag)
 

Tag

enum class  Tag {
  Nil ,
  CODE ,
  K_module ,
  K_import ,
  K_plugin ,
  K_and ,
  K_ax ,
  K_let ,
  K_rec ,
  K_ret ,
  K_where ,
  K_end ,
  K_Nat ,
  K_Idx ,
  K_extern ,
  K_Type ,
  K_Univ ,
  K_Cn ,
  K_Fn ,
  K_con ,
  K_fun ,
  K_lam ,
  K_ccon ,
  K_cfun ,
  K_cn ,
  K_fn ,
  K_ff ,
  K_tt ,
  K_ins ,
  K_i1 ,
  K_i8 ,
  K_i16 ,
  K_i32 ,
  K_i64 ,
  K_Bool ,
  K_I1 ,
  K_I8 ,
  K_I16 ,
  K_I32 ,
  K_I64 ,
  EoF ,
  L_s ,
  L_u ,
  L_i ,
  L_f ,
  L_c ,
  L_str ,
  M_id ,
  M_anx ,
  D_angle_l ,
  D_angle_r ,
  D_brace_l ,
  D_brace_r ,
  D_brckt_l ,
  D_brckt_r ,
  D_paren_l ,
  D_paren_r ,
  D_quote_l ,
  D_quote_r ,
  T_arrow ,
  T_assign ,
  T_at ,
  T_backtick ,
  T_bot ,
  T_top ,
  T_box ,
  T_colon ,
  T_colon_colon ,
  T_comma ,
  T_dollar ,
  T_dot ,
  T_extract ,
  T_lm ,
  T_semicolon ,
  T_star
}
 
static const char * tag2str (Tok::Tag)
 
static constexpr Tok::Tag delim_l2r (Tag tag)
 

Detailed Description

Definition at line 120 of file tok.h.

Member Enumeration Documentation

◆ Tag

enum class mim::ast::Tok::Tag
strong
Enumerator
Nil 
CODE 
K_module 
K_import 
K_plugin 
K_and 
K_ax 
K_let 
K_rec 
K_ret 
K_where 
K_end 
K_Nat 
K_Idx 
K_extern 
K_Type 
K_Univ 
K_Cn 
K_Fn 
K_con 
K_fun 
K_lam 
K_ccon 
K_cfun 
K_cn 
K_fn 
K_ff 
K_tt 
K_ins 
K_i1 
K_i8 
K_i16 
K_i32 
K_i64 
K_Bool 
K_I1 
K_I8 
K_I16 
K_I32 
K_I64 
EoF 
L_s 
L_u 
L_i 
L_f 
L_c 
L_str 
M_id 
M_anx 
D_angle_l 
D_angle_r 
D_brace_l 
D_brace_r 
D_brckt_l 
D_brckt_r 
D_paren_l 
D_paren_r 
D_quote_l 
D_quote_r 
T_arrow 
T_assign 
T_at 
T_backtick 
T_bot 
T_top 
T_box 
T_colon 
T_colon_colon 
T_comma 
T_dollar 
T_dot 
T_extract 
T_lm 
T_semicolon 
T_star 

Definition at line 124 of file tok.h.

Constructor & Destructor Documentation

◆ Tok() [1/8]

mim::ast::Tok::Tok ( )
inline

Definition at line 137 of file tok.h.

◆ Tok() [2/8]

mim::ast::Tok::Tok ( Loc loc,
Tag tag )
inline

Definition at line 138 of file tok.h.

◆ Tok() [3/8]

mim::ast::Tok::Tok ( Loc loc,
char8_t c )
inline

Definition at line 141 of file tok.h.

◆ Tok() [4/8]

mim::ast::Tok::Tok ( Loc loc,
uint64_t u )
inline

Definition at line 145 of file tok.h.

◆ Tok() [5/8]

mim::ast::Tok::Tok ( Loc loc,
int64_t s )
inline

Definition at line 149 of file tok.h.

◆ Tok() [6/8]

mim::ast::Tok::Tok ( Loc loc,
double d )
inline

Definition at line 153 of file tok.h.

◆ Tok() [7/8]

mim::ast::Tok::Tok ( Loc loc,
const Lit * i )
inline

Definition at line 157 of file tok.h.

◆ Tok() [8/8]

mim::ast::Tok::Tok ( Loc loc,
Tag tag,
Sym sym )
inline

Definition at line 161 of file tok.h.

References tag().

Member Function Documentation

◆ dbg()

Dbg mim::ast::Tok::dbg ( ) const
inline

Definition at line 170 of file tok.h.

References loc(), and sym().

◆ delim_l2r()

static constexpr Tok::Tag mim::ast::Tok::delim_l2r ( Tag tag)
inlinestaticconstexpr

Definition at line 132 of file tok.h.

References tag().

Referenced by mim::ast::TuplePtrn::delim_r().

◆ isa()

bool mim::ast::Tok::isa ( Tag tag) const
inline

Definition at line 168 of file tok.h.

References tag().

Referenced by lit_c(), lit_i(), lit_u(), and sym().

◆ lit_c()

char8_t mim::ast::Tok::lit_c ( ) const
inline

Definition at line 175 of file tok.h.

References isa().

◆ lit_i()

const Lit * mim::ast::Tok::lit_i ( ) const
inline

Definition at line 174 of file tok.h.

References isa().

Referenced by mim::ast::LitExpr::emit_().

◆ lit_u()

uint64_t mim::ast::Tok::lit_u ( ) const
inline

Definition at line 176 of file tok.h.

References isa().

Referenced by mim::ast::LitExpr::stream().

◆ loc()

Loc mim::ast::Tok::loc ( ) const
inline

Definition at line 171 of file tok.h.

Referenced by dbg().

◆ operator bool()

mim::ast::Tok::operator bool ( ) const
inlineexplicit

Definition at line 172 of file tok.h.

◆ str()

std::string mim::ast::Tok::str ( ) const

Definition at line 22 of file tok.cpp.

◆ sym()

Sym mim::ast::Tok::sym ( ) const
inline

Definition at line 177 of file tok.h.

References isa().

Referenced by dbg().

◆ tag()

Tag mim::ast::Tok::tag ( ) const
inline

Definition at line 169 of file tok.h.

Referenced by delim_l2r(), isa(), mim::ast::LitExpr::tag(), tag2str(), and Tok().

◆ tag2str()

const char * mim::ast::Tok::tag2str ( Tok::Tag tag)
static

Definition at line 10 of file tok.cpp.

References CODE, MIM_KEY, MIM_TOK, and tag().

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & os,
Tok tok )
friend

Definition at line 30 of file tok.cpp.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & os,
Tok::Tag tag )
friend

Definition at line 182 of file tok.h.


The documentation for this class was generated from the following files: