File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Tools/peg_generator/pegen Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 11
11
import token
12
12
import traceback
13
13
14
- from typing import Final
15
-
16
- from pegen .build import build_parser_and_generator
17
- from pegen .testutil import print_memstats
18
-
19
14
20
15
argparser = argparse .ArgumentParser (
21
16
prog = "pegen" , description = "Experimental PEG-like parser generator"
52
47
53
48
54
49
def main () -> None :
50
+ from pegen .build import build_parser_and_generator
51
+ from pegen .testutil import print_memstats
52
+
55
53
args = argparser .parse_args ()
56
54
verbose = args .verbose
57
55
verbose_tokenizer = verbose >= 3
@@ -133,4 +131,7 @@ def main() -> None:
133
131
134
132
135
133
if __name__ == "__main__" :
134
+ if sys .version_info < (3 , 8 ):
135
+ print ("ERROR: using pegen requires at least Python 3.8!" , file = sys .stderr )
136
+ sys .exit (1 )
136
137
main ()
Original file line number Diff line number Diff line change 6
6
7
7
from typing import Optional , Tuple
8
8
9
- import distutils .log
10
- from distutils .core import Distribution , Extension
11
- from distutils .command .clean import clean # type: ignore
12
- from distutils .command .build_ext import build_ext # type: ignore
13
- from distutils .tests .support import fixup_build_ext
14
-
15
9
from pegen .c_generator import CParserGenerator
16
10
from pegen .grammar import Grammar
17
11
from pegen .grammar_parser import GeneratedParser as GrammarParser
@@ -47,6 +41,12 @@ def compile_c_extension(
47
41
If *build_dir* is provided, that path will be used as the temporary build directory
48
42
of distutils (this is useful in case you want to use a temporary directory).
49
43
"""
44
+ import distutils .log
45
+ from distutils .core import Distribution , Extension
46
+ from distutils .command .clean import clean # type: ignore
47
+ from distutils .command .build_ext import build_ext # type: ignore
48
+ from distutils .tests .support import fixup_build_ext
49
+
50
50
if verbose :
51
51
distutils .log .set_verbosity (distutils .log .DEBUG )
52
52
You can’t perform that action at this time.
0 commit comments