Browse Source

python 3.7 support

master
adam j hartz 10 months ago
parent
commit
74576600c4
2 changed files with 6 additions and 2 deletions
  1. 1
    1
      takoshell/lexer.py
  2. 5
    1
      takoshell/tokenize.py

+ 1
- 1
takoshell/lexer.py View File

@@ -73,7 +73,7 @@ token_map[tokenize.SEARCHPATH] = 'SEARCHPATH'
73 73
 token_map[tokenize.NEWLINE] = 'NEWLINE'
74 74
 token_map[tokenize.INDENT] = 'INDENT'
75 75
 token_map[tokenize.DEDENT] = 'DEDENT'
76
-if PYTHON_VERSION_INFO >= (3, 5, 0):
76
+if (3, 7, 0) > PYTHON_VERSION_INFO >= (3, 5, 0):
77 77
     token_map[tokenize.ASYNC] = 'ASYNC'
78 78
     token_map[tokenize.AWAIT] = 'AWAIT'
79 79
 

+ 5
- 1
takoshell/tokenize.py View File

@@ -60,8 +60,12 @@ __all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
60 60
                            'DOLLARNAME', 'IOREDIRECT']
61 61
 del token
62 62
 
63
+PY37 = PYTHON_VERSION_INFO >= (3, 5, 0)
63 64
 PY35 = PYTHON_VERSION_INFO >= (3, 5, 0)
64
-if PY35:
65
+if PY37:
66
+    AUGASSIGN_OPS = r"[+\-*/%&@|^=<>]=?"
67
+    ADDSPACE_TOKS = (NAME, NUMBER)
68
+elif PY35:
65 69
     AUGASSIGN_OPS = r"[+\-*/%&@|^=<>]=?"
66 70
     ADDSPACE_TOKS = (NAME, NUMBER, ASYNC, AWAIT)
67 71
 else:

Loading…
Cancel
Save