From ccf4902aa68d5fb6c4ba63fed041cb6495da7c08 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Tue, 22 Aug 2017 09:00:13 +0900 Subject: [PATCH] refactoring --- src/regcomp.c | 12 ++++++------ src/regint.h | 4 ++-- src/regparse.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index 9223ddd..594f1c6 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -1595,7 +1595,7 @@ compile_length_anchor_node(AnchorNode* node, regex_t* reg) len = SIZE_OP_PUSH_LOOK_BEHIND_NOT + tlen + SIZE_OP_FAIL_LOOK_BEHIND_NOT; break; - case ANCHOR_WORD_BOUND: + case ANCHOR_WORD_BOUNDARY: case ANCHOR_NO_WORD_BOUND: #ifdef USE_WORD_BEGIN_END case ANCHOR_WORD_BEGIN: @@ -1631,7 +1631,7 @@ compile_anchor_node(AnchorNode* node, regex_t* reg, ScanEnv* env) case ANCHOR_SEMI_END_BUF: r = add_opcode(reg, OP_SEMI_END_BUF); break; case ANCHOR_BEGIN_POSITION: r = add_opcode(reg, OP_BEGIN_POSITION); break; - case ANCHOR_WORD_BOUND: + case ANCHOR_WORD_BOUNDARY: op = OP_WORD_BOUND; word: r = add_opcode(reg, op); @@ -4630,14 +4630,14 @@ setup_anchor(Node* node, regex_t* reg, int state, ScanEnv* env) #define ALLOWED_ANCHOR_IN_LB \ ( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF \ - | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUND | ANCHOR_NO_WORD_BOUND \ + | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUNDARY | ANCHOR_NO_WORD_BOUND \ | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END \ | ANCHOR_EXTENDED_GRAPHEME_CLUSTER_BOUND \ | ANCHOR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUND ) #define ALLOWED_ANCHOR_IN_LB_NOT \ ( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE \ - | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUND \ + | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUNDARY \ | ANCHOR_NO_WORD_BOUND | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END \ | ANCHOR_EXTENDED_GRAPHEME_CLUSTER_BOUND \ | ANCHOR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUND ) @@ -7245,8 +7245,8 @@ print_indent_tree(FILE* f, Node* node, int indent) case ANCHOR_SEMI_END_BUF: fputs("semi end buf", f); break; case ANCHOR_BEGIN_POSITION: fputs("begin position", f); break; - case ANCHOR_WORD_BOUND: fputs("word bound", f); break; - case ANCHOR_NO_WORD_BOUND: fputs("not word bound", f); break; + case ANCHOR_WORD_BOUNDARY: fputs("word boundary", f); break; + case ANCHOR_NO_WORD_BOUND: fputs("not word boundary", f); break; #ifdef USE_WORD_BEGIN_END case ANCHOR_WORD_BEGIN: fputs("word begin", f); break; case ANCHOR_WORD_END: fputs("word end", f); break; diff --git a/src/regint.h b/src/regint.h index 1b6d8b2..20e1bbb 100644 --- a/src/regint.h +++ b/src/regint.h @@ -457,7 +457,7 @@ typedef struct _BBuf { #define ANCHOR_END_BUF (1<<7) #define ANCHOR_SEMI_END_BUF (1<<8) #define ANCHOR_END_LINE (1<<9) -#define ANCHOR_WORD_BOUND (1<<10) +#define ANCHOR_WORD_BOUNDARY (1<<10) #define ANCHOR_NO_WORD_BOUND (1<<11) #define ANCHOR_WORD_BEGIN (1<<12) #define ANCHOR_WORD_END (1<<13) @@ -470,7 +470,7 @@ typedef struct _BBuf { #define ANCHOR_HAS_BODY(a) ((a)->type < ANCHOR_BEGIN_BUF) #define IS_WORD_ANCHOR_TYPE(type) \ - ((type) == ANCHOR_WORD_BOUND || (type) == ANCHOR_NO_WORD_BOUND || \ + ((type) == ANCHOR_WORD_BOUNDARY || (type) == ANCHOR_NO_WORD_BOUND || \ (type) == ANCHOR_WORD_BEGIN || (type) == ANCHOR_WORD_END) /* operation code */ diff --git a/src/regparse.c b/src/regparse.c index 43133f0..6366474 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -3928,7 +3928,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) case 'b': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_B_WORD_BOUND)) break; tok->type = TK_ANCHOR; - tok->u.anchor = ANCHOR_WORD_BOUND; + tok->u.anchor = ANCHOR_WORD_BOUNDARY; break; case 'B': -- 2.40.0