Created
March 29, 2016 15:08
-
-
Save FerrielMelarpis/5d45ccf33e8f6eb2eeda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def analyze(code): | |
| tokenizer = _lexemes.scanner(code) | |
| tokenpairs = [] | |
| while 1: | |
| token = tokenizer.match() | |
| if not token: | |
| break | |
| tokenpairs.append(tuple([token.group(token.lastindex), _tokendesc[token.lastindex - 1]])) | |
| return tokenpairs | |
| if __name__ == "__main__": | |
| code = "SELECT col_1, COUNT(col_2) FROM tb_1 WHERE col_1 = col_2" | |
| tokens = analyze(code) | |
| for t in tokens: | |
| print t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment