관리-도구
편집 파일: shlex.cpython-310.pyc
o 6��f�4 � @ s� d Z ddlZddlZddlZddlmZ ddlmZ g d�ZG dd� d�Z dd d�Z dd � Ze�dej �jZdd� Zdd� Zedkrseej�dkrPee � � dS ejd Zee��Zee ee�� W d � dS 1 slw Y dS dS )�8A lexical analyzer class for simple shell-like syntaxes.� N)�deque)�StringIO)�shlex�split�quote�joinc @ sv e Zd ZdZ ddd�Zedd� �Zdd � Zdd d�Zdd � Z dd� Z dd� Zdd� Zddd�Z dd� Zdd� ZdS )r r NFc C s t |t�r t|�}|d ur|| _|| _ntj| _d | _|| _|r$d | _nd| _d| _ d| _ | jr7| j d7 _ d| _d| _d| _ d| _d | _d | _t� | _d| _d| _d| _t� | _d | _|sbd}n|d u rhd}|| _|r�t� | _| j d7 _ | j �t�|��}| j �|�| _ d S d S )N� �#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u| ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz Fz'"�\�"� � r Tz();<>|&z~-./*?=)� isinstance�strr �instream�infile�sys�stdin�posix�eof� commenters� wordchars� whitespace�whitespace_split�quotes�escape� escapedquotes�stater �pushback�lineno�debug�token� filestack�source�_punctuation_chars�_pushback_chars� maketrans�dict�fromkeys� translate)�selfr r r �punctuation_chars�t� r. �,/opt/alt/python310/lib64/python3.10/shlex.py�__init__ sL �zshlex.__init__c C s | j S �N)r% �r+ r. r. r/ r, D s zshlex.punctuation_charsc C s* | j dkr tdt|� � | j�|� dS )z:Push a token onto the stack popped by the get_token methodr zshlex: pushing token N)r! �print�reprr � appendleft)r+ �tokr. r. r/ � push_tokenH s zshlex.push_tokenc C sv t |t�r t|�}| j�| j| j| jf� || _|| _d| _| jr9|dur/t d| jf � dS t d| jf � dS dS )z9Push an input source onto the lexer's input source stack.r Nzshlex: pushing to file %szshlex: pushing to stream %s) r r r r# r5 r r r r! r3 )r+ � newstream�newfiler. r. r/ �push_sourceN s �zshlex.push_sourcec C sD | j �� | j�� \| _| _ | _| jrtd| j | jf � d| _dS )zPop the input source stack.zshlex: popping to %s, line %dr N) r �closer# �popleftr r r! r3 r r2 r. r. r/ � pop_source\ s � zshlex.pop_sourcec C s� | j r| j �� }| jdkrtdt|� � |S | �� }| jdurA|| jkrA| �| �� �}|r8|\}}| �||� | � � }|| jks%|| j krY| jsL| j S | �� | � � }|| j ksF| jdkrq|| j krmtdt|� � |S td� |S )zBGet a token from the input stream (or from stack if it's nonempty)r zshlex: popping token Nz shlex: token=zshlex: token=EOF) r r<