Exemplo n.º 1
0
def _get_token_list(string, version=None):
    # Load the current version.
    version_info = parse_version_string(version)
    return list(tokenize(string, version_info))
Exemplo n.º 2
0
 def __init__(self, bnf_grammar: str) -> None:
     self._bnf_grammar: str = bnf_grammar
     self.generator = tokenize(bnf_grammar, version_info=parse_version_string("3.6"))
     self._gettoken()  # Initialize lookahead
Exemplo n.º 3
0
 def test_tokenize_start_pos(self, code, positions):
     tokens = list(tokenize(code, version_info=parse_version_string("3.6")))
     assert positions == [p.start_pos for p in tokens]