From a27fcfe7dd103857ba6793782fd462e56ebd3afb Mon Sep 17 00:00:00 2001 From: kosako Date: Mon, 4 Jul 2016 17:30:55 +0900 Subject: [PATCH] output elements of look-behind node in print_indent_tree() --- src/regcomp.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index 8b5b206..f9b900f 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -3094,6 +3094,8 @@ divide_look_behind_alternatives(Node* node) AnchorNode* an = NANCHOR(node); int anc_type = an->type; + /* fprintf(stderr, "divide_look_behind: %d\n", (int )node); */ + head = an->target; np = NCAR(head); swap_node(node, head); @@ -3123,6 +3125,8 @@ setup_look_behind(Node* node, regex_t* reg, ScanEnv* env) int r, len; AnchorNode* an = NANCHOR(node); + /* fprintf(stderr, "setup_look_behind: %x\n", (int )node); */ + r = get_char_length_tree(an->target, reg, &len); if (r == 0) an->char_len = len; @@ -6141,10 +6145,22 @@ print_indent_tree(FILE* f, Node* node, int indent) case ANCHOR_WORD_BEGIN: fputs("word begin", f); break; case ANCHOR_WORD_END: fputs("word end", f); break; #endif - case ANCHOR_PREC_READ: fputs("prec read", f); break; - case ANCHOR_PREC_READ_NOT: fputs("prec read not", f); break; - case ANCHOR_LOOK_BEHIND: fputs("look_behind", f); break; - case ANCHOR_LOOK_BEHIND_NOT: fputs("look_behind_not",f); break; + case ANCHOR_PREC_READ: + fprintf(f, "prec read\n"); + print_indent_tree(f, NANCHOR(node)->target, indent + add); + break; + case ANCHOR_PREC_READ_NOT: + fprintf(f, "prec read not\n"); + print_indent_tree(f, NANCHOR(node)->target, indent + add); + break; + case ANCHOR_LOOK_BEHIND: + fprintf(f, "look behind\n"); + print_indent_tree(f, NANCHOR(node)->target, indent + add); + break; + case ANCHOR_LOOK_BEHIND_NOT: + fprintf(f, "look behind not\n"); + print_indent_tree(f, NANCHOR(node)->target, indent + add); + break; default: fprintf(f, "ERROR: undefined anchor type.\n"); -- 2.40.0