28
28
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
29
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
*
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 $
32
32
*
33
33
*/
34
34
@@ -1012,8 +1012,10 @@ parseqatom(struct vars * v,
1012
1012
}
1013
1013
1014
1014
/*
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.
1017
1019
*/
1018
1020
1019
1021
/* now we'll need a subre for the contents even if they're boring */
@@ -1023,13 +1025,15 @@ parseqatom(struct vars * v,
1023
1025
NOERR ();
1024
1026
}
1025
1027
1026
- /*
1027
- * prepare a general-purpose state skeleton
1028
+ /*----------
1029
+ * Prepare a general-purpose state skeleton.
1028
1030
*
1029
- * ---> [s] ---prefix---> [begin] ---atom---> [end] ----rest---> [rp] / /
1031
+ * ---> [s] ---prefix---> [begin] ---atom---> [end] ----rest---> [rp]
1032
+ * / /
1030
1033
* [lp] ----> [s2] ----bypass---------------------
1031
1034
*
1032
1035
* where bypass is an empty, and prefix is some repetitions of atom
1036
+ *----------
1033
1037
*/
1034
1038
s = newstate (v -> nfa ); /* first, new endpoints for the atom */
1035
1039
s2 = newstate (v -> nfa );
@@ -1050,6 +1054,7 @@ parseqatom(struct vars * v,
1050
1054
t = subre (v , '.' , COMBINE (qprefer , atom -> flags ), lp , rp );
1051
1055
t -> left = atom ;
1052
1056
atomp = & t -> left ;
1057
+
1053
1058
/* here we should recurse... but we must postpone that to the end */
1054
1059
1055
1060
/* split top into prefix and remaining */
@@ -1064,9 +1069,12 @@ parseqatom(struct vars * v,
1064
1069
assert (atom -> begin -> nouts == 1 ); /* just the EMPTY */
1065
1070
delsub (v -> nfa , atom -> begin , atom -> end );
1066
1071
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
+ */
1070
1078
dupnfa (v -> nfa , v -> subs [subno ]-> begin , v -> subs [subno ]-> end ,
1071
1079
atom -> begin , atom -> end );
1072
1080
NOERR ();
@@ -1108,8 +1116,10 @@ parseqatom(struct vars * v,
1108
1116
}
1109
1117
else
1110
1118
{
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
+ */
1113
1123
dupnfa (v -> nfa , atom -> begin , atom -> end , s , atom -> begin );
1114
1124
assert (m >= 1 && m != INFINITY && n >= 1 );
1115
1125
repeat (v , s , atom -> begin , m - 1 , (n == INFINITY ) ? n : n - 1 );
0 commit comments