← Back
Editing: generator.cpython-311.pyc
� ̑�a�8 � � � d Z ddlmZ ddlmZmZmZmZmZm Z ddl mZmZ ed� � Z G d� dee � � Z G d� d � � Z G d � dee � � Z G d� d � � Zd� Zd� Zd� Zd� Zdedefd�Zd� Zd� Zd� 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 �R � e Zd ZdZdedeeed f deedf fd�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. �start_nonterminal�rule_to_dfaszDFAState[_TokenTypeT]�reserved_syntax_strings�ReservedStringc �0 � || _ || _ || _ d S �N)�nonterminal_to_dfasr r )�selfr r r s �7/usr/lib/python3/dist-packages/parso/pgen2/generator.py�__init__zGrammar.__init__/ s"