Server IP : 103.53.40.154 / Your IP : 3.145.97.235 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /srv/../lib64/python3.6/lib2to3/__pycache__/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
3 \� � @ s� d Z dZddlZddlmZmZmZmZmZm Z ddl mZ ddl mZ G dd � d e �Zd d� ZG dd � d e�Zejejejdd�Zdd� Zdd� Zdd� ZdS )z�Pattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum <guido@python.org>� N� )�driver�literals�token�tokenize�parse�grammar)�pytree)�pygramc @ s e Zd ZdS )�PatternSyntaxErrorN)�__name__� __module__�__qualname__� r r �/usr/lib64/python3.6/patcomp.pyr s r c c sP t jt jt jh}tjtj| �j�}x(|D ] }|\}}}}}||kr(|V q(W dS )z6Tokenizes a string suppressing significant whitespace.N) r �NEWLINE�INDENT�DEDENTr �generate_tokens�io�StringIO�readline) �input�skip�tokensZ quintuple�type�value�start�endZ line_textr r r �tokenize_wrapper s r c @ s: e Zd Zd dd�Zddd�Zdd� Zdd d �Zdd� ZdS )�PatternCompilerNc C sZ |dkrt j| _t j| _ntj|�| _t j| j�| _t j| _ t j | _tj| jt d�| _dS )z^Initializer. Takes an optional alternative filename for the pattern grammar. N)Zconvert)r Zpattern_grammarr Zpattern_symbols�symsr Zload_grammarZSymbolsZpython_grammarZ pygrammarZpython_symbols�pysymsZDriver�pattern_convert)�selfZgrammar_filer r r �__init__( s zPatternCompiler.__init__Fc C sn t |�}y| jj||d�}W n0 tjk rL } ztt|���W Y dd}~X nX |r`| j|�|fS | j|�S dS )z=Compiles a pattern string to a nested pytree.*Pattern object.)�debugN)r r Zparse_tokensr Z ParseErrorr �str�compile_node)r$ r r&