aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/regex_automaton.tcc
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2014-04-27 23:48:47 +0000
committerTim Shen <timshen@gcc.gnu.org>2014-04-27 23:48:47 +0000
commita670a9bb5477d63b47091347da53551d639bb8ee (patch)
tree8a3a023c2a1551b5c04a205a24a524fc3a5d6b29 /libstdc++-v3/include/bits/regex_automaton.tcc
parentf956adb9613ee0e9491b37139d8ab6d7a23e0f3c (diff)
downloadgcc-a670a9bb5477d63b47091347da53551d639bb8ee.zip
gcc-a670a9bb5477d63b47091347da53551d639bb8ee.tar.gz
gcc-a670a9bb5477d63b47091347da53551d639bb8ee.tar.bz2
regex_automaton.h (_NFA<>::_M_insert_repeat): Add _S_opcode_repeat support to distingush a loop from _S_opcode_alternative.
2014-04-27 Tim Shen <timshen91@gmail.com> * include/bits/regex_automaton.h (_NFA<>::_M_insert_repeat): Add _S_opcode_repeat support to distingush a loop from _S_opcode_alternative. * include/bits/regex_automaton.tcc (_State_base::_M_print, _State_base::_M_dot, _NFA<>::_M_eliminate_dummy, _StateSeq<>::_M_clone): Likewise. * include/bits/regex_compiler.tcc (_Compiler<>::_M_quantifier): Likewise. * include/bits/regex_executor.tcc (_Executor<>::_M_dfs): Likewise. * include/bits/regex_scanner.tcc (_Scanner<>::_M_eat_escape_ecma): Uglify local variable __i. * include/bits/regex_compiler.h (_BracketMatcher<>::_M_make_cache): Use size_t instead of int to compare with vector::size(). 2014-04-27 Tim Shen <timshen91@gmail.com> * include/bits/regex_executor.h: Add _M_rep_count to track how many times this repeat node are visited. * include/bits/regex_executor.tcc (_Executor<>::_M_rep_once_more, _Executor<>::_M_dfs): Use _M_rep_count to prevent entering infinite loop. 2014-04-27 Tim Shen <timshen91@gmail.com> * include/bits/regex.tcc (__regex_algo_impl<>): Remove _GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT and use _GLIBCXX_REGEX_USE_THOMPSON_NFA instead. * include/bits/regex_automaton.h: Remove quantifier counting variable. * include/bits/regex_automaton.tcc (_State_base::_M_dot): Adjust debug NFA dump. From-SVN: r209844
Diffstat (limited to 'libstdc++-v3/include/bits/regex_automaton.tcc')
-rw-r--r--libstdc++-v3/include/bits/regex_automaton.tcc9
1 files changed, 7 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc
index 1476ae2..e0ac3f9 100644
--- a/libstdc++-v3/include/bits/regex_automaton.tcc
+++ b/libstdc++-v3/include/bits/regex_automaton.tcc
@@ -41,6 +41,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
switch (_M_opcode)
{
case _S_opcode_alternative:
+ case _S_opcode_repeat:
ostr << "alt next=" << _M_next << " alt=" << _M_alt;
break;
case _S_opcode_subexpr_begin:
@@ -72,11 +73,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
switch (_M_opcode)
{
case _S_opcode_alternative:
+ case _S_opcode_repeat:
__ostr << __id << " [label=\"" << __id << "\\nALT\"];\n"
<< __id << " -> " << _M_next
- << " [label=\"epsilon\", tailport=\"s\"];\n"
+ << " [label=\"next\", tailport=\"s\"];\n"
<< __id << " -> " << _M_alt
- << " [label=\"epsilon\", tailport=\"n\"];\n";
+ << " [label=\"alt\", tailport=\"n\"];\n";
break;
case _S_opcode_backref:
__ostr << __id << " [label=\"" << __id << "\\nBACKREF "
@@ -174,6 +176,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
== _S_opcode_dummy)
__it._M_next = (*this)[__it._M_next]._M_next;
if (__it._M_opcode == _S_opcode_alternative
+ || __it._M_opcode == _S_opcode_repeat
|| __it._M_opcode == _S_opcode_subexpr_lookahead)
while (__it._M_alt >= 0 && (*this)[__it._M_alt]._M_opcode
== _S_opcode_dummy)
@@ -198,6 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto __id = _M_nfa._M_insert_state(__dup);
__m[__u] = __id;
if (__dup._M_opcode == _S_opcode_alternative
+ || __dup._M_opcode == _S_opcode_repeat
|| __dup._M_opcode == _S_opcode_subexpr_lookahead)
if (__dup._M_alt != _S_invalid_state_id && __m[__dup._M_alt] == -1)
__stack.push(__dup._M_alt);
@@ -217,6 +221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__ref._M_next = __m[__ref._M_next];
}
if (__ref._M_opcode == _S_opcode_alternative
+ || __ref._M_opcode == _S_opcode_repeat
|| __ref._M_opcode == _S_opcode_subexpr_lookahead)
if (__ref._M_alt != _S_invalid_state_id)
{