Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def consume_if2(self, token_type, *token_types):
- tokens = []
- for first, second in pairwise(chain([token_type], token_types)):
- if self.match(first):
- tokens.append(self.current())
- else:
- return False, tokens
- if self.match_next(second):
- self.advance()
- else:
- return False, tokens
- tokens.append(self.next())
- return True, tokens
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement