llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
Public Types | Public Member Functions | List of all members
Lexer Class Referencefinal

#include <core/lexer.h>

Public Types

enum  Token {
  NEWLINE, END, LBRACKET, RBRACKET,
  LPAREN, RPAREN, COMMA, REG,
  VREG, IDENT, COLON, NUMBER,
  ANNOT, STRING, PLUS, MINUS
}
 Enumeration of tokens extracted from the stream.
 

Public Member Functions

 Lexer (llvm::StringRef buf)
 Creates a lexer for a stream.
 
 ~Lexer ()
 Cleanup.
 
Token GetToken () const
 Returns the current token.
 
Token NextToken ()
 Fetches the next token.
 
void Expect (Token type)
 Checks if the next character is of a specific type.
 
void Check (Token type)
 Checks if the current token is of a specific type.
 
bool AtEnd () const
 Checks whether the end of stream was reached.
 
std::string_view String () const
 Returns the current string.
 
int64_t Int () const
 Returns the current integer.
 
Register Reg () const
 Returns the current register.
 
uint64_t VReg () const
 Returns the current virtual register.
 
SExp ParseSExp ()
 Parses an S-Expression.
 
void Error (const std::string &msg)
 Error reporting.
 
void Error (Func *f, const std::string &msg)
 
void Error (Func *f, Block *b, const std::string &msg)
 

Detailed Description

Breaks an assembly source file into tokens.


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