MCPcopy Create free account
hub / github.com/IBM/Project_CodeNet / token

Function token

tools/tokenizer/tokenize.py:32–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31# Token generator:
32def token():
33 global _token, _kind, _linenr, _column, _pos
34
35 # C_tokenize returns 0 upon end-of-file.
36 while int(libtoken.C_tokenize(byref(_token), byref(_kind), byref(_linenr),
37 byref(_column), byref(_pos))):
38 # Turn ctypes into real Python values:
39 lin = _linenr.value
40 col = _column.value
41 pos = _pos.value # not used for now
42 clas = _kind.value.decode()
43 text = _token.value.decode()
44 yield (lin,col,clas,text)
45
46if len(sys.argv) == 1:
47 for tok in token():

Callers 1

tokenize.pyFile · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected