klee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
klee::expr::Lexer Class Reference

Lexer - Interface for lexing tokens from a .pc language file. More...

#include <Lexer.h>

Public Member Functions

 Lexer (const llvm::MemoryBuffer *_buf)
 
 ~Lexer ()
 
TokenLex (Token &Result)
 

Private Member Functions

int GetNextChar ()
 The current column. More...
 
int PeekNextChar ()
 
TokenSetTokenKind (Token &Result, Token::Kind k)
 
TokenSetIdentifierTokenKind (Token &Result)
 
void SkipToEndOfLine ()
 
TokenLexNumber (Token &Result)
 LexNumber - Lex a number which does not have a base specifier. More...
 
TokenLexIdentifier (Token &Result)
 LexIdentifier - Lex an identifier. More...
 

Private Attributes

const char * BufferPos
 
const char * BufferEnd
 The current lexer position. More...
 
unsigned LineNumber
 The buffer end position. More...
 
unsigned ColumnNumber
 The current line. More...
 

Detailed Description

Lexer - Interface for lexing tokens from a .pc language file.

Definition at line 76 of file Lexer.h.

Constructor & Destructor Documentation

Lexer::Lexer ( const llvm::MemoryBuffer *  _buf)
explicit

Definition at line 66 of file Lexer.cpp.

Lexer::~Lexer ( )

Definition at line 71 of file Lexer.cpp.

Member Function Documentation

int Lexer::GetNextChar ( )
private

The current column.

GetNextChar - Eat a character or -1 from the stream.

Definition at line 80 of file Lexer.cpp.

References BufferEnd, BufferPos, ColumnNumber, and LineNumber.

Referenced by Lex(), LexIdentifier(), LexNumber(), and SkipToEndOfLine().

Here is the caller graph for this function:

Token & Lexer::LexIdentifier ( Token Result)
private

LexIdentifier - Lex an identifier.

Definition at line 202 of file Lexer.cpp.

References GetNextChar(), isInternalIdentifierChar(), PeekNextChar(), and SetIdentifierTokenKind().

Referenced by Lex().

Here is the call graph for this function:

Here is the caller graph for this function:

Token & Lexer::LexNumber ( Token Result)
private

LexNumber - Lex a number which does not have a base specifier.

Definition at line 196 of file Lexer.cpp.

References GetNextChar(), klee::expr::Token::Number, PeekNextChar(), and SetTokenKind().

Referenced by Lex().

Here is the call graph for this function:

Here is the caller graph for this function:

int Lexer::PeekNextChar ( )
private

PeekNextChar - Return the next character without consuming it from the stream. This does not perform newline canonicalization.

Definition at line 74 of file Lexer.cpp.

References BufferEnd, and BufferPos.

Referenced by Lex(), LexIdentifier(), and LexNumber().

Here is the caller graph for this function:

Token & Lexer::SetIdentifierTokenKind ( Token Result)
private

SetTokenKind - Set an identifiers token kind. This has the same requirements as SetTokenKind and additionally takes care of keyword recognition.

Definition at line 140 of file Lexer.cpp.

References BufferPos, klee::expr::Token::Identifier, isReservedKW(), isWidthKW(), klee::expr::Token::KWArray, klee::expr::Token::KWFalse, klee::expr::Token::KWQuery, klee::expr::Token::KWReserved, klee::expr::Token::KWSymbolic, klee::expr::Token::KWTrue, klee::expr::Token::KWWidth, SetTokenKind(), and klee::expr::Token::start.

Referenced by LexIdentifier().

Here is the call graph for this function:

Here is the caller graph for this function:

Token & Lexer::SetTokenKind ( Token Result,
Token::Kind  k 
)
private

SetTokenKind - Set the token kind and length (using the token's start pointer, which must have been initialized).

Definition at line 103 of file Lexer.cpp.

References BufferPos, klee::expr::Token::kind, klee::expr::Token::length, and klee::expr::Token::start.

Referenced by Lex(), LexNumber(), and SetIdentifierTokenKind().

Here is the caller graph for this function:

void Lexer::SkipToEndOfLine ( )
private

Definition at line 188 of file Lexer.cpp.

References GetNextChar().

Referenced by Lex().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

const char* klee::expr::Lexer::BufferEnd
private

The current lexer position.

Definition at line 78 of file Lexer.h.

Referenced by GetNextChar(), and PeekNextChar().

const char* klee::expr::Lexer::BufferPos
private

Definition at line 77 of file Lexer.h.

Referenced by GetNextChar(), Lex(), PeekNextChar(), SetIdentifierTokenKind(), and SetTokenKind().

unsigned klee::expr::Lexer::ColumnNumber
private

The current line.

Definition at line 80 of file Lexer.h.

Referenced by GetNextChar(), and Lex().

unsigned klee::expr::Lexer::LineNumber
private

The buffer end position.

Definition at line 79 of file Lexer.h.

Referenced by GetNextChar(), and Lex().


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