From 5ec39c2a65040ea3699a27b7a78ba42f62fd431e Mon Sep 17 00:00:00 2001 From: HackerJang Date: Sun, 11 Oct 2020 10:59:35 +0900 Subject: [PATCH] Changed Python runtime Lexer.py, Parser.py to support version > 5 --- contributors.txt | 3 ++- runtime/Python3/src/antlr4/Lexer.py | 6 +++++- runtime/Python3/src/antlr4/Parser.py | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/contributors.txt b/contributors.txt index 28cae0d72..5ab4e5909 100644 --- a/contributors.txt +++ b/contributors.txt @@ -262,4 +262,5 @@ YYYY/MM/DD, github id, Full name, email 2020/09/12, Clcanny, Charles Ruan, a837940593@gmail.com 2020/09/15, rmcgregor1990, Robert McGregor, rmcgregor1990@gmail.com 2020/09/16, trenki2, Markus Trenkwalder, trenki2[at]gmx[dot]net -2020/10/08, Marti2203, Martin Mirchev, mirchevmartin2203@gmail.com \ No newline at end of file +2020/10/08, Marti2203, Martin Mirchev, mirchevmartin2203@gmail.com +2020/10/11, cliid, Jiwu Jang, jiwujang@naver.com \ No newline at end of file diff --git a/runtime/Python3/src/antlr4/Lexer.py b/runtime/Python3/src/antlr4/Lexer.py index a60b5bcc9..0a96b70af 100644 --- a/runtime/Python3/src/antlr4/Lexer.py +++ b/runtime/Python3/src/antlr4/Lexer.py @@ -9,8 +9,12 @@ # of speed. #/ 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 from antlr4.CommonTokenFactory import CommonTokenFactory from antlr4.atn.LexerATNSimulator import LexerATNSimulator from antlr4.InputStream import InputStream diff --git a/runtime/Python3/src/antlr4/Parser.py b/runtime/Python3/src/antlr4/Parser.py index c461bbdc0..11bf41796 100644 --- a/runtime/Python3/src/antlr4/Parser.py +++ b/runtime/Python3/src/antlr4/Parser.py @@ -3,7 +3,10 @@ # Use of this file is governed by the BSD 3-clause license that # can be found in the LICENSE.txt file in the project root. import sys -from typing.io import TextIO +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO from antlr4.BufferedTokenStream import TokenStream from antlr4.CommonTokenFactory import TokenFactory from antlr4.error.ErrorStrategy import DefaultErrorStrategy