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

#include <mim/ast/lexer.h>

Inheritance diagram for mim::ast::Lexer:
[legend]

Public Member Functions

 Lexer (Driver &driver, const fe::Src &src, std::ostream *md=nullptr)
 Creates a lexer to read *.mim files (see Lexical Structure).
 Lexer (Driver &driver, std::string_view buf, std::ostream *md=nullptr)
 As above, but the Locations of the Toks produced have no fe::Src to resolve against.
Driverdriver ()
 fe::Lexer's default diagnostics go to its Driver::error.
Tok lex ()

Static Public Member Functions

static bool is_id (std::string_view str)
 Does str match the id production - the same rule Lexer::lex_id applies to the input?
static std::string escape (std::string_view str)
 Inverse of Lexer::lex_char: renders str as the body of a Mim string literal.

Friends

class fe::Lexer< 3, Lexer >

Detailed Description

Definition at line 13 of file lexer.h.

Constructor & Destructor Documentation

◆ Lexer() [1/2]

mim::ast::Lexer::Lexer ( Driver & driver,
const fe::Src & src,
std::ostream * md = nullptr )
inline

Creates a lexer to read *.mim files (see Lexical Structure).

If md is not nullptr, a Markdown output will be generated.

Definition at line 19 of file lexer.h.

References driver(), and Lexer().

Referenced by fe::Lexer< 3, Lexer >, mim::ast::Parser::import(), Lexer(), and Lexer().

◆ Lexer() [2/2]

mim::ast::Lexer::Lexer ( Driver & driver,
std::string_view buf,
std::ostream * md = nullptr )
inline

As above, but the Locations of the Toks produced have no fe::Src to resolve against.

Definition at line 22 of file lexer.h.

References driver(), and Lexer().

Member Function Documentation

◆ driver()

Driver & mim::ast::Lexer::driver ( )
inline

fe::Lexer's default diagnostics go to its Driver::error.

Definition at line 25 of file lexer.h.

Referenced by lex(), Lexer(), and Lexer().

◆ escape()

std::string mim::ast::Lexer::escape ( std::string_view str)
static

Inverse of Lexer::lex_char: renders str as the body of a Mim string literal.

Definition at line 199 of file lexer.cpp.

References escape().

Referenced by mim::World::dump(), escape(), and mim::ast::UseDecl::stream().

◆ is_id()

bool mim::ast::Lexer::is_id ( std::string_view str)
static

Does str match the id production - the same rule Lexer::lex_id applies to the input?

Definition at line 221 of file lexer.cpp.

References is_id().

Referenced by is_id().

◆ lex()

Tok mim::ast::Lexer::lex ( )

Definition at line 50 of file lexer.cpp.

References driver(), and lex().

Referenced by lex().

◆ fe::Lexer< 3, Lexer >

friend class fe::Lexer< 3, Lexer >
friend

Definition at line 78 of file lexer.h.

References Lexer().


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