src/blib2to3/pygram.py
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # Copyright 2006 Google, Inc. All Rights Reserved.
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # Licensed to PSF under a Contributor Agreement.
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | """Export the Python grammar and symbols."""
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # Python imports
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | import os
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | from typing import Union
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # Local imports
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | from .pgen2 import driver
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | from .pgen2.grammar import Grammar
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # Moved into initialize because mypyc can't handle __file__ (XXX bug)
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # # The grammar file
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # _GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt")
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # _PATTERN_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__),
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | # "PatternGrammar.txt")
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- 03 -- --- --- --- --- --- --- ------- ------- ------- | class Symbols:
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | def __init__(self, grammar: Grammar) -> None:
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | """Initializer.
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 |
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | Creates an attribute for each grammar symbol (nonterminal),
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | whose value is the symbol's type (an int >= 256).
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | """
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | for name, symbol in grammar.symbol2number.items():
0008 0004 0003 0000 0004 0001 0000 03 02 000 000 000 000 000 000 0000.00 0000.00 0000.00 | setattr(self, name, symbol)
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | class _python_symbols(Symbols):
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | and_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | and_test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | annassign: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | arglist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | argument: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | arith_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | asexpr_test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | assert_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | async_funcdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | async_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | atom: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | augassign: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | break_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | case_block: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | classdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | comp_for: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | comp_if: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | comp_iter: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | comp_op: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | comparison: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | compound_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | continue_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | decorated: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | decorator: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | decorators: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | del_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | dictsetmaker: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | dotted_as_name: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | dotted_as_names: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | dotted_name: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | encoding_decl: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | eval_input: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | except_clause: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | expr_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | exprlist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | factor: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | file_input: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | flow_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | for_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | funcdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | global_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | guard: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | if_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | import_as_name: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | import_as_names: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | import_from: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | import_name: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | import_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | lambdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | listmaker: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | match_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | namedexpr_test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | not_test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | old_comp_for: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | old_comp_if: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | old_comp_iter: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | old_lambdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | old_test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | or_test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | parameters: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | paramspec: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | pass_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | pattern: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | patterns: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | power: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | raise_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | return_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | shift_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | simple_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | single_input: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | sliceop: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | small_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | subject_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | star_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | subscript: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | subscriptlist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | suite: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | term: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | test: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | testlist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | testlist1: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | testlist_gexp: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | testlist_safe: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | testlist_star_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | tfpdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | tfplist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | tname: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | tname_star: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | trailer: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | try_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | type_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | typedargslist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | typeparam: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | typeparams: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | typevar: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | typevartuple: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | varargslist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | vfpdef: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | vfplist: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | vname: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | while_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | with_stmt: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | xor_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | yield_arg: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | yield_expr: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | yield_stmt: int
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | class _pattern_symbols(Symbols):
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | Alternative: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | Alternatives: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | Details: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | Matcher: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | NegatedUnit: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | Repeater: int
---- ---- ---- ---- ---- ---- ---- 01 -- --- --- --- --- --- --- ------- ------- ------- | Unit: int
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | python_grammar: Grammar
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | python_grammar_async_keywords: Grammar
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | python_grammar_soft_keywords: Grammar
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | pattern_grammar: Grammar
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | python_symbols: _python_symbols
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- | pattern_symbols: _pattern_symbols
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
---- ---- ---- ---- ---- ---- ---- -- -- --- --- --- --- --- --- ------- ------- ------- |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | def initialize(cache_dir: Union[str, "os.PathLike[str]", None] = None) -> None:
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | global python_grammar
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | global python_grammar_async_keywords
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | global python_grammar_soft_keywords
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | global python_symbols
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | global pattern_grammar
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | global pattern_symbols
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | # The grammar file
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | _GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt")
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | _PATTERN_GRAMMAR_FILE = os.path.join(
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | os.path.dirname(__file__), "PatternGrammar.txt"
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | )
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar = driver.load_packaged_grammar("blib2to3", _GRAMMAR_FILE, cache_dir)
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | assert "print" not in python_grammar.keywords
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | assert "exec" not in python_grammar.keywords
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | soft_keywords = python_grammar.soft_keywords.copy()
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar.soft_keywords.clear()
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_symbols = _python_symbols(python_grammar)
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | # Python 3.0-3.6
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar.version = (3, 0)
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | # Python 3.7+
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar_async_keywords = python_grammar.copy()
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar_async_keywords.async_keywords = True
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar_async_keywords.version = (3, 7)
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | # Python 3.10+
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar_soft_keywords = python_grammar_async_keywords.copy()
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar_soft_keywords.soft_keywords = soft_keywords
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | python_grammar_soft_keywords.version = (3, 10)
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 |
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | pattern_grammar = driver.load_packaged_grammar(
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | "blib2to3", _PATTERN_GRAMMAR_FILE, cache_dir
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | )
0040 0024 0028 0004 0000 0008 0004 -- 01 001 003 002 004 004 006 0012.00 0008.00 0000.67 | pattern_symbols = _pattern_symbols(pattern_grammar)