pyebnf/primitive.py
def _get_exclusion(extractor, exclusion, text):
  """Returns extractor's result if exclusion does not match.

  If exclusion raises DeadEnd (meaning it did not match) then the result of extractor(text) is
  returned. Otherwise, if exclusion does not raise DeadEnd it means it did match, and we then
  raise DeadEnd.
  """
  try:
    _call_extractor(exclusion, text)
    exclusion_matches = True
  except DeadEnd:
    exclusion_matches = False

  if exclusion_matches:
    raise DeadEnd()
  else:
    return _call_extractor(extractor, text)
def _get_exclusion(extractor, exclusion, text):
  """Returns extractor's result if exclusion does not match.

  If exclusion raises DeadEnd (meaning it did not match) then the result of extractor(text) is
  returned. Otherwise, if exclusion does not raise DeadEnd it means it did match, and we then
  raise DeadEnd.
  """
  try:
    _call_extractor(exclusion, text)
    exclusion_matches = True
  except DeadEnd:
    exclusion_matches = False

  if exclusion_matches:
    raise DeadEnd()
  else:
    return _call_extractor(extractor, text)
Returns extractor's result if exclusion does not match.

  If exclusion raises DeadEnd (meaning it did not match) then the result of extractor(text) is
  returned. Otherwise, if exclusion does not raise DeadEnd it means it did match, and we then
  raise DeadEnd.