[Bug libstdc++/61424] std::regex matches right to left, not leftmost longest

timshen at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 1 02:11:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61424

--- Comment #3 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Tue Jul  1 02:10:31 2014
New Revision: 212184

URL: https://gcc.gnu.org/viewcvs?rev=212184&root=gcc&view=rev
Log:
    PR libstdc++/61424
    * include/bits/regex.tcc (__regex_algo_impl<>): Use DFS for ECMAScript,
    not just regex containing back-references.
    * include/bits/regex_compiler.tcc (_Compiler<>::_M_disjunction):
    exchange _M_next and _M_alt for alternative operator,
    making matching from left to right.
    * include/bits/regex_executor.h (_State_info<>::_M_get_sol_pos):
    Add position tracking fom DFS.
    * include/bits/regex_executor.tcc (_Executor<>::_M_main_dispatch,
    _Executor<>::_M_dfs): Likewise.
    * include/bits/regex_scanner.h: Remove unused enum entry.
    * testsuite/28_regex/algorithms/regex_search/61424.cc: New
    testcase from PR.


Added:
    trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/61424.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/regex.tcc
    trunk/libstdc++-v3/include/bits/regex_compiler.tcc
    trunk/libstdc++-v3/include/bits/regex_executor.h
    trunk/libstdc++-v3/include/bits/regex_executor.tcc
    trunk/libstdc++-v3/include/bits/regex_scanner.h



More information about the Gcc-bugs mailing list