MCPcopy Create free account
hub / github.com/git/git / compile_pattern_atom

Function compile_pattern_atom

grep.c:605–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603
604static struct grep_expr *compile_pattern_or(struct grep_pat **);
605static struct grep_expr *compile_pattern_atom(struct grep_pat **list)
606{
607 struct grep_pat *p;
608 struct grep_expr *x;
609
610 p = *list;
611 if (!p)
612 return NULL;
613 switch (p->token) {
614 case GREP_PATTERN: /* atom */
615 case GREP_PATTERN_HEAD:
616 case GREP_PATTERN_BODY:
617 CALLOC_ARRAY(x, 1);
618 x->node = GREP_NODE_ATOM;
619 x->u.atom = p;
620 *list = p->next;
621 return x;
622 case GREP_OPEN_PAREN:
623 *list = p->next;
624 x = compile_pattern_or(list);
625 if (!*list || (*list)->token != GREP_CLOSE_PAREN)
626 die("unmatched ( for expression group");
627 *list = (*list)->next;
628 return x;
629 default:
630 return NULL;
631 }
632}
633
634static struct grep_expr *compile_pattern_not(struct grep_pat **list)
635{

Callers 2

compile_pattern_notFunction · 0.85
prep_header_patternsFunction · 0.85

Calls 2

compile_pattern_orFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected