MLIR  20.0.0git
Public Member Functions | List of all members
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. More...
 
ast::DiagnosticEnginegetDiagEngine ()
 Return a reference to the diagnostic engine used by the lexer. More...
 
LogicalResult pushInclude (StringRef filename, SMRange includeLoc)
 Push an include of the given file. More...
 
Token lexToken ()
 Lex the next token and return it. More...
 
void resetPointer (const char *newPointer)
 Change the position of the lexer cursor. More...
 
Token emitError (SMRange loc, const Twine &msg)
 Emit an error to the lexer with the given location and message. More...
 
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 
)

◆ ~Lexer()

Lexer::~Lexer ( )

Definition at line 102 of file Lexer.cpp.

References mlir::pdll::ast::DiagnosticEngine::setHandlerFn().

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::ast::DiagnosticEngine::emitError(), and mlir::pdll::Token::error.

◆ emitErrorAndNote()

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

◆ 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.

◆ 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: