Node c;
c = *a; *a = *b; *b = c;
- if (NODE_TYPE(a) == NT_STR) {
+ if (NODE_TYPE(a) == NODE_STR) {
StrNode* sn = STR_(a);
if (sn->capa == 0) {
int len = sn->end - sn->s;
}
}
- if (NODE_TYPE(b) == NT_STR) {
+ if (NODE_TYPE(b) == NODE_STR) {
StrNode* sn = STR_(b);
if (sn->capa == 0) {
int len = sn->end - sn->s;
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
len = 0;
do {
r = compile_length_tree(NODE_CAR(node), reg);
r = len;
break;
- case NT_ALT:
+ case NODE_ALT:
{
int n;
}
break;
- case NT_STR:
+ case NODE_STR:
if (NSTRING_IS_RAW(node))
r = compile_length_string_raw_node(STR_(node), reg);
else
r = compile_length_string_node(node, reg);
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
r = compile_length_cclass_node(CCLASS_(node), reg);
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
r = SIZE_OPCODE;
break;
- case NT_BREF:
+ case NODE_BREF:
{
BRefNode* br = BREF_(node);
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
r = SIZE_OP_CALL;
break;
#endif
- case NT_QTFR:
+ case NODE_QTFR:
r = compile_length_quantifier_node(QTFR_(node), reg);
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
r = compile_length_enclose_node(ENCLOSE_(node), reg);
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
r = compile_length_anchor_node(ANCHOR_(node), reg);
break;
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
do {
r = compile_tree(NODE_CAR(node), reg);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_ALT:
+ case NODE_ALT:
{
Node* x = node;
len = 0;
}
break;
- case NT_STR:
+ case NODE_STR:
if (NSTRING_IS_RAW(node))
r = compile_string_raw_node(STR_(node), reg);
else
r = compile_string_node(node, reg);
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
r = compile_cclass_node(CCLASS_(node), reg);
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
{
int op;
}
break;
- case NT_BREF:
+ case NODE_BREF:
{
BRefNode* br = BREF_(node);
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
r = compile_call(CALL_(node), reg);
break;
#endif
- case NT_QTFR:
+ case NODE_QTFR:
r = compile_quantifier_node(QTFR_(node), reg);
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
r = compile_enclose_node(ENCLOSE_(node), reg);
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
r = compile_anchor_node(ANCHOR_(node), reg);
break;
Node* node = *plink;
switch (NODE_TYPE(node)) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
do {
r = noname_disable_map(&(NODE_CAR(node)), map, counter);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
+ case NODE_QTFR:
{
Node** ptarget = &(NODE_BODY(node));
Node* old = *ptarget;
r = noname_disable_map(ptarget, map, counter);
- if (*ptarget != old && NODE_TYPE(*ptarget) == NT_QTFR) {
+ if (*ptarget != old && NODE_TYPE(*ptarget) == NODE_QTFR) {
onig_reduce_nested_quantifier(node, *ptarget);
}
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
if (en->type == ENCLOSE_MEMORY) {
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
if (IS_NOT_NULL(NODE_BODY(node)))
r = noname_disable_map(&(NODE_BODY(node)), map, counter);
break;
int r = 0;
switch (NODE_TYPE(node)) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
do {
r = renumber_by_map(NODE_CAR(node), map);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
- case NT_ENCLOSE:
+ case NODE_QTFR:
+ case NODE_ENCLOSE:
r = renumber_by_map(NODE_BODY(node), map);
break;
- case NT_BREF:
+ case NODE_BREF:
r = renumber_node_backref(node, map);
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
if (IS_NOT_NULL(NODE_BODY(node)))
r = renumber_by_map(NODE_BODY(node), map);
break;
int r = 0;
switch (NODE_TYPE(node)) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
do {
r = numbered_ref_check(NODE_CAR(node));
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
- case NT_ENCLOSE:
+ case NODE_QTFR:
+ case NODE_ENCLOSE:
r = numbered_ref_check(NODE_BODY(node));
break;
- case NT_BREF:
+ case NODE_BREF:
if (! NODE_IS_NAME_REF(node))
return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED;
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
if (IS_NOT_NULL(NODE_BODY(node)))
r = numbered_ref_check(NODE_BODY(node));
break;
level++;
*len = 0;
switch (NODE_TYPE(node)) {
- case NT_LIST:
+ case NODE_LIST:
do {
r = get_char_length_tree1(NODE_CAR(node), reg, &tlen, level);
if (r == 0)
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_ALT:
+ case NODE_ALT:
{
int tlen2;
int varlen = 0;
}
break;
- case NT_STR:
+ case NODE_STR:
{
StrNode* sn = STR_(node);
UChar *s = sn->s;
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
{
QtfrNode* qn = QTFR_(node);
if (qn->lower == qn->upper) {
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
if (! NODE_IS_RECURSION(node))
r = get_char_length_tree1(NODE_BODY(node), reg, len, level);
else
break;
#endif
- case NT_CTYPE:
+ case NODE_CTYPE:
*len = 1;
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
*len = 1;
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
switch (en->type) {
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
break;
default:
retry:
ytype = NODE_TYPE(y);
switch (NODE_TYPE(x)) {
- case NT_CTYPE:
+ case NODE_CTYPE:
{
if (CTYPE_(x)->ctype == CTYPE_ANYCHAR ||
CTYPE_(y)->ctype == CTYPE_ANYCHAR)
break;
switch (ytype) {
- case NT_CTYPE:
+ case NODE_CTYPE:
if (CTYPE_(y)->ctype == CTYPE_(x)->ctype &&
CTYPE_(y)->not != CTYPE_(x)->not)
return 1;
return 0;
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
swap:
{
Node* tmp;
}
break;
- case NT_STR:
+ case NODE_STR:
goto swap;
break;
}
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
{
CClassNode* xc = CCLASS_(x);
switch (ytype) {
- case NT_CTYPE:
+ case NODE_CTYPE:
switch (CTYPE_(y)->ctype) {
case CTYPE_ANYCHAR:
return 0;
}
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
{
int v;
CClassNode* yc = CCLASS_(y);
}
break;
- case NT_STR:
+ case NODE_STR:
goto swap;
break;
}
break;
- case NT_STR:
+ case NODE_STR:
{
StrNode* xs = STR_(x);
if (NSTRING_LEN(x) == 0)
//c = *(xs->s);
switch (ytype) {
- case NT_CTYPE:
+ case NODE_CTYPE:
switch (CTYPE_(y)->ctype) {
case CTYPE_ANYCHAR:
break;
}
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
{
CClassNode* cc = CCLASS_(y);
}
break;
- case NT_STR:
+ case NODE_STR:
{
UChar *q;
StrNode* ys = STR_(y);
Node* n = NULL_NODE;
switch (NODE_TYPE(node)) {
- case NT_BREF:
- case NT_ALT:
+ case NODE_BREF:
+ case NODE_ALT:
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
#endif
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
if (CTYPE_(node)->ctype == CTYPE_ANYCHAR)
break;
/* through */
- case NT_CCLASS:
+ case NODE_CCLASS:
if (exact == 0) {
n = node;
}
break;
- case NT_LIST:
+ case NODE_LIST:
n = get_head_value_node(NODE_CAR(node), exact, reg);
break;
- case NT_STR:
+ case NODE_STR:
{
StrNode* sn = STR_(node);
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
{
QtfrNode* qn = QTFR_(node);
if (qn->lower > 0) {
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
switch (en->type) {
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
if (ANCHOR_(node)->type == ANCHOR_PREC_READ)
n = get_head_value_node(NODE_BODY(node), exact, reg);
break;
return 1;
switch (type) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
do {
r = check_type_tree(NODE_CAR(node), type_mask, enclose_mask,
anchor_mask);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
+ case NODE_QTFR:
r = check_type_tree(NODE_BODY(node), type_mask, enclose_mask, anchor_mask);
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
if ((en->type & enclose_mask) == 0)
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
type = ANCHOR_(node)->type;
if ((type & anchor_mask) == 0)
return 1;
*min = 0;
switch (NODE_TYPE(node)) {
- case NT_BREF:
+ case NODE_BREF:
{
int i;
int* backs;
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
{
Node* t = NODE_BODY(node);
if (NODE_IS_RECURSION(node)) {
break;
#endif
- case NT_LIST:
+ case NODE_LIST:
do {
r = get_min_len(NODE_CAR(node), &tmin, env);
if (r == 0) *min += tmin;
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_ALT:
+ case NODE_ALT:
{
Node *x, *y;
y = node;
}
break;
- case NT_STR:
+ case NODE_STR:
{
StrNode* sn = STR_(node);
*min = sn->end - sn->s;
}
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
*min = 1;
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
*min = 1;
break;
- case NT_QTFR:
+ case NODE_QTFR:
{
QtfrNode* qn = QTFR_(node);
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
switch (en->type) {
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
default:
break;
}
*max = 0;
switch (NODE_TYPE(node)) {
- case NT_LIST:
+ case NODE_LIST:
do {
r = get_max_len(NODE_CAR(node), &tmax, env);
if (r == 0)
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_ALT:
+ case NODE_ALT:
do {
r = get_max_len(NODE_CAR(node), &tmax, env);
if (r == 0 && *max < tmax) *max = tmax;
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_STR:
+ case NODE_STR:
{
StrNode* sn = STR_(node);
*max = sn->end - sn->s;
}
break;
- case NT_CTYPE:
- case NT_CCLASS:
+ case NODE_CTYPE:
+ case NODE_CCLASS:
*max = ONIGENC_MBC_MAXLEN_DIST(env->enc);
break;
- case NT_BREF:
+ case NODE_BREF:
{
int i;
int* backs;
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
if (! NODE_IS_RECURSION(node))
r = get_max_len(NODE_BODY(node), max, env);
else
break;
#endif
- case NT_QTFR:
+ case NODE_QTFR:
{
QtfrNode* qn = QTFR_(node);
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
switch (en->type) {
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
default:
break;
}
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
{
Node *x;
OnigLen min;
}
break;
- case NT_ALT:
+ case NODE_ALT:
{
int ret;
r = RECURSION_EXIST;
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
r = subexp_inf_recursive_check(NODE_BODY(node), env, head);
if (r == RECURSION_EXIST) {
if (QTFR_(node)->lower == 0) r = 0;
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
{
AnchorNode* an = ANCHOR_(node);
if (ANCHOR_HAS_BODY(an))
}
break;
- case NT_CALL:
+ case NODE_CALL:
r = subexp_inf_recursive_check(NODE_BODY(node), env, head);
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
if (NODE_IS_MARK2(node))
return 0;
else if (NODE_IS_MARK1(node))
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
do {
r = subexp_inf_recursive_check_trav(NODE_CAR(node), env);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
+ case NODE_QTFR:
r = subexp_inf_recursive_check_trav(NODE_BODY(node), env);
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
{
AnchorNode* an = ANCHOR_(node);
if (ANCHOR_HAS_BODY(an))
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
if (NODE_IS_RECURSION(node)) {
NODE_STATUS_ADD(node, NST_MARK1);
r = subexp_inf_recursive_check(NODE_BODY(node), env, 1);
int r = 0;
switch (NODE_TYPE(node)) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
do {
r |= subexp_recursive_check(NODE_CAR(node));
} while (IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
+ case NODE_QTFR:
r = subexp_recursive_check(NODE_BODY(node));
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
{
AnchorNode* an = ANCHOR_(node);
if (ANCHOR_HAS_BODY(an))
}
break;
- case NT_CALL:
+ case NODE_CALL:
r = subexp_recursive_check(NODE_BODY(node));
if (r != 0) NODE_STATUS_ADD(node, NST_RECURSION);
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
if (NODE_IS_MARK2(node))
return 0;
else if (NODE_IS_MARK1(node))
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
{
int ret;
do {
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
r = subexp_recursive_check_trav(NODE_BODY(node), env);
if (QTFR_(node)->upper == 0) {
if (r == FOUND_CALLED_NODE)
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
{
AnchorNode* an = ANCHOR_(node);
if (ANCHOR_HAS_BODY(an))
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
if (! NODE_IS_RECURSION(node)) {
if (NODE_IS_CALLED(node)) {
NODE_STATUS_ADD(node, NST_MARK1);
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
do {
r = setup_subexp_call(NODE_CAR(node), env);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_ALT:
+ case NODE_ALT:
do {
r = setup_subexp_call(NODE_CAR(node), env);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_QTFR:
- case NT_ENCLOSE:
+ case NODE_QTFR:
+ case NODE_ENCLOSE:
r = setup_subexp_call(NODE_BODY(node), env);
break;
- case NT_CALL:
+ case NODE_CALL:
{
CallNode* cn = CALL_(node);
MemEnv* mem_env = SCANENV_MEMENV(env);
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
{
AnchorNode* an = ANCHOR_(node);
if (ANCHOR_HAS_BODY(an))
if (anc_type == ANCHOR_LOOK_BEHIND_NOT) {
np = node;
do {
- SET_NODE_TYPE(np, NT_LIST); /* alt -> list */
+ SET_NODE_TYPE(np, NODE_LIST); /* alt -> list */
} while (IS_NOT_NULL(np = NODE_CDR(np)));
}
return 0;
retry:
type = NODE_TYPE(node);
- if (type == NT_QTFR) {
+ if (type == NODE_QTFR) {
QtfrNode* qn = QTFR_(node);
if (qn->greedy && IS_REPEAT_INFINITE(qn->upper)) {
#ifdef USE_QTFR_PEEK_NEXT
}
}
}
- else if (type == NT_ENCLOSE) {
+ else if (type == NODE_ENCLOSE) {
EncloseNode* en = ENCLOSE_(node);
if (en->type == ENCLOSE_MEMORY) {
node = NODE_BODY(node);
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
{
Node* prev = NULL_NODE;
do {
}
break;
- case NT_ALT:
+ case NODE_ALT:
{
int ret;
do {
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
{
int child_state = state;
int add_state = 0;
/* check (a*){n,m}, (a+){n,m} => (a*){n,n}, (a+){n,n} */
if (env->backrefed_mem == 0) {
- if (NODE_TYPE(NODE_QTFR_BODY(qn)) == NT_ENCLOSE) {
+ if (NODE_TYPE(NODE_QTFR_BODY(qn)) == NODE_ENCLOSE) {
EncloseNode* en = ENCLOSE_(NODE_QTFR_BODY(qn));
if (en->type == ENCLOSE_MEMORY) {
- if (NODE_TYPE(NODE_ENCLOSE_BODY(en)) == NT_QTFR) {
+ if (NODE_TYPE(NODE_ENCLOSE_BODY(en)) == NODE_QTFR) {
QtfrNode* q = QTFR_(NODE_ENCLOSE_BODY(en));
if (IS_REPEAT_INFINITE(q->upper)
&& q->greedy == qn->greedy) {
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
if (NODE_IS_RECURSION(node))
env->has_recursion = 1;
else
int r = 0;
switch (NODE_TYPE(node)) {
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
{
int v;
do {
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
if (NODE_IS_RECURSION(node)) {
return NQ_BODY_IS_EMPTY_REC; /* tiny version */
}
break;
#endif
- case NT_QTFR:
+ case NODE_QTFR:
{
QtfrNode* qn = QTFR_(node);
if (qn->upper != 0) {
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
switch (en->type) {
}
break;
- case NT_BREF:
- case NT_STR:
- case NT_CTYPE:
- case NT_CCLASS:
- case NT_ANCHOR:
+ case NODE_BREF:
+ case NODE_STR:
+ case NODE_CTYPE:
+ case NODE_CCLASS:
+ case NODE_ANCHOR:
default:
break;
}
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
{
Node* prev = NULL_NODE;
do {
}
break;
- case NT_ALT:
+ case NODE_ALT:
do {
r = setup_tree(NODE_CAR(node), reg, (state | IN_ALT), env);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
break;
- case NT_STR:
+ case NODE_STR:
if (IS_IGNORECASE(reg->options) && !NSTRING_IS_RAW(node)) {
r = expand_case_fold_string(node, reg);
}
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
break;
#endif
- case NT_BREF:
+ case NODE_BREF:
{
int i;
int* p;
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
{
OnigLen d;
QtfrNode* qn = QTFR_(node);
if (r > 0) {
qn->body_empty_info = r;
if (r == NQ_BODY_IS_EMPTY_REC) {
- if (NODE_TYPE(target) == NT_ENCLOSE &&
+ if (NODE_TYPE(target) == NODE_ENCLOSE &&
ENCLOSE_(target)->type == ENCLOSE_MEMORY) {
BIT_STATUS_ON_AT(env->bt_mem_end, ENCLOSE_(target)->regnum);
}
/* ()* ==> ()?, ()+ ==> () */
qn->upper = 1;
if (qn->lower > 1) qn->lower = 1;
- if (NODE_TYPE(target) == NT_STR) {
+ if (NODE_TYPE(target) == NODE_STR) {
qn->upper = qn->lower = 0; /* /(?:)+/ ==> // */
}
}
/* expand string */
#define EXPAND_STRING_MAX_LENGTH 100
- if (NODE_TYPE(target) == NT_STR) {
+ if (NODE_TYPE(target) == NODE_STR) {
if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper &&
qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) {
int len = NSTRING_LEN(target);
if (r) break;
}
onig_node_free(target);
- break; /* break case NT_QTFR: */
+ break; /* break case NODE_QTFR: */
}
}
}
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
if (qn->greedy && (qn->body_empty_info != 0)) {
- if (NODE_TYPE(target) == NT_QTFR) {
+ if (NODE_TYPE(target) == NODE_QTFR) {
QtfrNode* tqn = QTFR_(target);
if (IS_NOT_NULL(tqn->head_exact)) {
qn->head_exact = tqn->head_exact;
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
{
Node* target = NODE_BODY(node);
r = setup_tree(target, reg, state, env);
- if (NODE_TYPE(target) == NT_QTFR) {
+ if (NODE_TYPE(target) == NODE_QTFR) {
QtfrNode* tqn = QTFR_(target);
if (IS_REPEAT_INFINITE(tqn->upper) && tqn->lower <= 1 &&
tqn->greedy != 0) { /* (?>a*), a*+ etc... */
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
{
AnchorNode* an = ANCHOR_(node);
/* allowed node types in look-behind */
#define ALLOWED_TYPE_IN_LB \
- ( BIT_NT_LIST | BIT_NT_ALT | BIT_NT_STR | BIT_NT_CCLASS | BIT_NT_CTYPE | \
- BIT_NT_ANCHOR | BIT_NT_ENCLOSE | BIT_NT_QTFR | BIT_NT_CALL )
+ ( BIT_NODE_LIST | BIT_NODE_ALT | BIT_NODE_STR | BIT_NODE_CCLASS | BIT_NODE_CTYPE | \
+ BIT_NODE_ANCHOR | BIT_NODE_ENCLOSE | BIT_NODE_QTFR | BIT_NODE_CALL )
#define ALLOWED_ENCLOSE_IN_LB ( ENCLOSE_MEMORY | ENCLOSE_OPTION )
#define ALLOWED_ENCLOSE_IN_LB_NOT ENCLOSE_OPTION
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
+ case NODE_LIST:
{
OptEnv nenv;
NodeOptInfo nopt;
}
break;
- case NT_ALT:
+ case NODE_ALT:
{
NodeOptInfo nopt;
Node* nd = node;
}
break;
- case NT_STR:
+ case NODE_STR:
{
StrNode* sn = STR_(node);
int slen = sn->end - sn->s;
}
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
{
int i, z;
CClassNode* cc = CCLASS_(node);
}
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
{
int i, min, max;
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
switch (ANCHOR_(node)->type) {
case ANCHOR_BEGIN_BUF:
case ANCHOR_BEGIN_POSITION:
}
break;
- case NT_BREF:
+ case NODE_BREF:
{
int i;
int* backs;
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
if (NODE_IS_RECURSION(node))
set_mml(&opt->len, 0, ONIG_INFINITE_DISTANCE);
else {
break;
#endif
- case NT_QTFR:
+ case NODE_QTFR:
{
int i;
OnigLen min, max;
}
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
{
EncloseNode* en = ENCLOSE_(node);
type = NODE_TYPE(node);
switch (type) {
- case NT_LIST:
- case NT_ALT:
- if (NODE_TYPE(node) == NT_LIST)
+ case NODE_LIST:
+ case NODE_ALT:
+ if (NODE_TYPE(node) == NODE_LIST)
fprintf(f, "<list:%p>\n", node);
else
fprintf(f, "<alt:%p>\n", node);
}
break;
- case NT_STR:
+ case NODE_STR:
fprintf(f, "<string%s:%p>",
(NSTRING_IS_RAW(node) ? "-raw" : ""), node);
for (p = STR_(node)->s; p < STR_(node)->end; p++) {
}
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
fprintf(f, "<cclass:%p>", node);
if (IS_NCCLASS_NOT(CCLASS_(node))) fputs(" not", f);
if (CCLASS_(node)->mbuf) {
}
break;
- case NT_CTYPE:
+ case NODE_CTYPE:
fprintf(f, "<ctype:%p> ", node);
switch (CTYPE_(node)->ctype) {
case CTYPE_ANYCHAR:
}
break;
- case NT_ANCHOR:
+ case NODE_ANCHOR:
fprintf(f, "<anchor:%p> ", node);
switch (ANCHOR_(node)->type) {
case ANCHOR_BEGIN_BUF: fputs("begin buf", f); break;
}
break;
- case NT_BREF:
+ case NODE_BREF:
{
int* p;
BRefNode* br = BREF_(node);
break;
#ifdef USE_SUBEXP_CALL
- case NT_CALL:
+ case NODE_CALL:
{
CallNode* cn = CALL_(node);
fprintf(f, "<call:%p>", node);
break;
#endif
- case NT_QTFR:
+ case NODE_QTFR:
fprintf(f, "<quantifier:%p>{%d,%d}%s\n", node,
QTFR_(node)->lower, QTFR_(node)->upper,
(QTFR_(node)->greedy ? "" : "?"));
print_indent_tree(f, NODE_BODY(node), indent + add);
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
fprintf(f, "<enclose:%p> ", node);
switch (ENCLOSE_(node)->type) {
case ENCLOSE_OPTION:
break;
}
- if (type != NT_LIST && type != NT_ALT && type != NT_QTFR &&
- type != NT_ENCLOSE)
+ if (type != NODE_LIST && type != NODE_ALT && type != NODE_QTFR &&
+ type != NODE_ENCLOSE)
fprintf(f, "\n");
fflush(f);
}
#endif
switch (NODE_TYPE(node)) {
- case NT_STR:
+ case NODE_STR:
if (STR_(node)->capa != 0 &&
IS_NOT_NULL(STR_(node)->s) && STR_(node)->s != STR_(node)->buf) {
xfree(STR_(node)->s);
}
break;
- case NT_LIST:
- case NT_ALT:
+ case NODE_LIST:
+ case NODE_ALT:
onig_node_free(NODE_CAR(node));
{
Node* next_node = NODE_CDR(node);
}
break;
- case NT_CCLASS:
+ case NODE_CCLASS:
{
CClassNode* cc = CCLASS_(node);
}
break;
- case NT_BREF:
+ case NODE_BREF:
if (IS_NOT_NULL(BREF_(node)->back_dynamic))
xfree(BREF_(node)->back_dynamic);
break;
- case NT_QTFR:
- case NT_ENCLOSE:
- case NT_ANCHOR:
+ case NODE_QTFR:
+ case NODE_ENCLOSE:
+ case NODE_ANCHOR:
if (NODE_BODY(node))
onig_node_free(NODE_BODY(node));
break;
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_CCLASS);
+ SET_NODE_TYPE(node, NODE_CCLASS);
initialize_cclass(CCLASS_(node));
return node;
}
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_CTYPE);
+ SET_NODE_TYPE(node, NODE_CTYPE);
CTYPE_(node)->ctype = type;
CTYPE_(node)->not = not;
return node;
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_LIST);
+ SET_NODE_TYPE(node, NODE_LIST);
NODE_CAR(node) = left;
NODE_CDR(node) = right;
return node;
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_ALT);
+ SET_NODE_TYPE(node, NODE_ALT);
NODE_CAR(node) = left;
NODE_CDR(node) = right;
return node;
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_ANCHOR);
+ SET_NODE_TYPE(node, NODE_ANCHOR);
ANCHOR_(node)->type = type;
ANCHOR_(node)->char_len = -1;
return node;
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_BREF);
+ SET_NODE_TYPE(node, NODE_BREF);
BREF_(node)->back_num = back_num;
BREF_(node)->back_dynamic = (int* )NULL;
if (by_name != 0)
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_CALL);
+ SET_NODE_TYPE(node, NODE_CALL);
CALL_(node)->name = name;
CALL_(node)->name_end = name_end;
CALL_(node)->group_num = gnum; /* call by number if gnum != 0 */
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_QTFR);
+ SET_NODE_TYPE(node, NODE_QTFR);
QTFR_(node)->lower = lower;
QTFR_(node)->upper = upper;
QTFR_(node)->greedy = 1;
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_ENCLOSE);
+ SET_NODE_TYPE(node, NODE_ENCLOSE);
ENCLOSE_(node)->type = type;
ENCLOSE_(node)->regnum = 0;
ENCLOSE_(node)->option = 0;
extern void
onig_node_conv_to_str_node(Node* node, int flag)
{
- SET_NODE_TYPE(node, NT_STR);
+ SET_NODE_TYPE(node, NODE_STR);
STR_(node)->flag = flag;
STR_(node)->capa = 0;
STR_(node)->s = STR_(node)->buf;
Node* node = node_new();
CHECK_NULL_RETURN(node);
- SET_NODE_TYPE(node, NT_STR);
+ SET_NODE_TYPE(node, NODE_STR);
STR_(node)->capa = 0;
STR_(node)->flag = 0;
STR_(node)->s = STR_(node)->buf;
is_invalid_quantifier_target(Node* node)
{
switch (NODE_TYPE(node)) {
- case NT_ANCHOR:
+ case NODE_ANCHOR:
return 1;
break;
- case NT_ENCLOSE:
+ case NODE_ENCLOSE:
/* allow enclosed elements */
/* return is_invalid_quantifier_target(NODE_BODY(node)); */
break;
- case NT_LIST:
+ case NODE_LIST:
do {
if (! is_invalid_quantifier_target(NODE_CAR(node))) return 0;
} while (IS_NOT_NULL(node = NODE_CDR(node)));
return 0;
break;
- case NT_ALT:
+ case NODE_ALT:
do {
if (is_invalid_quantifier_target(NODE_CAR(node))) return 1;
} while (IS_NOT_NULL(node = NODE_CDR(node)));
}
NODE_BODY(*np) = target;
- if (NODE_TYPE(*np) == NT_ENCLOSE) {
+ if (NODE_TYPE(*np) == NODE_ENCLOSE) {
if (ENCLOSE_(*np)->type == ENCLOSE_MEMORY) {
/* Don't move this to previous of parse_subexp() */
r = scan_env_set_mem_node(env, ENCLOSE_(*np)->regnum, *np);
return 1;
switch (NODE_TYPE(target)) {
- case NT_STR:
+ case NODE_STR:
if (! group) {
StrNode* sn = STR_(target);
if (str_node_can_be_split(sn, env->enc)) {
}
break;
- case NT_QTFR:
+ case NODE_QTFR:
{ /* check redundant double repeat. */
/* verbose warn (?:.?)? etc... but not warn (.?)? etc... */
QtfrNode* qnt = QTFR_(target);
return r;
}
- if (NODE_TYPE(node) == NT_LIST) {
+ if (NODE_TYPE(node) == NODE_LIST) {
*headp = node;
while (IS_NOT_NULL(NODE_CDR(node))) node = NODE_CDR(node);
headp = &(NODE_CDR(node));