klee
|
Lexer - Interface for lexing tokens from a .kquery language file. More...
#include <Lexer.h>
Public Member Functions | |
Lexer (const llvm::MemoryBuffer *_buf) | |
~Lexer () | |
Token & | Lex (Token &Result) |
Private Member Functions | |
int | GetNextChar () |
The current column. More... | |
int | PeekNextChar () |
Token & | SetTokenKind (Token &Result, Token::Kind k) |
Token & | SetIdentifierTokenKind (Token &Result) |
void | SkipToEndOfLine () |
Token & | LexNumber (Token &Result) |
LexNumber - Lex a number which does not have a base specifier. More... | |
Token & | LexIdentifier (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... | |
Lexer - Interface for lexing tokens from a .kquery language file.
|
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().
Lex - Return the next token from the file or EOF continually when the end of the file is reached. The input argument is used as the result, for convenience.
Definition at line 210 of file Lexer.cpp.
References klee::expr::Token::Arrow, klee::expr::Token::At, BufferPos, klee::expr::Token::Colon, klee::expr::Token::column, ColumnNumber, klee::expr::Token::Comma, klee::expr::Token::Comment, klee::expr::Token::EndOfFile, klee::expr::Token::Equals, GetNextChar(), klee::expr::Token::kind, klee::expr::Token::LBrace, klee::expr::Token::length, LexIdentifier(), LexNumber(), klee::expr::Token::line, LineNumber, klee::expr::Token::LParen, klee::expr::Token::LSquare, PeekNextChar(), klee::expr::Token::RBrace, klee::expr::Token::RParen, klee::expr::Token::RSquare, klee::expr::Token::Semicolon, SetTokenKind(), SkipToEndOfLine(), klee::expr::Token::start, and klee::expr::Token::Unknown.
Referenced by PrintInputTokens().
LexIdentifier - Lex an identifier.
Definition at line 202 of file Lexer.cpp.
References GetNextChar(), isInternalIdentifierChar(), PeekNextChar(), and SetIdentifierTokenKind().
Referenced by Lex().
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().
|
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().
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().
|
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().
|
private |
Definition at line 188 of file Lexer.cpp.
References GetNextChar().
Referenced by Lex().
|
private |
The current lexer position.
Definition at line 80 of file Lexer.h.
Referenced by GetNextChar(), and PeekNextChar().
|
private |
Definition at line 79 of file Lexer.h.
Referenced by GetNextChar(), Lex(), PeekNextChar(), SetIdentifierTokenKind(), and SetTokenKind().
|
private |
|
private |
The buffer end position.
Definition at line 81 of file Lexer.h.
Referenced by GetNextChar(), and Lex().