Your IP : 18.117.11.13
3
���]� � @ s� d Z dZdZdZddlZddlmZ ddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZ yddlmZ W n ek
r� ddlmZ Y nX ydd l
mZ W n> ek
r� ydd lmZ W n ek
r� dZY nX Y nX d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrgiZee j�dds� Zed dskZe�r"e jZe Z!e"Z#e Z$e%e&e'e(e)ee*e+e,e-e.gZ/nbe j0Ze1Z2dtdu� Z$g Z/ddl3Z3xBdvj4� D ]6Z5ye/j6e7e3e5�� W n e8k
�r| �wJY nX �qJW e9dwdx� e2dy�D ��Z:dzd{� Z;G d|d}� d}e<�Z=ej>ej? Z@d~ZAeAd ZBe@eA ZCe"d��ZDd�jEd�dx� ejFD ��ZGG d�d!� d!eH�ZIG d�d#� d#eI�ZJG d�d%� d%eI�ZKG d�d'� d'eK�ZLG d�d*� d*eH�ZMG d�d�� d�e<�ZNG d�d&� d&e<�ZOe
jPjQeO� d�d=� ZRd�dN� ZSd�dK� ZTd�d�� ZUd�d�� ZVd�d�� ZWd�dU� ZX�d/d�d��ZYG d�d(� d(e<�ZZG d�d0� d0eZ�Z[G d�d� de[�Z\G d�d� de[�Z]G d�d� de[�Z^e^Z_e^eZ_`G d�d� de[�ZaG d�d� de^�ZbG d�d� dea�ZcG d�dp� dpe[�ZdG d�d3� d3e[�ZeG d�d+� d+e[�ZfG d�d)� d)e[�ZgG d�d
� d
e[�ZhG d�d2� d2e[�ZiG d�d�� d�e[�ZjG d�d� dej�ZkG d�d� dej�ZlG d�d� dej�ZmG d�d.� d.ej�ZnG d�d-� d-ej�ZoG d�d5� d5ej�ZpG d�d4� d4ej�ZqG d�d$� d$eZ�ZrG d�d
� d
er�ZsG d�d � d er�ZtG d�d� der�ZuG d�d� der�ZvG d�d"� d"eZ�ZwG d�d� dew�ZxG d�d� dew�ZyG d�d�� d�ew�ZzG d�d� dez�Z{G d�d6� d6ez�Z|G d�d�� d�e<�Z}e}� Z~G d�d� dew�ZG d�d,� d,ew�Z�G d�d� dew�Z�G d�d�� d�e��Z�G d�d1� d1ew�Z�G d�d� de��Z�G d�d� de��Z�G d�d� de��Z�G d�d/� d/e��Z�G d�d� de<�Z�d�df� Z��d0d�dD�Z��d1d�d@�Z�d�d΄ Z�d�dS� Z�d�dR� Z�d�d҄ Z��d2d�dW�Z�d�dE� Z��d3d�dk�Z�d�dl� Z�d�dn� Z�e\� j�dG�Z�el� j�dM�Z�em� j�dL�Z�en� j�de�Z�eo� j�dd�Z�eeeDd�d�dڍj�d�d܄ �Z�efd݃j�d�d܄ �Z�efd߃j�d�d܄ �Z�e�e�B e�B eeeGd�dyd�B efd�ej��B Z�e�e�e�d� e� �Z�e^d�ed�j�d� e�e{e�e�B ��j�d� d� Z�d�dc� Z�d�dQ� Z�d�d`� Z�d�d^� Z�d�dq� Z�e�d�d܄ �Z�e�d�d܄ �Z�d�d� Z�d�dO� Z�d�dP� Z�d�di� Z�e<� e�_��d4d�do�Z�e=� Z�e<� e�_�e<� e�_�e�d��e�d��fd�dm�Z�e�Z�e�efd��d� �j�d��Z�e�efd��d� �j�d��Z�e�efd��d� efd��d� B �j��d �Z�e�e_�d�e�j� �j��d�Z�d�d�de�j� f�ddT�Z��d5�ddj�Z�e��d�Z�e��d�Z�e�eee@eC�d �j��d��\Z�Z�e�e��d j4� �d
��Z�ef�d�djEe�jà � �d
�j��d�ZĐdd_� Z�e�ef�d��d �j��d�Z�ef�d�j��d�Z�ef�d�jȃ j��d�Z�ef�d�j��d�Z�e�ef�d��d e�B �j��d�Z�e�Z�ef�d�j��d�Z�e�e{eeeGdɐd�eee�d�e^dɃ em� � ��j j��d�Z�e�ee�j� e�B d��d��j�d>�Z�G �d dr� dr�Z�eҐd!k�r�eb�d"�Z�eb�d#�Z�eee@eC�d$ �Z�e�eՐd%dӐd&�j�e��Z�e�e�eփ�j��d'�Zאd(e�B Z�e�eՐd%dӐd&�j�e��Z�e�e�eك�j��d)�Z�eӐd*�eؐd'� e� eڐd)� Z�e�jܐd+� e�j�jܐd,� e�j�jܐd,� e�j�jܐd-� ddl�Z�e�j�j�e�e�j�� e�j�jܐd.� dS (6 aS
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
z2.1.10z07 Oct 2016 01:31 UTCz*Paul McGuire <ptmcg@users.sourceforge.net>� N)�ref)�datetime)�RLock)�OrderedDict�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 C s` t | t�r| S yt| �S tk
rZ t| �jtj� d�}td�}|jdd� � |j |�S X dS )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 S s$ dt t| d dd� ��dd � S )Nz\ur � � ���)�hex�int)�t� rw �/usr/lib/python3.6/pyparsing.py�<lambda>� s z_ustr.<locals>.<lambda>N)
�
isinstanceZunicode�str�UnicodeEncodeError�encode�sys�getdefaultencodingr'