Skip to content

Commit

Permalink
Implement matches composition like processors and rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Nov 8, 2015
1 parent 8ac3196 commit 34ff5b0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rebulk/rebulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ def _matches_patterns(self, matches, context):
:rtype:
"""
if not self.disabled(context):
for pattern in self._patterns:
patterns = list(self._patterns)
for rebulk in self._rebulks:
if not rebulk.disabled(context):
extend_safe(patterns, rebulk._patterns)
for pattern in patterns:
if not pattern.disabled(context):
pattern_matches = pattern.matches(matches.input_string, context)
if pattern_matches:
Expand All @@ -326,8 +330,6 @@ def _matches_patterns(self, matches, context):
matches.append(match)
else:
log(pattern.log_level, "Pattern is disabled. (%s)", pattern)
for rebulk in self._rebulks:
rebulk._matches_patterns(matches, context)


DEFAULT_PROCESSORS = [conflict_prefer_longer]
Expand Down

0 comments on commit 34ff5b0

Please sign in to comment.