Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
d6ba871f
Commit
d6ba871f
authored
11 years ago
by
Jan Trávníček
Committed by
Tomáš Pecka
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix for issue 12
parent
1ba3bc01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aconversions/src/re2fa/Brzozowski.cpp
+5
-9
5 additions, 9 deletions
aconversions/src/re2fa/Brzozowski.cpp
alib/src/regexp/Alternation.cpp
+5
-4
5 additions, 4 deletions
alib/src/regexp/Alternation.cpp
alib/src/regexp/Concatenation.cpp
+5
-4
5 additions, 4 deletions
alib/src/regexp/Concatenation.cpp
with
15 additions
and
17 deletions
aconversions/src/re2fa/Brzozowski.cpp
+
5
−
9
View file @
d6ba871f
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
#include
"Brzozowski.h"
#include
"Brzozowski.h"
#include
<iostream>
using
namespace
alib
;
using
namespace
alib
;
using
namespace
automaton
;
using
namespace
automaton
;
...
@@ -68,10 +69,7 @@ FSM Brzozowski::convert( void )
...
@@ -68,10 +69,7 @@ FSM Brzozowski::convert( void )
}
}
}
}
// FIXME sometimes crashes upon regexp comparsion - ?? issue #22
Q
.
insert
(
Qi
.
at
(
i
).
begin
(
),
Qi
.
at
(
i
).
end
(
)
);
// Q.insert( Qi.at( i ).begin( ), Qi.at( i ).end( ) );
for
(
const
auto
&
r
:
Qi
.
at
(
i
)
)
Q
.
insert
(
r
);
i
+=
1
;
i
+=
1
;
}
}
...
@@ -129,11 +127,9 @@ Brzozowski::StateBuilder::StateBuilder( const set<RegExp> & Q )
...
@@ -129,11 +127,9 @@ Brzozowski::StateBuilder::StateBuilder( const set<RegExp> & Q )
const
State
&
Brzozowski
::
StateBuilder
::
getState
(
const
RegExp
&
re
)
const
const
State
&
Brzozowski
::
StateBuilder
::
getState
(
const
RegExp
&
re
)
const
{
{
// FIXME map::find() does not work! see gitlab issue #12
auto
state
=
m_states
.
find
(
re
);
for
(
const
auto
&
kv
:
m_states
)
if
(
state
!=
m_states
.
end
()
)
return
state
->
second
;
if
(
kv
.
first
==
re
)
return
kv
.
second
;
throw
AlibException
(
"Brzozowski::StateBuilder - Regular expression not found!"
);
throw
AlibException
(
"Brzozowski::StateBuilder - Regular expression not found!"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
alib/src/regexp/Alternation.cpp
+
5
−
4
View file @
d6ba871f
...
@@ -80,10 +80,11 @@ bool Alternation::operator<(const Alternation& other) const {
...
@@ -80,10 +80,11 @@ bool Alternation::operator<(const Alternation& other) const {
auto
thisIter
=
this
->
elements
.
begin
();
auto
thisIter
=
this
->
elements
.
begin
();
auto
otherIter
=
other
.
elements
.
begin
();
auto
otherIter
=
other
.
elements
.
begin
();
for
(;
thisIter
!=
this
->
elements
.
end
();
thisIter
++
,
otherIter
++
)
{
for
(;
thisIter
!=
this
->
elements
.
end
();
thisIter
++
,
otherIter
++
)
{
if
(
**
thisIter
<
**
otherIter
)
return
true
;
if
(
**
thisIter
!=
**
otherIter
)
break
;
}
}
if
(
thisIter
==
this
->
elements
.
end
())
return
false
;
return
false
;
return
**
thisIter
<
**
otherIter
;
}
}
bool
Alternation
::
operator
==
(
const
Alternation
&
other
)
const
{
bool
Alternation
::
operator
==
(
const
Alternation
&
other
)
const
{
...
@@ -103,7 +104,7 @@ bool Alternation::containsEmptyString() const {
...
@@ -103,7 +104,7 @@ bool Alternation::containsEmptyString() const {
if
(
e
->
containsEmptyString
())
if
(
e
->
containsEmptyString
())
return
true
;
return
true
;
return
false
;
return
false
;
// alternation of zero regexps is empty
}
}
bool
Alternation
::
isEmpty
()
const
{
bool
Alternation
::
isEmpty
()
const
{
...
@@ -111,7 +112,7 @@ bool Alternation::isEmpty() const {
...
@@ -111,7 +112,7 @@ bool Alternation::isEmpty() const {
if
(
!
e
->
isEmpty
())
if
(
!
e
->
isEmpty
())
return
false
;
return
false
;
return
true
;
return
true
;
// alternation of zero regexps is empty
}
}
}
/* namespace regexp */
}
/* namespace regexp */
...
...
This diff is collapsed.
Click to expand it.
alib/src/regexp/Concatenation.cpp
+
5
−
4
View file @
d6ba871f
...
@@ -76,10 +76,11 @@ bool Concatenation::operator<(const Concatenation& other) const {
...
@@ -76,10 +76,11 @@ bool Concatenation::operator<(const Concatenation& other) const {
auto
thisIter
=
this
->
elements
.
begin
();
auto
thisIter
=
this
->
elements
.
begin
();
auto
otherIter
=
other
.
elements
.
begin
();
auto
otherIter
=
other
.
elements
.
begin
();
for
(;
thisIter
!=
this
->
elements
.
end
();
thisIter
++
,
otherIter
++
)
{
for
(;
thisIter
!=
this
->
elements
.
end
();
thisIter
++
,
otherIter
++
)
{
if
(
**
thisIter
<
**
otherIter
)
return
true
;
if
(
**
thisIter
!=
**
otherIter
)
break
;
}
}
if
(
thisIter
==
this
->
elements
.
end
())
return
false
;
return
false
;
return
**
thisIter
<
**
otherIter
;
}
}
bool
Concatenation
::
operator
==
(
const
Concatenation
&
other
)
const
{
bool
Concatenation
::
operator
==
(
const
Concatenation
&
other
)
const
{
...
@@ -99,7 +100,7 @@ bool Concatenation::containsEmptyString() const {
...
@@ -99,7 +100,7 @@ bool Concatenation::containsEmptyString() const {
if
(
!
e
->
containsEmptyString
())
if
(
!
e
->
containsEmptyString
())
return
false
;
return
false
;
return
true
;
return
true
;
// concatenation of zero regexps is epsilon
}
}
bool
Concatenation
::
isEmpty
()
const
{
bool
Concatenation
::
isEmpty
()
const
{
...
@@ -107,7 +108,7 @@ bool Concatenation::isEmpty() const {
...
@@ -107,7 +108,7 @@ bool Concatenation::isEmpty() const {
if
(
e
->
isEmpty
())
if
(
e
->
isEmpty
())
return
true
;
return
true
;
return
false
;
return
false
;
// concatenation of zero regexps is epsilon
}
}
}
/* namespace regexp */
}
/* namespace regexp */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment