reglibcpp  1.3.0
(Naïve) C++ implementation of models for regular languages
Classes | Typedefs | Functions | Variables
dfa.cpp File Reference

Contains the reg::dfa member definitions. More...

#include "dfa.h"
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
#include <algorithm>
#include <cstdint>
#include "nfa.h"
#include "expression.h"

Go to the source code of this file.

Classes

struct  reg::dfa::pImpl
 Private implementation details of DFAs. More...
 
struct  reg::dfa::builder::pImpl
 Private implementation details of DFA builders. More...
 
struct  reg::dfa::builder::pImpl::ValarrayBoolHasher
 Hasher object for valarray<bool>s, so they can be used as unordered_set keys. More...
 
struct  reg::dfa::builder::pImpl::ValarrayBoolEqualTo
 Comparison object for valarray<bool>s against a specific instance. More...
 
struct  reg::dfa::builder::pImpl::ValarrayBoolEqual
 Comparison object for valarray<bool>s, so they can be used as unordered_set keys. More...
 

Typedefs

using reg::Dtransitionmap = unordered_map< string, unordered_map< char32_t, string > >
 

Functions

template<class T >
size_t reg::index_of (vector< T > const &vec, T const &element)
 Basically Java's List interface's indexOf, but as a non-member function and returning the container's size upon failure. More...
 
template size_t reg::index_of (vector< char32_t > const &vec, char32_t const &element)
 Explicit instantiation for use in other translation units. More...
 

Variables

std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > reg::converter
 Converts between UTF-8-encoded and UTF-32-encoded strings. More...
 

Detailed Description

Contains the reg::dfa member definitions.

Definition in file dfa.cpp.

Function Documentation

◆ index_of() [1/2]

template<class T >
size_t reg::index_of ( vector< T > const &  vec,
T const &  element 
)

Basically Java's List interface's indexOf, but as a non-member function and returning the container's size upon failure.

Parameters
vecthe container to search through
elementthe element to find the index of
Returns
the first i with vec[i]==element or vec.size() if none is found

Definition at line 995 of file dfa.cpp.

995  {
996  return static_cast<size_t>(std::distance(vec.begin(), find(vec.begin(), vec.end(), element)));
997 }

◆ index_of() [2/2]

template size_t reg::index_of ( vector< char32_t > const &  vec,
char32_t const &  element 
)

Explicit instantiation for use in other translation units.

Variable Documentation

◆ converter

std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > reg::converter

Converts between UTF-8-encoded and UTF-32-encoded strings.

Definition at line 1001 of file dfa.cpp.