Lexical analysis tool. More...
#include <ogdf/fileformats/DotLexer.h>
Public Member Functions | |
Lexer (std::istream &input) | |
Initializes lexer with given input (but does nothing to it). | |
~Lexer () | |
bool | tokenize () |
Scans input and turns it into token list. | |
const std::vector< Token > & | tokens () const |
Returns list of tokens (first use Lexer::tokenize()) | |
Private Member Functions | |
bool | identifier (Token &token) |
Checks whether head is an identifier. | |
bool | isDotAlnum (signed char c) |
Checks if character is allowed in an identifier by DOT standard. | |
bool | match (const std::string &str, bool word=false) |
Checks if head matches given string. Advances head on success. | |
bool | match (const Token::Type &type, bool word=false) |
Checks if head matches given token. Advances head on success. | |
bool | tokenizeLine () |
Private Attributes | |
std::string | m_buffer |
size_t | m_col |
std::istream & | m_input |
size_t | m_row |
std::vector< Token > | m_tokens |
Lexical analysis tool.
This class reads the given input and generates a token list. Token list representation of DOT file is much easier for further processing (like parsing) as it automatically gets rid of comments and deals with various identifier representations in DOT format (C-like identifier, double-quoted strings, number literals).
Definition at line 104 of file DotLexer.h.
|
explicit |
Initializes lexer with given input (but does nothing to it).
ogdf::dot::Lexer::~Lexer | ( | ) |
Checks whether head is an identifier.
token | Function fills it with identifier value and col/row info. |
Checks if character is allowed in an identifier by DOT standard.
c | A character |
Checks if head matches given string. Advances head on success.
str | A string being matched. |
word | True if token is part of a word, false otherwise. |
|
private |
Checks if head matches given token. Advances head on success.
type | A type of token being matched. |
word | True if token is part of a word, false otherwise. |
bool ogdf::dot::Lexer::tokenize | ( | ) |
Scans input and turns it into token list.
|
private |
Returns list of tokens (first use Lexer::tokenize())
|
private |
Definition at line 108 of file DotLexer.h.
|
private |
Definition at line 109 of file DotLexer.h.
|
private |
Definition at line 106 of file DotLexer.h.
|
private |
Definition at line 109 of file DotLexer.h.
|
private |
Definition at line 111 of file DotLexer.h.