mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Private Types | Private Member Functions | Private Attributes
m::ast::Lexer Struct Reference

#include <Lexer.hpp>

Collaboration diagram for m::ast::Lexer:
[legend]

Public Member Functions

 Lexer (Diagnostic &diag, ThreadSafeStringPool &pool, const char *filename, std::istream &in)
 
void initialize_keywords ()
 Initializes the set of all keywords.
 
Token next ()
 Obtains the next token from the input stream.
 

Data Fields

Diagnosticdiag
 
ThreadSafeStringPoolpool
 
const char * filename
 
std::istream & in
 

Private Types

using Keywords_t = std::unordered_map< ThreadSafePooledString, TokenType >
 
using buf_t = std::vector< char >
 

Private Member Functions

int step ()
 Reads the next character from in to c_, and updates pos_ accordingly.
 
void push ()
 
bool accept (const int c)
 
ThreadSafePooledString internalize ()
 
Token read_keyword_or_identifier ()
 
Token read_number ()
 
Token read_string_literal ()
 
Token read_date_or_datetime ()
 
Token read_instruction ()
 

Private Attributes

Keywords_t keywords_
 
int c_
 
Position pos_
 
Position start_
 
buf_t buf_
 

Detailed Description

Definition at line 16 of file Lexer.hpp.

Member Typedef Documentation

◆ buf_t

using m::ast::Lexer::buf_t = std::vector<char>
private

Definition at line 26 of file Lexer.hpp.

◆ Keywords_t

using m::ast::Lexer::Keywords_t = std::unordered_map<ThreadSafePooledString, TokenType>
private

Definition at line 25 of file Lexer.hpp.

Constructor & Destructor Documentation

◆ Lexer()

m::ast::Lexer::Lexer ( Diagnostic diag,
ThreadSafeStringPool pool,
const char *  filename,
std::istream &  in 
)
inlineexplicit

Definition at line 33 of file Lexer.hpp.

Member Function Documentation

◆ accept()

bool m::ast::Lexer::accept ( const int  c)
inlineprivate

Definition at line 73 of file Lexer.hpp.

Referenced by read_date_or_datetime().

◆ initialize_keywords()

void Lexer::initialize_keywords ( )

Initializes the set of all keywords.

Definition at line 13 of file Lexer.cpp.

◆ internalize()

ThreadSafePooledString m::ast::Lexer::internalize ( )
inlineprivate

◆ next()

Token Lexer::next ( )

◆ push()

void m::ast::Lexer::push ( )
inlineprivate

◆ read_date_or_datetime()

Token Lexer::read_date_or_datetime ( )
private

Definition at line 229 of file Lexer.cpp.

References accept(), c_, diag, DIGITS, m::Diagnostic::e(), internalize(), push(), and start_.

Referenced by next().

◆ read_instruction()

Token Lexer::read_instruction ( )
private

Definition at line 270 of file Lexer.cpp.

References m::and, c_, internalize(), push(), and start_.

Referenced by next().

◆ read_keyword_or_identifier()

Token Lexer::read_keyword_or_identifier ( )
private

Definition at line 116 of file Lexer.cpp.

References c_, internalize(), m::is_alnum(), keywords_, push(), and start_.

Referenced by next().

◆ read_number()

Token Lexer::read_number ( )
private

Definition at line 126 of file Lexer.cpp.

References c_, diag, m::Diagnostic::e(), internalize(), m::is_dec(), m::is_hex(), m::is_oct(), M_insist, push(), and start_.

Referenced by next().

◆ read_string_literal()

Token Lexer::read_string_literal ( )
private

Definition at line 188 of file Lexer.cpp.

References m::and, c_, diag, m::Diagnostic::e(), internalize(), push(), and start_.

Referenced by next().

◆ step()

int m::ast::Lexer::step ( )
inlineprivate

Reads the next character from in to c_, and updates pos_ accordingly.

Definition at line 54 of file Lexer.hpp.

References m::Position::column, and m::Position::line.

Referenced by next().

Field Documentation

◆ buf_

buf_t m::ast::Lexer::buf_
private

Definition at line 30 of file Lexer.hpp.

Referenced by next().

◆ c_

int m::ast::Lexer::c_
private

◆ diag

Diagnostic& m::ast::Lexer::diag

Definition at line 19 of file Lexer.hpp.

Referenced by next(), read_date_or_datetime(), read_number(), and read_string_literal().

◆ filename

const char* m::ast::Lexer::filename

Definition at line 21 of file Lexer.hpp.

◆ in

std::istream& m::ast::Lexer::in

Definition at line 22 of file Lexer.hpp.

◆ keywords_

Keywords_t m::ast::Lexer::keywords_
private

Definition at line 27 of file Lexer.hpp.

Referenced by read_keyword_or_identifier().

◆ pool

ThreadSafeStringPool& m::ast::Lexer::pool

Definition at line 20 of file Lexer.hpp.

Referenced by next().

◆ pos_

Position m::ast::Lexer::pos_
private

Definition at line 29 of file Lexer.hpp.

Referenced by next().

◆ start_

Position m::ast::Lexer::start_
private

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