}
if (qn->greedy) {
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
if (IS_NOT_NULL(qn->head_exact))
len += SIZE_OP_PUSH_OR_JUMP_EXACT1 + mod_tlen + SIZE_OP_JUMP;
- else if (IS_NOT_NULL(qn->next_head_exact))
+ else
+#endif
+ if (IS_NOT_NULL(qn->next_head_exact))
len += SIZE_OP_PUSH_IF_PEEK_NEXT + mod_tlen + SIZE_OP_JUMP;
else
len += SIZE_OP_PUSH + mod_tlen + SIZE_OP_JUMP;
r = add_op(reg, OP_JUMP);
if (r != 0) return r;
if (qn->greedy) {
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
if (IS_NOT_NULL(qn->head_exact))
COP(reg)->jump.addr = SIZE_OP_PUSH_OR_JUMP_EXACT1 + SIZE_INC_OP;
- else if (IS_NOT_NULL(qn->next_head_exact))
+ else
+#endif
+ if (IS_NOT_NULL(qn->next_head_exact))
COP(reg)->jump.addr = SIZE_OP_PUSH_IF_PEEK_NEXT + SIZE_INC_OP;
else
COP(reg)->jump.addr = SIZE_OP_PUSH + SIZE_INC_OP;
}
if (qn->greedy) {
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
if (IS_NOT_NULL(qn->head_exact)) {
r = add_op(reg, OP_PUSH_OR_JUMP_EXACT1);
if (r != 0) return r;
addr = -(mod_tlen + (int )SIZE_OP_PUSH_OR_JUMP_EXACT1);
}
- else if (IS_NOT_NULL(qn->next_head_exact)) {
+ else
+#endif
+ if (IS_NOT_NULL(qn->next_head_exact)) {
r = add_op(reg, OP_PUSH_IF_PEEK_NEXT);
if (r != 0) return r;
COP(reg)->push_if_peek_next.addr = SIZE_INC_OP + mod_tlen + SIZE_OP_JUMP;
}
}
-#ifdef USE_OP_PUSH_OR_JUMP_EXACT
if (qn->greedy && (qn->body_empty_info == QUANT_BODY_IS_NOT_EMPTY)) {
if (NODE_TYPE(body) == NODE_QUANT) {
QuantNode* tqn = QUANT_(body);
qn->head_exact = get_head_value_node(NODE_BODY(node), 1, reg);
}
}
-#endif
return r;
}
{ OP_PUSH, "push" },
{ OP_PUSH_SUPER, "push-super" },
{ OP_POP_OUT, "pop-out" },
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
{ OP_PUSH_OR_JUMP_EXACT1, "push-or-jump-e1" },
+#endif
{ OP_PUSH_IF_PEEK_NEXT, "push-if-peek-next" },
{ OP_REPEAT, "repeat" },
{ OP_REPEAT_NG, "repeat-ng" },
p_rel_addr(f, addr, p, start);
break;
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
case OP_PUSH_OR_JUMP_EXACT1:
addr = p->push_or_jump_exact1.addr;
fputc(':', f);
p_rel_addr(f, addr, p, start);
p_string(f, 1, &(p->push_or_jump_exact1.c));
break;
+#endif
case OP_PUSH_IF_PEEK_NEXT:
addr = p->push_if_peek_next.addr;
&&L_PUSH,
&&L_PUSH_SUPER,
&&L_POP_OUT,
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
&&L_PUSH_OR_JUMP_EXACT1,
+#endif
&&L_PUSH_IF_PEEK_NEXT,
&&L_REPEAT,
&&L_REPEAT_NG,
INC_OP;
JUMP_OUT;
+ #ifdef USE_OP_PUSH_OR_JUMP_EXACT
CASE_OP(PUSH_OR_JUMP_EXACT1)
{
UChar c;
}
p += addr;
JUMP_OUT;
+#endif
CASE_OP(PUSH_IF_PEEK_NEXT)
{
#endif
/* internal config */
-#define USE_OP_PUSH_OR_JUMP_EXACT
+/* #define USE_OP_PUSH_OR_JUMP_EXACT */
#define USE_QUANT_PEEK_NEXT
#define USE_ST_LIBRARY
OP_PUSH,
OP_PUSH_SUPER,
OP_POP_OUT,
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
+#endif
OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
OP_REPEAT, /* {n,m} */
OP_REPEAT_NG, /* {n,m}? (non greedy) */
#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_PUSH_SUPER (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_POP_OUT SIZE_OPCODE
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
+#endif
#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_PUSH 1
#define SIZE_OP_PUSH_SUPER 1
#define SIZE_OP_POP_OUT 1
+#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 1
+#endif
#define SIZE_OP_PUSH_IF_PEEK_NEXT 1
#define SIZE_OP_REPEAT 1
#define SIZE_OP_REPEAT_INC 1