Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
GlushkovIndexate.h
Go to the documentation of this file.
1
6#pragma once
7
9
17
18namespace regexp {
19
25public:
30 template < class SymbolType >
32
33 template < class SymbolType >
34 class Unbounded {
35 public:
42 };
43
48 template < class SymbolType >
50
51 template < class SymbolType >
52 class Formal {
53 public:
60 };
61};
62
63template < class SymbolType >
65 unsigned i = 1;
66
67 return UnboundedRegExp < ext::pair < SymbolType, unsigned > > ( regexp::UnboundedRegExpStructure < ext::pair < SymbolType, unsigned > > ( re.getRegExp ( ).getStructure ( ).template accept < ext::ptr_value < regexp::UnboundedRegExpElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Unbounded < SymbolType > > ( i ) ) );
68}
69
70template < class SymbolType >
73
74 for ( const UnboundedRegExpElement < SymbolType > & element : alternation.getElements ( ) )
76
78}
79
80template < class SymbolType >
83
84 for ( const UnboundedRegExpElement < SymbolType > & element : concatenation.getElements ( ) )
86
88}
89
90template < class SymbolType >
92 return ext::ptr_value < UnboundedRegExpElement < ext::pair < SymbolType, unsigned > > > ( UnboundedRegExpIteration < ext::pair < SymbolType, unsigned > > ( iteration.getElement ( ).template accept < ext::ptr_value < regexp::UnboundedRegExpElement < ext::pair < DefaultSymbolType, unsigned > > >, GlushkovIndexate::Unbounded < SymbolType > > ( i ) ) );
93}
94
95template < class SymbolType >
98}
99
100template < class SymbolType >
103}
104
105template < class SymbolType >
108}
109
110template < class SymbolType >
112 unsigned i = 1;
113
114 return FormalRegExp < ext::pair < SymbolType, unsigned > > ( regexp::FormalRegExpStructure < ext::pair < SymbolType, unsigned > > ( re.getRegExp ( ).getStructure ( ).template accept < ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i ) ) );
115}
116
117template < class SymbolType >
119 ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > > left = alternation.getLeftElement ( ).template accept < ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
120 ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > > right = alternation.getRightElement ( ).template accept < ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
122}
123
124template < class SymbolType >
126ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > > left = concatenation.getLeftElement ( ).template accept < ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
127ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > > right = concatenation.getRightElement ( ).template accept < ext::ptr_value < regexp::FormalRegExpElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
129}
130
131template < class SymbolType >
133 return ext::ptr_value < FormalRegExpElement < ext::pair < SymbolType, unsigned > > > ( FormalRegExpIteration < ext::pair < SymbolType, unsigned > > ( iteration.getElement ( ).template accept < ext::ptr_value < regexp::FormalRegExpElement < ext::pair < DefaultSymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i ) ) );
134}
135
136template < class SymbolType >
139}
140
141template < class SymbolType >
144}
145
146template < class SymbolType >
149}
150
151} /* namespace regexp */
152
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Class representing wrapper of dynamically allocated object behaving like rvalue reference.
Definition: ptr_value.hpp:40
Represents the alternation operator in the regular expression. The node must have exactly two childre...
Definition: FormalRegExpAlternation.h:44
Represents the concatenation operator in the regular expression. The node must have exactly two child...
Definition: FormalRegExpConcatenation.h:44
Represents the empty expression in the regular expression. The node can't have any children.
Definition: FormalRegExpEmpty.h:41
Represents the epsilon expression in the regular expression. The node can't have any children.
Definition: FormalRegExpEpsilon.h:41
Represents the iteration operator in the regular expression. The node has exactly one child.
Definition: FormalRegExpIteration.h:44
Represents formal regular expression structure. Regular expression is stored as a tree of FormalRegEx...
Definition: FormalRegExpStructure.h:45
Represents the symbol in the regular expression. The can't have any children.
Definition: FormalRegExpSymbol.h:42
Formal regular expression represents regular expression. It describes regular languages....
Definition: FormalRegExp.h:78
const FormalRegExpStructure< SymbolType > & getRegExp() const &
Definition: FormalRegExp.h:208
Definition: GlushkovIndexate.h:52
static ext::ptr_value< regexp::FormalRegExpElement< ext::pair< SymbolType, unsigned > > > visit(const regexp::FormalRegExpAlternation< SymbolType > &alternation, unsigned &i)
Definition: GlushkovIndexate.h:118
Definition: GlushkovIndexate.h:34
static ext::ptr_value< regexp::UnboundedRegExpElement< ext::pair< SymbolType, unsigned > > > visit(const regexp::UnboundedRegExpAlternation< SymbolType > &alternation, unsigned &i)
Definition: GlushkovIndexate.h:71
Definition: GlushkovIndexate.h:24
static regexp::UnboundedRegExp< ext::pair< SymbolType, unsigned > > index(const regexp::UnboundedRegExp< SymbolType > &re)
static regexp::FormalRegExp< ext::pair< SymbolType, unsigned > > index(const regexp::FormalRegExp< SymbolType > &re)
Represents the alternation operator in the regular expression. The node can have 0 to n children in l...
Definition: UnboundedRegExpAlternation.h:44
void appendElement(UnboundedRegExpElement< SymbolType > &&element)
Definition: UnboundedRegExpAlternation.h:195
Represents the concatenation operator in the regular expression. The node can have 0 to n children in...
Definition: UnboundedRegExpConcatenation.h:44
void appendElement(UnboundedRegExpElement< SymbolType > &&element)
Definition: UnboundedRegExpConcatenation.h:195
Definition: UnboundedRegExpElement.h:62
Represents the empty expression in the regular expression. The node can't have any children.
Definition: UnboundedRegExpEmpty.h:41
Represents the epsilon expression in the regular expression. The node can't have any children.
Definition: UnboundedRegExpEpsilon.h:41
Represents the iteration operator in the regular expression. The node has exactly one child.
Definition: UnboundedRegExpIteration.h:43
Represents unbounded regular expression structure. Regular expression is stored as a tree of Unbounde...
Definition: UnboundedRegExpStructure.h:47
Represents the symbol in the regular expression. The can't have any children.
Definition: UnboundedRegExpSymbol.h:42
Unbounded regular expression represents regular expression. It describes regular languages....
Definition: UnboundedRegExp.h:80
const UnboundedRegExpStructure< SymbolType > & getRegExp() const &
Definition: UnboundedRegExp.h:210
int i
Definition: AllEpsilonClosure.h:118
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ToAutomaton.h:15