A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scanner.hpp File Reference
#include <assert.h>
#include <cctype>
#include <functional>
#include <stdexcept>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Enumerations

enum  SkipWhitespace : unsigned char { kNone = 0, kLeading = 1, kTrailing = 2, kSurrounding = 3 }
 Option to determine how to treat surrounding whitespace when scanning an input stream. More...
 

Functions

template<typename InputStream >
void affirm_char_or_throw (InputStream &source, char criterion, SkipWhitespace skip_ws=SkipWhitespace::kNone)
 Lexing function that checks whether the current char from the stream equals the provided one. More...
 
template<typename InputStream >
void affirm_char_or_throw (InputStream &source, std::function< bool(char)> criterion, SkipWhitespace skip_ws=SkipWhitespace::kNone)
 Lexing function that checks whether the current char from the stream fulfills the provided criterion. More...
 
bool operator& (SkipWhitespace lhs, SkipWhitespace rhs)
 And-operator to check whether a SkipWhitespace is set. More...
 
template<typename InputStream >
char read_char_or_throw (InputStream &source, char criterion, SkipWhitespace skip_ws=SkipWhitespace::kNone)
 Lexing function that reads a single char from the stream and checks whether it equals the provided one. More...
 
template<typename InputStream >
char read_char_or_throw (InputStream &source, std::function< bool(char)> criterion, SkipWhitespace skip_ws=SkipWhitespace::kNone)
 Lexing function that reads a single char from the stream and checks whether it fulfills the provided criterion. More...
 
template<typename InputStream >
std::string read_to_end_of_line (InputStream &source)
 Lexing function that reads until the end of the line (i.e., to the new line char), and returns the read chars (excluding the new line char). More...
 
template<typename InputStream >
std::string read_until (InputStream &source, char criterion)
 Lexing function that reads from the stream until its current char equals the provided one. The read chars are returned. More...
 
template<typename InputStream >
std::string read_until (InputStream &source, std::function< bool(char)> criterion)
 Lexing function that reads from the stream until its current char fulfills the provided criterion. The read chars are returned. More...
 
template<typename InputStream >
std::string read_while (InputStream &source, char criterion)
 Lexing function that reads from the stream while its current char equals the provided one. The read chars are returned. More...
 
template<typename InputStream >
std::string read_while (InputStream &source, std::function< bool(char)> criterion)
 Lexing function that reads from the stream while its current char fulfills the provided criterion. The read chars are returned. More...
 
template<typename InputStream >
void skip_to_end_of_line (InputStream &source)
 Lexing function that advances the stream to the end of the line, i.e., to the new line char. More...
 
template<typename InputStream >
void skip_until (InputStream &source, char criterion)
 Lexing function that advances the stream until its current char equals the provided one. More...
 
template<typename InputStream >
void skip_until (InputStream &source, std::function< bool(char)> criterion)
 Lexing function that advances the stream until its current char fulfills the provided criterion. More...
 
template<typename InputStream >
void skip_while (InputStream &source, char criterion)
 Lexing function that advances the stream while its current char equals the provided one. More...
 
template<typename InputStream >
void skip_while (InputStream &source, std::function< bool(char)> criterion)
 Lexing function that advances the stream while its current char fulfills the provided criterion. More...