2828 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2929 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030 *
31- * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.46 2008/02/14 17:33:37 tgl Exp $
31+ * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.47 2010/01/30 04:18:00 tgl Exp $
3232 *
3333 */
3434
@@ -1012,8 +1012,10 @@ parseqatom(struct vars * v,
10121012 }
10131013
10141014 /*
1015- * hard part: something messy That is, capturing parens, back reference,
1016- * short/long clash, or an atom with substructure containing one of those.
1015+ * hard part: something messy
1016+ *
1017+ * That is, capturing parens, back reference, short/long clash, or an atom
1018+ * with substructure containing one of those.
10171019 */
10181020
10191021 /* now we'll need a subre for the contents even if they're boring */
@@ -1023,13 +1025,15 @@ parseqatom(struct vars * v,
10231025 NOERR ();
10241026 }
10251027
1026- /*
1027- * prepare a general-purpose state skeleton
1028+ /*----------
1029+ * Prepare a general-purpose state skeleton.
10281030 *
1029- * ---> [s] ---prefix---> [begin] ---atom---> [end] ----rest---> [rp] / /
1031+ * ---> [s] ---prefix---> [begin] ---atom---> [end] ----rest---> [rp]
1032+ * / /
10301033 * [lp] ----> [s2] ----bypass---------------------
10311034 *
10321035 * where bypass is an empty, and prefix is some repetitions of atom
1036+ *----------
10331037 */
10341038 s = newstate (v -> nfa ); /* first, new endpoints for the atom */
10351039 s2 = newstate (v -> nfa );
@@ -1050,6 +1054,7 @@ parseqatom(struct vars * v,
10501054 t = subre (v , '.' , COMBINE (qprefer , atom -> flags ), lp , rp );
10511055 t -> left = atom ;
10521056 atomp = & t -> left ;
1057+
10531058 /* here we should recurse... but we must postpone that to the end */
10541059
10551060 /* split top into prefix and remaining */
@@ -1064,9 +1069,12 @@ parseqatom(struct vars * v,
10641069 assert (atom -> begin -> nouts == 1 ); /* just the EMPTY */
10651070 delsub (v -> nfa , atom -> begin , atom -> end );
10661071 assert (v -> subs [subno ] != NULL );
1067- /* and here's why the recursion got postponed: it must */
1068- /* wait until the skeleton is filled in, because it may */
1069- /* hit a backref that wants to copy the filled-in skeleton */
1072+
1073+ /*
1074+ * And here's why the recursion got postponed: it must wait until the
1075+ * skeleton is filled in, because it may hit a backref that wants to
1076+ * copy the filled-in skeleton.
1077+ */
10701078 dupnfa (v -> nfa , v -> subs [subno ]-> begin , v -> subs [subno ]-> end ,
10711079 atom -> begin , atom -> end );
10721080 NOERR ();
@@ -1108,8 +1116,10 @@ parseqatom(struct vars * v,
11081116 }
11091117 else
11101118 {
1111- /* turn x{m,n} into x{m-1,n-1}x, with capturing */
1112- /* parens in only second x */
1119+ /*
1120+ * Turn x{m,n} into x{m-1,n-1}x, with capturing parens in only the
1121+ * second x
1122+ */
11131123 dupnfa (v -> nfa , atom -> begin , atom -> end , s , atom -> begin );
11141124 assert (m >= 1 && m != INFINITY && n >= 1 );
11151125 repeat (v , s , atom -> begin , m - 1 , (n == INFINITY ) ? n : n - 1 );
0 commit comments