SHARE
TWEET

Untitled

a guest Mar 26th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def consume_if2(self, token_type, *token_types):
  2.         tokens = []
  3.  
  4.         for first, second in pairwise(chain([token_type], token_types)):
  5.             if self.match(first):
  6.                 tokens.append(self.current())
  7.             else:
  8.                 return False, tokens
  9.  
  10.             if self.match_next(second):
  11.                 self.advance()
  12.             else:
  13.                 return False, tokens
  14.         tokens.append(self.next())
  15.         return True, tokens
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top