#endif
case ANCR_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY:
- r = add_op(reg, OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY);
- break;
-
case ANCR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY:
- r = add_op(reg, OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY);
+ r = add_op(reg, OP_TEXT_SEGMENT_BOUNDARY);
+ if (r != 0) return r;
+ COP(reg)->text_segment_boundary.not =
+ (node->type == ANCR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY ? 1 : 0);
break;
case ANCR_PREC_READ:
{ OP_NO_WORD_BOUNDARY, "not-word-boundary" },
{ OP_WORD_BEGIN, "word-begin" },
{ OP_WORD_END, "word-end" },
- { OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY, "extended-grapheme-cluster-boundary" },
- { OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY, "no-extended-grapheme-cluster-boundary" },
+ { OP_TEXT_SEGMENT_BOUNDARY, "text-segment-boundary" },
{ OP_BEGIN_BUF, "begin-buf" },
{ OP_END_BUF, "end-buf" },
{ OP_BEGIN_LINE, "begin-line" },
break;
#endif
+ case OP_TEXT_SEGMENT_BOUNDARY:
+ if (p->text_segment_boundary.not != 0)
+ fprintf(f, ":not");
+ break;
+
case OP_FINISH:
case OP_END:
case OP_ANYCHAR:
case OP_WORD_ASCII:
case OP_NO_WORD:
case OP_NO_WORD_ASCII:
- case OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY:
- case OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY:
case OP_BEGIN_BUF:
case OP_END_BUF:
case OP_BEGIN_LINE:
&&L_NO_WORD_BOUNDARY,
&&L_WORD_BEGIN,
&&L_WORD_END,
- &&L_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
- &&L_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
+ &&L_TEXT_SEGMENT_BOUNDARY,
&&L_BEGIN_BUF,
&&L_END_BUF,
&&L_BEGIN_LINE,
goto fail;
#endif
- CASE_OP(EXTENDED_GRAPHEME_CLUSTER_BOUNDARY)
- if (onigenc_egcb_is_break_position(encode, s, sprev, str, end)) {
- INC_OP;
- JUMP_OUT;
- }
- goto fail;
+ CASE_OP(TEXT_SEGMENT_BOUNDARY)
+ {
+ int is_break;
- CASE_OP(NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY)
- if (onigenc_egcb_is_break_position(encode, s, sprev, str, end))
- goto fail;
+ switch (p->text_segment_boundary.type) {
+ case EXTENDED_GRAPHEME_CLUSTER_BOUNDARY:
+ is_break = onigenc_egcb_is_break_position(encode, s, sprev, str, end);
+ break;
+ default:
+ goto bytecode_error;
+ break;
+ }
- INC_OP;
- JUMP_OUT;
+ if (p->text_segment_boundary.not != 0)
+ is_break = ! is_break;
+
+ if (is_break != 0) {
+ INC_OP;
+ JUMP_OUT;
+ }
+ else {
+ goto fail;
+ }
+ }
CASE_OP(BEGIN_BUF)
if (! ON_STR_BEGIN(s)) goto fail;
OP_WORD_BEGIN,
OP_WORD_END,
- OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
- OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
+ OP_TEXT_SEGMENT_BOUNDARY,
OP_BEGIN_BUF,
OP_END_BUF,
UPDATE_VAR_RIGHT_RANGE_INIT = 4,
};
+enum TextSegmentBoundaryType {
+ EXTENDED_GRAPHEME_CLUSTER_BOUNDARY = 0,
+ WORD_BOUNDARY = 1,
+};
+
typedef int RelAddrType;
typedef int AbsAddrType;
typedef int LengthType;
struct {
ModeType mode;
} word_boundary; /* OP_WORD_BOUNDARY, OP_NO_WORD_BOUNDARY, OP_WORD_BEGIN, OP_WORD_END */
+ struct {
+ enum TextSegmentBoundaryType type;
+ int not;
+ } text_segment_boundary;
struct {
union {
MemNumType n1; /* num == 1 */