//
// Description
// Recursive internal parse routine. This will recursively parse a
// template containing dynamic inferior templates. Each of these
// inferior templates gets their own entry in the TEMPLATE array.
//
function &parse_internal_1 ($tag, $rest = '') {
$debug = $this->DEBUGALL || $this->DEBUG['parse_internal_1'];
if (empty($tag)) {
$this->error ("parse_internal_1: empty tag invalid", true);
}
if ($debug)
$this->logwrite ("parse_internal_1 (tag=$tag, rest=$rest)");
while (!empty($rest)) {
if ($debug)
$this->logwrite ('parse_internal_1: REGEX_DYNBEG search: rest => ' . $rest);
if (preg_match ($this->REGEX_DYNBEG, $rest, $dynbeg)) {
// Found match, now split into two pieces and search the second
// half for the matching END. The string which goes into the
// next element includes the HTML comment which forms the BEGIN
// block.
if ($debug)
$this->logwrite ('parse_internal_1: match beg => ' . $dynbeg[1]);
$pos = strpos ($rest, $dynbeg[1]);
// See if the text on either side of the BEGIN comment is only
// whitespace. If so, we delete the entire line.
$okay = false;
for ($offbeg = $pos - 1; $offbeg >= 0; $offbeg--) {
$c = $rest{$offbeg};
if ($c == "\n") {
$okay = true;
$offbeg++;
break;
}
if (($c != ' ') && ($c != "\t")) {
$offbeg = $pos;
break;
&n