Lexical analysis tool.
More...
#include <ogdf/fileformats/DotLexer.h>
|
bool | identifier (Token &token) |
| Checks whether head is an identifier. More...
|
|
bool | isDotAlnum (signed char c) |
| Checks if character is allowed in an identifier by DOT standard. More...
|
|
bool | match (const std::string &str, bool word=false) |
| Checks if head matches given string. Advances head on success. More...
|
|
bool | match (const Token::Type &type, bool word=false) |
| Checks if head matches given token. Advances head on success. More...
|
|
bool | tokenizeLine () |
|
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).
- See also
- dot::Parser
Definition at line 105 of file DotLexer.h.
◆ Lexer()
ogdf::dot::Lexer::Lexer |
( |
std::istream & |
input | ) |
|
|
explicit |
Initializes lexer with given input (but does nothing to it).
◆ ~Lexer()
ogdf::dot::Lexer::~Lexer |
( |
| ) |
|
◆ identifier()
bool ogdf::dot::Lexer::identifier |
( |
Token & |
token | ) |
|
|
private |
Checks whether head is an identifier.
- Parameters
-
token | Function fills it with identifier value and col/row info. |
- Returns
- True if matches, false otherwise.
◆ isDotAlnum()
bool ogdf::dot::Lexer::isDotAlnum |
( |
signed char |
c | ) |
|
|
private |
Checks if character is allowed in an identifier by DOT standard.
- Parameters
-
- Returns
- True if c is one of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_') or digits ([0-9])
◆ match() [1/2]
bool ogdf::dot::Lexer::match |
( |
const std::string & |
str, |
|
|
bool |
word = false |
|
) |
| |
|
private |
Checks if head matches given string. Advances head on success.
- Parameters
-
str | A string being matched. |
word | True if token is part of a word, false otherwise. |
- Returns
- True if matches, false otherwise.
◆ match() [2/2]
bool ogdf::dot::Lexer::match |
( |
const Token::Type & |
type, |
|
|
bool |
word = false |
|
) |
| |
|
private |
Checks if head matches given token. Advances head on success.
- Parameters
-
type | A type of token being matched. |
word | True if token is part of a word, false otherwise. |
- Returns
- True if matches, false otherwise.
◆ tokenize()
bool ogdf::dot::Lexer::tokenize |
( |
| ) |
|
Scans input and turns it into token list.
- Returns
- True if success, false otherwise.
◆ tokenizeLine()
bool ogdf::dot::Lexer::tokenizeLine |
( |
| ) |
|
|
private |
◆ tokens()
const std::vector<Token>& ogdf::dot::Lexer::tokens |
( |
| ) |
const |
◆ m_buffer
std::string ogdf::dot::Lexer::m_buffer |
|
private |
◆ m_col
size_t ogdf::dot::Lexer::m_col |
|
private |
◆ m_input
std::istream& ogdf::dot::Lexer::m_input |
|
private |
◆ m_row
size_t ogdf::dot::Lexer::m_row |
|
private |
◆ m_tokens
std::vector<Token> ogdf::dot::Lexer::m_tokens |
|
private |
The documentation for this class was generated from the following file: