static OnigLen
get_min_len(Node* node, ScanEnv* env)
{
- OnigLen min;
+ OnigLen len;
OnigLen tmin;
- min = 0;
+ len = 0;
switch (NODE_TYPE(node)) {
case NODE_BREF:
{
if (NODE_IS_RECURSION(node)) break;
backs = BACKREFS_P(br);
- min = get_min_len(mem_env[backs[0]].node, env);
+ len = get_min_len(mem_env[backs[0]].node, env);
for (i = 1; i < br->back_num; i++) {
tmin = get_min_len(mem_env[backs[i]].node, env);
- if (min > tmin) min = tmin;
+ if (len > tmin) len = tmin;
}
}
break;
Node* t = NODE_BODY(node);
if (NODE_IS_RECURSION(node)) {
if (NODE_IS_MIN_FIXED(t))
- min = ENCLOSURE_(t)->min_len;
+ len = ENCLOSURE_(t)->min_len;
}
else
- min = get_min_len(t, env);
+ len = get_min_len(t, env);
}
break;
#endif
case NODE_LIST:
do {
tmin = get_min_len(NODE_CAR(node), env);
- min += tmin;
+ len += tmin;
} while (IS_NOT_NULL(node = NODE_CDR(node)));
break;
do {
x = NODE_CAR(y);
tmin = get_min_len(x, env);
- if (y == node) min = tmin;
- else if (min > tmin) min = tmin;
+ if (y == node) len = tmin;
+ else if (len > tmin) len = tmin;
} while (IS_NOT_NULL(y = NODE_CDR(y)));
}
break;
case NODE_STR:
{
StrNode* sn = STR_(node);
- min = sn->end - sn->s;
+ len = sn->end - sn->s;
}
break;
case NODE_CTYPE:
case NODE_CCLASS:
- min = 1;
+ len = 1;
break;
case NODE_QTFR:
QtfrNode* qn = QTFR_(node);
if (qn->lower > 0) {
- min = get_min_len(NODE_BODY(node), env);
- min = distance_multiply(min, qn->lower);
+ len = get_min_len(NODE_BODY(node), env);
+ len = distance_multiply(len, qn->lower);
}
}
break;
switch (en->type) {
case ENCLOSURE_MEMORY:
if (NODE_IS_MIN_FIXED(node))
- min = en->min_len;
+ len = en->min_len;
else {
if (NODE_IS_MARK1(node))
- min = 0; // recursive
+ len = 0; // recursive
else {
NODE_STATUS_ADD(node, NST_MARK1);
- min = get_min_len(NODE_BODY(node), env);
+ len = get_min_len(NODE_BODY(node), env);
NODE_STATUS_REMOVE(node, NST_MARK1);
- en->min_len = min;
+ en->min_len = len;
NODE_STATUS_ADD(node, NST_MIN_FIXED);
}
}
case ENCLOSURE_OPTION:
case ENCLOSURE_STOP_BACKTRACK:
- min = get_min_len(NODE_BODY(node), env);
+ len = get_min_len(NODE_BODY(node), env);
break;
}
}
break;
}
- return min;
+ return len;
}
static OnigLen