]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
regex.h: Add/modify comments.
authorTim Shen <timshen91@gmail.com>
Sat, 15 Mar 2014 18:16:22 +0000 (18:16 +0000)
committerTim Shen <timshen@gcc.gnu.org>
Sat, 15 Mar 2014 18:16:22 +0000 (18:16 +0000)
2014-03-15  Tim Shen  <timshen91@gmail.com>

* include/bits/regex.h: Add/modify comments.
* include/bits/regex_compiler.h: Likewise.
* include/bits/regex_executor.h: Likewise.
* include/bits/regex_executor.tcc: Likewise.
* include/bits/regex_scanner.h: Likewise.

From-SVN: r208593

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/regex.h
libstdc++-v3/include/bits/regex_compiler.h
libstdc++-v3/include/bits/regex_executor.h
libstdc++-v3/include/bits/regex_executor.tcc
libstdc++-v3/include/bits/regex_scanner.h

index 276e7cf250ff6a564baeb4bf5665e71a4e6407fb..c0b40d79229cd107bbb56aff36789e4f9b3455ca 100644 (file)
@@ -1,3 +1,11 @@
+2014-03-15  Tim Shen  <timshen91@gmail.com>
+
+       * include/bits/regex.h: Add/modify comments.
+       * include/bits/regex_compiler.h: Likewise.
+       * include/bits/regex_executor.h: Likewise.
+       * include/bits/regex_executor.tcc: Likewise.
+       * include/bits/regex_scanner.h: Likewise.
+
 2014-03-14  Jonathan Wakely  <jwakely@redhat.com>
 
        PR ipa/58721
index 816f5cfb0045c51132db1b5cad64ea43dd448920..e556350adca8c315aa58fe0ee30dbfaa9980b38b 100644 (file)
@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
 
   /**
-   * @brief Class regex_traits. Describes aspects of a regular expression.
+   * @brief Describes aspects of a regular expression.
    *
    * A regular expression traits class that satisfies the requirements of
    * section [28.7].
@@ -2098,8 +2098,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // [7.11.3] Function template regex_search
   /**
    * Searches for a regular expression within a range.
-   * @param __first [IN]  The start of the string to search.
-   * @param __last  [IN]  One-past-the-end of the string to search.
+   * @param __s     [IN]  The start of the string to search.
+   * @param __e     [IN]  One-past-the-end of the string to search.
    * @param __m     [OUT] The match results.
    * @param __re    [IN]  The regular expression to search for.
    * @param __flags [IN]  Search policy flags.
index fe2e5f1085c68db6de481bf52d91433aef6f9f49..f5a198f65e9288eaee705398b20bfefe14dffe08 100644 (file)
@@ -42,7 +42,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename, bool, bool>
     struct _BracketMatcher;
 
-  /// Builds an NFA from an input iterator interval.
+  /**
+   * @brief Builds an NFA from an input iterator interval.
+   *
+   * The %_TraitsT type should fulfill requirements [28.3].
+   */
   template<typename _TraitsT>
     class _Compiler
     {
index 0885716dbfb52bf1d6d1d49b57051c6dacff2a19..708c78e2081c0af314aadbff34466d81b9d86554 100644 (file)
@@ -41,6 +41,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * @{
    */
 
+  /**
+   * @brief Takes a regex and an input string in and
+   * do the matching.
+   *
+   * The %_Executor class has two modes: DFS mode and BFS mode, controlled
+   * by the template parameter %__dfs_mode.
+   */
   template<typename _BiIter, typename _Alloc, typename _TraitsT,
           bool __dfs_mode>
     class _Executor
index e1cfcb06164c813976246b38d238ca84a3323e8e..68a5e0490f9522524660738b4b8d137a4972a95b 100644 (file)
@@ -72,7 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // TODO: This approach is exponentially slow for certain input.
   //       Try to compile the NFA to a DFA.
   //
-  // Time complexity: o(match_length), O(2^(_M_nfa.size()))
+  // Time complexity: \Omega(match_length), O(2^(_M_nfa.size()))
   // Space complexity: \theta(match_results.size() + match_length)
   //
   // ------------------------------------------------------------
@@ -82,8 +82,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Russ Cox's article (http://swtch.com/~rsc/regexp/regexp1.html)
   // explained this algorithm clearly.
   //
-  // It first computes epsilon closure for every state that's still matching,
-  // using the same DFS algorithm, but doesn't reenter states (set true in
+  // It first computes epsilon closure (states that can be achieved without
+  // consuming characters) for every state that's still matching,
+  // using the same DFS algorithm, but doesn't re-enter states (find a true in
   // _M_visited), nor follows _S_opcode_match.
   //
   // Then apply DFS using every _S_opcode_match (in _M_match_queue) as the start
@@ -92,9 +93,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // It significantly reduces potential duplicate states, so has a better
   // upper bound; but it requires more overhead.
   //
-  // Time complexity: o(match_length * match_results.size())
+  // Time complexity: \Omega(match_length * match_results.size())
   //                  O(match_length * _M_nfa.size() * match_results.size())
-  // Space complexity: o(_M_nfa.size() + match_results.size())
+  // Space complexity: \Omega(_M_nfa.size() + match_results.size())
   //                   O(_M_nfa.size() * match_results.size())
   template<typename _BiIter, typename _Alloc, typename _TraitsT,
     bool __dfs_mode>
index 6dc2b4edf6f11e65314b3a5342ce27aca50c721d..6627db97ce0576dcf6f73929117210e8a40a2d08 100644 (file)
@@ -188,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   };
 
   /**
-   * @brief struct _Scanner. Scans an input range for regex tokens.
+   * @brief Scans an input range for regex tokens.
    *
    * The %_Scanner class interprets the regular expression pattern in
    * the input range passed to its constructor as a sequence of parse