[PR 61424] std::regex matches right to left, not leftmost longest

Jonathan Wakely jwakely@redhat.com
Sat Jun 28 09:45:00 GMT 2014


On 28/06/14 00:18 -0700, Tim Shen wrote:
>diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h
>index 1991c00..e02fa65 100644
>--- a/libstdc++-v3/include/bits/regex_executor.h
>+++ b/libstdc++-v3/include/bits/regex_executor.h
>@@ -173,6 +173,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> 	  void _M_queue(_StateIdT __i, const _ResultsVec& __res)
> 	  { _M_match_queue.emplace_back(__i, __res); }
>
>+	  _BiIter* _M_get_sol_pos() { return nullptr; }
>+
> 	  // Saves states that need to be considered for the next character.
> 	  vector<pair<_StateIdT, _ResultsVec>>	_M_match_queue;
> 	  // Indicates which states are already visited.
>@@ -191,12 +193,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> 	  // Dummy implementations for DFS mode.
> 	  bool _M_visited(_StateIdT) const { return false; }
> 	  void _M_queue(_StateIdT, const _ResultsVec&) { }
>+	  _BiIter* _M_get_sol_pos() { return &_M_sol_pos; }

Please put a space above this new function, otherwise it looks like
the "Dummy implementations" comment applies to this function, but in
fact that function is used for dfs mode.

Similarly, maybe there should be a "Dummy implementation" comment on
the _State_info<__bfs, RV>::_M_get_sol_pos function.

OK with that change, thanks for the fix.



More information about the Libstdc++ mailing list