From 73aeaaf5ff257ccd1474f2cbfac659708b38cfbc Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Tue, 4 Jul 2017 10:36:01 +0900 Subject: [PATCH] rename bref to backref --- src/regcomp.c | 44 ++++++++++++++++++++++---------------------- src/regparse.c | 18 +++++++++--------- src/regparse.h | 12 ++++++------ 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index db83739..44cfa8a 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -1639,9 +1639,9 @@ compile_length_tree(Node* node, regex_t* reg) r = SIZE_OPCODE; break; - case NODE_BREF: + case NODE_BACKREF: { - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); #ifdef USE_BACKREF_WITH_LEVEL if (NODE_IS_NEST_LEVEL(node)) { @@ -1764,9 +1764,9 @@ compile_tree(Node* node, regex_t* reg, ScanEnv* env) } break; - case NODE_BREF: + case NODE_BACKREF: { - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); #ifdef USE_BACKREF_WITH_LEVEL if (NODE_IS_NEST_LEVEL(node)) { @@ -1920,7 +1920,7 @@ renumber_node_backref(Node* node, GroupNumRemap* map) { int i, pos, n, old_num; int *backs; - BRefNode* bn = BREF_(node); + BackRefNode* bn = BACKREF_(node); if (! NODE_IS_BY_NAME(node)) return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED; @@ -1961,7 +1961,7 @@ renumber_by_map(Node* node, GroupNumRemap* map) r = renumber_by_map(NODE_BODY(node), map); break; - case NODE_BREF: + case NODE_BACKREF: r = renumber_node_backref(node, map); break; @@ -1999,7 +1999,7 @@ numbered_ref_check(Node* node) r = numbered_ref_check(NODE_BODY(node)); break; - case NODE_BREF: + case NODE_BACKREF: if (! NODE_IS_BY_NAME(node)) return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED; break; @@ -2399,7 +2399,7 @@ get_head_value_node(Node* node, int exact, regex_t* reg) Node* n = NULL_NODE; switch (NODE_TYPE(node)) { - case NODE_BREF: + case NODE_BACKREF: case NODE_ALT: #ifdef USE_SUBEXP_CALL case NODE_CALL: @@ -2538,12 +2538,12 @@ get_min_len(Node* node, ScanEnv* env) len = 0; switch (NODE_TYPE(node)) { - case NODE_BREF: + case NODE_BACKREF: { int i; int* backs; MemEnv* mem_env = SCANENV_MEMENV(env); - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); if (NODE_IS_RECURSION(node)) break; backs = BACKREFS_P(br); @@ -2683,12 +2683,12 @@ get_max_len(Node* node, ScanEnv* env) len = ONIGENC_MBC_MAXLEN_DIST(env->enc); break; - case NODE_BREF: + case NODE_BACKREF: { int i; int* backs; MemEnv* mem_env = SCANENV_MEMENV(env); - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); if (NODE_IS_RECURSION(node)) { len = ONIG_INFINITE_DISTANCE; break; @@ -2787,10 +2787,10 @@ check_backrefs(Node* node, ScanEnv* env) r = check_backrefs(NODE_BODY(node), env); break; - case NODE_BREF: + case NODE_BACKREF: { int i; - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); int* backs = BACKREFS_P(br); MemEnv* mem_env = SCANENV_MEMENV(env); @@ -3708,7 +3708,7 @@ quantifiers_memory_node_info(Node* node) } break; - case NODE_BREF: + case NODE_BACKREF: case NODE_STR: case NODE_CTYPE: case NODE_CCLASS: @@ -4082,7 +4082,7 @@ setup_called_state(Node* node, int state) } break; - case NODE_BREF: + case NODE_BACKREF: case NODE_STR: case NODE_CTYPE: case NODE_CCLASS: @@ -4284,11 +4284,11 @@ setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env) } break; - case NODE_BREF: + case NODE_BACKREF: { int i; int* p; - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); p = BACKREFS_P(br); for (i = 0; i < br->back_num; i++) { if (p[i] > env->num_mem) return ONIGERR_INVALID_BACKREF; @@ -5191,13 +5191,13 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env) } break; - case NODE_BREF: + case NODE_BACKREF: { int i; int* backs; OnigLen min, max, tmin, tmax; MemEnv* mem_env = SCANENV_MEMENV(env->scan_env); - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); if (NODE_IS_RECURSION(node)) { set_mml(&opt->len, 0, ONIG_INFINITE_DISTANCE); @@ -6659,10 +6659,10 @@ print_indent_tree(FILE* f, Node* node, int indent) } break; - case NODE_BREF: + case NODE_BACKREF: { int* p; - BRefNode* br = BREF_(node); + BackRefNode* br = BACKREF_(node); p = BACKREFS_P(br); fprintf(f, "", node); for (i = 0; i < br->back_num; i++) { diff --git a/src/regparse.c b/src/regparse.c index 2715e74..0307978 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -1104,9 +1104,9 @@ onig_node_free(Node* node) } break; - case NODE_BREF: - if (IS_NOT_NULL(BREF_(node)->back_dynamic)) - xfree(BREF_(node)->back_dynamic); + case NODE_BACKREF: + if (IS_NOT_NULL(BACKREF_(node)->back_dynamic)) + xfree(BACKREF_(node)->back_dynamic); break; case NODE_QUANT: @@ -1244,16 +1244,16 @@ node_new_backref(int back_num, int* backrefs, int by_name, CHECK_NULL_RETURN(node); - SET_NODE_TYPE(node, NODE_BREF); - BREF_(node)->back_num = back_num; - BREF_(node)->back_dynamic = (int* )NULL; + SET_NODE_TYPE(node, NODE_BACKREF); + BACKREF_(node)->back_num = back_num; + BACKREF_(node)->back_dynamic = (int* )NULL; if (by_name != 0) NODE_STATUS_ADD(node, NST_BY_NAME); #ifdef USE_BACKREF_WITH_LEVEL if (exist_level != 0) { NODE_STATUS_ADD(node, NST_NEST_LEVEL); - BREF_(node)->nest_level = nest_level; + BACKREF_(node)->nest_level = nest_level; } #endif @@ -1267,7 +1267,7 @@ node_new_backref(int back_num, int* backrefs, int by_name, if (back_num <= NODE_BACKREFS_SIZE) { for (i = 0; i < back_num; i++) - BREF_(node)->back_static[i] = backrefs[i]; + BACKREF_(node)->back_static[i] = backrefs[i]; } else { int* p = (int* )xmalloc(sizeof(int) * back_num); @@ -1275,7 +1275,7 @@ node_new_backref(int back_num, int* backrefs, int by_name, onig_node_free(node); return NULL; } - BREF_(node)->back_dynamic = p; + BACKREF_(node)->back_dynamic = p; for (i = 0; i < back_num; i++) p[i] = backrefs[i]; } diff --git a/src/regparse.h b/src/regparse.h index 524f7c4..637ea22 100644 --- a/src/regparse.h +++ b/src/regparse.h @@ -36,7 +36,7 @@ typedef enum { NODE_STR = 0, NODE_CCLASS = 1, NODE_CTYPE = 2, - NODE_BREF = 3, + NODE_BACKREF = 3, NODE_QUANT = 4, NODE_ENCLOSURE = 5, NODE_ANCHOR = 6, @@ -51,7 +51,7 @@ typedef enum { #define BIT_NODE_STR NODE_TYPE2BIT(NODE_STR) #define BIT_NODE_CCLASS NODE_TYPE2BIT(NODE_CCLASS) #define BIT_NODE_CTYPE NODE_TYPE2BIT(NODE_CTYPE) -#define BIT_NODE_BREF NODE_TYPE2BIT(NODE_BREF) +#define BIT_NODE_BACKREF NODE_TYPE2BIT(NODE_BACKREF) #define BIT_NODE_QUANT NODE_TYPE2BIT(NODE_QUANT) #define BIT_NODE_ENCLOSURE NODE_TYPE2BIT(NODE_ENCLOSURE) #define BIT_NODE_ANCHOR NODE_TYPE2BIT(NODE_ANCHOR) @@ -61,7 +61,7 @@ typedef enum { #define NODE_IS_SIMPLE_TYPE(node) \ ((NODE_TYPE2BIT(NODE_TYPE(node)) & \ - (BIT_NODE_STR | BIT_NODE_CCLASS | BIT_NODE_CTYPE | BIT_NODE_BREF)) != 0) + (BIT_NODE_STR | BIT_NODE_CCLASS | BIT_NODE_CTYPE | BIT_NODE_BACKREF)) != 0) #define NODE_TYPE(node) ((node)->u.base.node_type) #define SET_NODE_TYPE(node, ntype) (node)->u.base.node_type = (ntype) @@ -69,7 +69,7 @@ typedef enum { #define STR_(node) (&((node)->u.str)) #define CCLASS_(node) (&((node)->u.cclass)) #define CTYPE_(node) (&((node)->u.ctype)) -#define BREF_(node) (&((node)->u.bref)) +#define BACKREF_(node) (&((node)->u.backref)) #define QUANT_(node) (&((node)->u.quant)) #define ENCLOSURE_(node) (&((node)->u.enclosure)) #define ANCHOR_(node) (&((node)->u.anchor)) @@ -268,7 +268,7 @@ typedef struct { int back_static[NODE_BACKREFS_SIZE]; int* back_dynamic; int nest_level; -} BRefNode; +} BackRefNode; typedef struct { NodeType node_type; @@ -307,7 +307,7 @@ typedef struct _Node { CClassNode cclass; QuantNode quant; EnclosureNode enclosure; - BRefNode bref; + BackRefNode backref; AnchorNode anchor; ConsAltNode cons; CtypeNode ctype; -- 2.40.0