Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/parso/pgen2/__pycache__/generator.cpython-39.pyc
Ðазад
a e�h�8 � @ s� d Z ddlmZ ddlmZmZmZmZmZm Z ddl mZmZ ed�Z G dd� dee �ZG dd � d �ZG d d� dee �ZG dd � d �Zdd� Zdd� Zdd� Zdd� Zeed�dd�Zdd� Zdd� Zdd� ZdS ) a� This module defines the data structures used to represent a grammar. Specifying grammars in pgen is possible with this grammar:: grammar: (NEWLINE | rule)* ENDMARKER rule: NAME ':' rhs NEWLINE rhs: items ('|' items)* items: item+ item: '[' rhs ']' | atom ['+' | '*'] atom: '(' rhs ')' | NAME | STRING This grammar is self-referencing. This parser generator (pgen2) was created by Guido Rossum and used for lib2to3. Most of the code has been refactored to make it more Pythonic. Since this was a "copy" of the CPython Parser parser "pgen", there was some work needed to make it more readable. It should also be slightly faster than the original pgen2, because we made some optimizations. � )�literal_eval)�TypeVar�Generic�Mapping�Sequence�Set�Union)� GrammarParser�NFAState�_TokenTypeTc @ s6 e Zd ZdZeeeed f eedf d�dd�ZdS )�Grammara Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The only important part in this parsers are dfas and transitions between dfas. zDFAState[_TokenTypeT]�ReservedString)�start_nonterminal�rule_to_dfas�reserved_syntax_stringsc C s || _ || _|| _d S �N)�nonterminal_to_dfasr r )�selfr r r � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/parso/pgen2/generator.py�__init__/ s zGrammar.__init__N)�__name__� __module__�__qualname__�__doc__�strr r r r r r r r % s �r c @ s0 e Zd ZdZg fded d�dd�Zdd� ZdS ) �DFAPlanzj Plans are used for the parser to create stack nodes and do the proper DFA state transitions. �DFAState��next_dfa� dfa_pushesc C s || _ || _d S r r )r r r r r r r = s zDFAPlan.__init__c C s d| j j| j| jf S )Nz %s(%s, %s))� __class__r r r �r r r r �__repr__A s zDFAPlan.__repr__N)r r r r r r r# r r r r r 8 s r c @ sF e Zd ZdZeee ed�dd�Zdd� Zdd� Z d d � Z dd� Zd S )r aa The DFAState object is the core class for pretty much anything. DFAState are the vertices of an ordered graph while arcs and transitions are the edges. Arcs are the initial edges, where most DFAStates are not connected and transitions are then calculated to connect the DFA state machines that have different nonterminals. )� from_rule�nfa_set�finalc C s^ t |t�sJ �t tt|��t�s$J �t |t�s2J �|| _|| _i | _i | _i | _ ||v | _ d S r )� isinstance�set�next�iterr r$ r% �arcs�nonterminal_arcs�transitions�is_final)r r$ r% r&