Fix TextIO compatibility with Python 3.6+ in LexerFile (#3067)

* Fix TextIO compatibility with Python 3.6+ in LexerFile

* Sign contributors.txt
This commit is contained in:
Taras Sotnikov 2021-02-03 02:48:41 +01:00 committed by GitHub
parent 4b649103f3
commit f7b4100fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -285,3 +285,4 @@ YYYY/MM/DD, github id, Full name, email
2020/12/01, maxence-lefebvre, Maxence Lefebvre, maxence-lefebvre@users.noreply.github.com
2020/12/03, electrum, David Phillips, david@acz.org
2021/01/25, l215884529, Qiheng Liu, 13607681+l215884529@users.noreply.github.com
2021/02/02, tsotnikov, Taras Sotnikov, taras.sotnikov@gmail.com

View File

@ -756,8 +756,11 @@ LexerFile(lexerFile, lexer, namedActions) ::= <<
<fileHeader(lexerFile.grammarFileName, lexerFile.ANTLRVersion)>
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
<namedActions.header>