Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
#----------------------------------------------------------------- |
| 2 |
# pycparser: _build_tables.py |
| 3 |
# |
| 4 |
# A dummy for generating the lexing/parsing tables and and |
| 5 |
# compiling them into .pyc for faster execution in optimized mode. |
| 6 |
# Also generates AST code from the configuration file. |
| 7 |
# Should be called from the pycparser directory. |
| 8 |
# |
| 9 |
# Eli Bendersky [https://eli.thegreenplace.net/] |
| 10 |
# License: BSD |
| 11 |
#----------------------------------------------------------------- |
| 12 |
|
| 13 |
# Insert '.' and '..' as first entries to the search path for modules. |
| 14 |
# Restricted environments like embeddable python do not include the |
| 15 |
# current working directory on startup. |
| 16 |
import importlib |
| 17 |
import sys |
| 18 |
sys.path[0:0] = ['.', '..'] |
| 19 |
|
| 20 |
# Generate c_ast.py |
| 21 |
from _ast_gen import ASTCodeGenerator |
| 22 |
ast_gen = ASTCodeGenerator('_c_ast.cfg') |
| 23 |
ast_gen.generate(open('c_ast.py', 'w')) |
| 24 |
|
| 25 |
from pycparser import c_parser |
| 26 |
|
| 27 |
# Generates the tables |
| 28 |
# |
| 29 |
c_parser.CParser( |
| 30 |
lex_optimize=True, |
| 31 |
yacc_debug=False, |
| 32 |
yacc_optimize=True) |
| 33 |
|
| 34 |
# Load to compile into .pyc |
| 35 |
# |
| 36 |
importlib.invalidate_caches() |
| 37 |
|
| 38 |
import lextab |
| 39 |
import yacctab |
| 40 |
import c_ast |