Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::ast::Tok Class Reference

#include <thorin/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 &, 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_Pi ,
  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 121 of file tok.h.

Member Enumeration Documentation

◆ Tag

enum class thorin::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_Pi 
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 125 of file tok.h.

Constructor & Destructor Documentation

◆ Tok() [1/8]

thorin::ast::Tok::Tok ( )
inline

Definition at line 138 of file tok.h.

◆ Tok() [2/8]

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

Definition at line 139 of file tok.h.

◆ Tok() [3/8]

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

Definition at line 142 of file tok.h.

◆ Tok() [4/8]

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

Definition at line 146 of file tok.h.

◆ Tok() [5/8]

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

Definition at line 150 of file tok.h.

◆ Tok() [6/8]

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

Definition at line 154 of file tok.h.

◆ Tok() [7/8]

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

Definition at line 158 of file tok.h.

◆ Tok() [8/8]

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

Definition at line 162 of file tok.h.

References tag().

Member Function Documentation

◆ dbg()

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

Definition at line 171 of file tok.h.

References loc(), and sym().

◆ delim_l2r()

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

Definition at line 133 of file tok.h.

References tag().

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

◆ isa()

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

Definition at line 169 of file tok.h.

References tag().

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

◆ lit_c()

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

Definition at line 176 of file tok.h.

References isa().

◆ lit_i()

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

Definition at line 175 of file tok.h.

References isa().

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

◆ lit_u()

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

Definition at line 177 of file tok.h.

References isa().

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

◆ loc()

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

Definition at line 172 of file tok.h.

Referenced by dbg().

◆ operator bool()

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

Definition at line 173 of file tok.h.

◆ str()

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

Definition at line 22 of file tok.cpp.

◆ sym()

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

Definition at line 178 of file tok.h.

References isa().

Referenced by dbg().

◆ tag()

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

Definition at line 170 of file tok.h.

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

◆ tag2str()

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

Definition at line 10 of file tok.cpp.

References CODE, tag(), THORIN_KEY, and THORIN_TOK.

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 183 of file tok.h.


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