Skip to content

Instantly share code, notes, and snippets.

@milesrout
Created April 18, 2017 02:07
Show Gist options
  • Save milesrout/51fed7a62b7deb42716177149d65b792 to your computer and use it in GitHub Desktop.
Save milesrout/51fed7a62b7deb42716177149d65b792 to your computer and use it in GitHub Desktop.
from typing import Iterable, Pattern
def scanner(src: string, regexes: Iterable[(str, Pattern)]) -> Iterable[(string, string)]:
"""Takes source code, and a list of tuples of the form (token_name,
token_regex). Yields pairs (token_name, token_literal)."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment