JezK
Edit File: pyparsing.cpython-311.pyc
� ��fw� � � � d Z dZdZdZddlZddlmZ ddlZddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlmZ ddlmZ n# e$ r ddlmZ Y nw xY w dd lmZ dd lmZ n# e$ r dd l mZ dd l mZ Y nw xY w ddl mZ n # e$ r ddlmZ n # e$ r dZY nw xY wY nw xY wg d�Z ee j � � dd � Zed d k Z e re j! Z"e#Z$e%Z&e#Z'e(e)e*e+e,ee-e.e/e0e1gZ2nTe j3 Z"e4Z5d� Z'g Z2ddl6Z6d�7 � � D ]-Z8 e2�9 e:e6e8� � � � �## e;$ r Y �*w xY w e<d� e5d� � D � � � � Z=d� Z> G d� de?� � Z@ejA ejB z ZCdZDeDdz ZEeCeDz ZF e%d� � ZGd�H d� ejI D � � � � ZJ G d� deK� � ZL G d� deL� � ZM G d� deL� � ZN G d � d!eN� � ZO G d"� d#eK� � ZP G d$� d%e?� � ZQ G d&� d'e?� � ZR ejS eR� � d(� ZTd)� ZUd*� ZVd+� ZWd,� ZXd-� ZYd.� ZZ d�d0�Z[ G d1� d2e?� � Z\ G d3� d4e\� � Z] G d5� d6e]� � Z^ G d7� d8e]� � Z_ G d9� d:e]� � Z`e`Zae`e\_b G d;� d<e]� � Zc G d=� d>e`� � Zd G d?� d@ec� � Ze G dA� dBe]� � Zf G dC� dDe]� � Zg G dE� dFe]� � Zh G dG� dHe]� � Zi G dI� dJe]� � Zj G dK� dLe]� � Zk G dM� dNe]� � Zl G dO� dPel� � Zm G dQ� dRel� � Zn G dS� dTel� � Zo G dU� dVel� � Zp G dW� dXel� � Zq G dY� dZel� � Zr G d[� d\el� � Zs G d]� d^e\� � Zt G d_� d`et� � Zu G da� dbet� � Zv G dc� ddet� � Zw G de� dfet� � Zx G dg� dhe\� � Zy G di� djey� � Zz G dk� dley� � Z{ G dm� dney� � Z| G do� dpe|� � Z} G dq� dre|� � Z~ G ds� dte?� � Z e� � Z� G du� dvey� � Z� G dw� dxey� � Z� G dy� dzey� � Z� G d{� d|e�� � Z� G d}� d~ey� � Z� G d� d�e�� � Z� G d�� d�e�� � Z� G d�� d�e�� � Z� G d�� d�e�� � Z� G d�� d�e?� � Z�d�� Z�d�d��Z�d�d��Z�d�� Z�d�� Z�d�� Z�d�� Z�d�d��Z�d�� Z�d�d��Z�d�� Z�d�� Z� e^� � �� d�� � Z� en� � �� d�� � Z� eo� � �� d�� � Z� ep� � �� d�� � Z� eq� � �� d�� � Z� egeGd�d/��� � �� d�� � � Z� ehd�� � �� d�� � � Z� ehd�� � �� d�� � � Z�e�e�z e�z ejd�d��� � z Z� e�e� e�d�� � z e�z � � Z� e`d�� � e�d�� � �� d�� � z e� e}e�e�z � � � � �� d�� � z d�z Z�d�� Z�d�� Z�d�� Z�d�� Z�d�� Z� e�d�� � � Z� e�d�� � � Z� d�� Z�d�� Z�d�� Z�d�� Z� e?� � e�_� d�d��Z� e@� � Z� e?� � e�_� e?� � e�_� e�d�� � e�d�� � fd��Z�e�Z� e� ehd�� � d�z � � �� d�� � Z� e� ehd�� � d�z � � �� d�� � Z� e� ehd�� � d�z ehd�� � d�z z � � �� d�� � Z� e� ead�� � e�� � � z � � �� d¦ � Z�d�d�de�� � � fdÄZ�d�dĄZ� e�dŦ � Z� e�dƦ � Z� e� egeCeFd�z � � �� dȦ � � � \ Z�Z� e� e�dɠ7 � � dʦ � � � Z� ehd�d̠H eà� � � � � z d�z � � �� dΦ � Z�dτ Z� e� ehdЦ � d�z � � �� dҦ � Z� ehdӦ � �� dԦ � Z� ehdզ � �� � � �� d֦ � Z� ehdצ � �� dئ � Z� e� ehdЦ � d�z e�z � � �� d٦ � Z� e�Z� ehdڦ � �� dۦ � Z� e� e} egeJd��ܦ � e� egdݦ � e`d�� � z eo� � z � � z � � � � �� � � �� dަ � Z� e� e�e�� � � e�z d�ߦ � � � �� d� � Z� G d� d� � Z�e�d�k �r� edd� � Z� edd� � Z� egeCeFd�z � � Z� e�e�d�d��� � �� e�� � Z� e� e�eצ � � � �� d� � Z�d�e�z Z� e�e�d�d��� � �� e�� � Z� e� e�eڦ � � � �� d� � Z� e�d� � e�d� � z e�z e�d� � z Z�eܠ� d� � e�j� �� d� � e�j� �� d� � e�j� �� d� � ddl�Z�e�j� �� e�e�j� � � � � e�j� �� d� � dS dS )�a� pyparsing module - Classes and methods to define and execute parsing grammars ============================================================================= The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions. With pyparsing, you don't need to learn a new syntax for defining grammars or matching expressions - the parsing module provides a library of classes that you use to construct the grammar directly in Python. Here is a program to parse "Hello, World!" (or any greeting of the form C{"<salutation>, <addressee>!"}), built up using L{Word}, L{Literal}, and L{And} elements (L{'+'<ParserElement.__add__>} operator gives L{And} expressions, strings are auto-converted to L{Literal} expressions):: from pyparsing import Word, alphas # define grammar of a greeting greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" print (hello, "->", greet.parseString(hello)) The program outputs the following:: Hello, World! -> ['Hello', ',', 'World', '!'] The Python representation of the grammar is quite readable, owing to the self-explanatory class names, and the use of '+', '|' and '^' operators. The L{ParseResults} object returned from L{ParserElement.parseString<ParserElement.parseString>} can be accessed as a nested list, a dictionary, or an object with named attributes. The pyparsing module handles some of the problems that are typically vexing when writing text parsers: - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello , World !", etc.) - quoted strings - embedded comments Getting Started - ----------------- Visit the classes L{ParserElement} and L{ParseResults} to see the base classes that most other pyparsing classes inherit from. Use the docstrings for examples of how to: - construct literal match expressions from L{Literal} and L{CaselessLiteral} classes - construct character word-group expressions using the L{Word} class - see how to create repetitive expressions using L{ZeroOrMore} and L{OneOrMore} classes - use L{'+'<And>}, L{'|'<MatchFirst>}, L{'^'<Or>}, and L{'&'<Each>} operators to combine simple expressions into more complex ones - associate names with your parsed results using L{ParserElement.setResultsName} - find some helpful expression short-cuts like L{delimitedList} and L{oneOf} - find more useful common expressions in the L{pyparsing_common} namespace class z2.2.1z18 Sep 2018 00:49 UTCz*Paul McGuire <ptmcg@users.sourceforge.net>� N)�ref)�datetime)�RLock)�Iterable)�MutableMapping)�OrderedDict)i�And�CaselessKeyword�CaselessLiteral� CharsNotIn�Combine�Dict�Each�Empty� FollowedBy�Forward� GoToColumn�Group�Keyword�LineEnd� LineStart�Literal� MatchFirst�NoMatch�NotAny� OneOrMore�OnlyOnce�Optional�Or�ParseBaseException�ParseElementEnhance�ParseException�ParseExpression�ParseFatalException�ParseResults�ParseSyntaxException� ParserElement�QuotedString�RecursiveGrammarException�Regex�SkipTo� StringEnd�StringStart�Suppress�Token�TokenConverter�White�Word�WordEnd� WordStart� ZeroOrMore� alphanums�alphas� alphas8bit�anyCloseTag� anyOpenTag� cStyleComment�col�commaSeparatedList�commonHTMLEntity�countedArray�cppStyleComment�dblQuotedString�dblSlashComment� delimitedList�dictOf�downcaseTokens�empty�hexnums�htmlComment�javaStyleComment�line�lineEnd� lineStart�lineno�makeHTMLTags�makeXMLTags�matchOnlyAtCol�matchPreviousExpr�matchPreviousLiteral� nestedExpr�nullDebugAction�nums�oneOf�opAssoc�operatorPrecedence� printables�punc8bit�pythonStyleComment�quotedString�removeQuotes�replaceHTMLEntity�replaceWith� restOfLine�sglQuotedString�srange� stringEnd�stringStart�traceParseAction� unicodeString�upcaseTokens� withAttribute� indentedBlock�originalTextFor�ungroup� infixNotation�locatedExpr� withClass� CloseMatch�tokenMap�pyparsing_common� c �L � t | t � � r| S t | � � S # t $ rq t | � � � t j � � d� � }t d� � }|� d� � � |� |� � cY S w xY w)a Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. �xmlcharrefreplacez&#\d+;c �l � dt t | d dd� � � � � dd � z S )Nz\ur � ���)�hex�int��ts �O/opt/alt/python311/lib/python3.11/site-packages/setuptools/_vendor/pyparsing.py�<lambda>z_ustr.<locals>.<lambda>� s. � ���C��!��Q�r�T� �O�O�8L�8L�Q�R�R�8P�0P� � ) � isinstance�unicode�str�UnicodeEncodeError�encode�sys�getdefaultencodingr* �setParseAction�transformString)�obj�ret� xmlcharrefs r| �_ustrr� � s� � � �c�'�"�"� ��J� 3� �s�8�8�O��!� 3� 3� 3��#�,�,�%�%�c�&<�&>�&>�@S�T�T�C��y�)�)�J��%�%�&P�&P�Q�Q�Q��-�-�c�2�2�2�2�2� 3���s �( �A8B#�"B#z6sum len sorted reversed list tuple set any all min maxc # � K � | ]}|V � �d S �N� )�.0�ys r| � <genexpr>r� � s"