MLIR 22.0.0git
mlir::pdll::Lexer Class Reference

#include "Tools/PDLL/Parser/Lexer.h"

Public Member Functions

 Lexer (llvm::SourceMgr &mgr, ast::DiagnosticEngine &diagEngine, CodeCompleteContext *codeCompleteContext)
 ~Lexer ()
llvm::SourceMgr & getSourceMgr ()
 Return a reference to the source manager used by the lexer.
ast::DiagnosticEnginegetDiagEngine ()
 Return a reference to the diagnostic engine used by the lexer.
LogicalResult pushInclude (StringRef filename, SMRange includeLoc)
 Push an include of the given file.
Token lexToken ()
 Lex the next token and return it.
void resetPointer (const char *newPointer)
 Change the position of the lexer cursor.
Token emitError (SMRange loc, const Twine &msg)
 Emit an error to the lexer with the given location and message.
Token emitError (const char *loc, const Twine &msg)
Token emitErrorAndNote (SMRange loc, const Twine &msg, SMRange noteLoc, const Twine &note)

Detailed Description

Definition at line 165 of file Lexer.h.

Constructor & Destructor Documentation

◆ Lexer()

Lexer::Lexer ( llvm::SourceMgr & mgr,
ast::DiagnosticEngine & diagEngine,
CodeCompleteContext * codeCompleteContext )

Definition at line 74 of file Lexer.cpp.

References false, mlir::pdll::CodeCompleteContext::getCodeCompleteLoc(), and nullptr.

◆ ~Lexer()

Lexer::~Lexer ( )

Definition at line 102 of file Lexer.cpp.

Member Function Documentation

◆ emitError() [1/2]

Token mlir::pdll::Lexer::emitError ( const char * loc,
const Twine & msg )

◆ emitError() [2/2]

Token Lexer::emitError ( SMRange loc,
const Twine & msg )

Emit an error to the lexer with the given location and message.

Definition at line 120 of file Lexer.cpp.

References mlir::pdll::Token::error.

◆ emitErrorAndNote()

Token Lexer::emitErrorAndNote ( SMRange loc,
const Twine & msg,
SMRange noteLoc,
const Twine & note )

Definition at line 124 of file Lexer.cpp.

References mlir::pdll::Token::error.

◆ getDiagEngine()

ast::DiagnosticEngine & mlir::pdll::Lexer::getDiagEngine ( )
inline

Return a reference to the diagnostic engine used by the lexer.

Definition at line 175 of file Lexer.h.

◆ getSourceMgr()

llvm::SourceMgr & mlir::pdll::Lexer::getSourceMgr ( )
inline

Return a reference to the source manager used by the lexer.

Definition at line 172 of file Lexer.h.

◆ lexToken()

Token mlir::pdll::Lexer::lexToken ( )

Lex the next token and return it.

◆ pushInclude()

LogicalResult Lexer::pushInclude ( StringRef filename,
SMRange includeLoc )

Push an include of the given file.

This will cause the lexer to start processing the provided file. Returns failure if the file could not be opened, success otherwise.

Definition at line 107 of file Lexer.cpp.

References success().

◆ resetPointer()

void mlir::pdll::Lexer::resetPointer ( const char * newPointer)
inline

Change the position of the lexer cursor.

The next token we lex will start at the designated point in the input.

Definition at line 187 of file Lexer.h.


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