B f,3 @ s d Z ddlZddlZddlZddlmZ ddlmZ dddgZG dd dZ dddZ edejj Zd d Zdd Zedkreejdkree n,ejd ZeeZee ee W dQ R X dS )z8A lexical analyzer class for simple shell-like syntaxes. N)deque)StringIOshlexsplitquotec @ sr e Zd ZdZdddZedd Zdd Zdd dZdd Z dd Z dd Zdd ZdddZ dd Zdd ZdS )r z8A lexical analyzer class for simple shell-like syntaxes.NFc C s t |trt|}|d k r(|| _|| _ntj| _d | _|| _|rHd | _nd| _d| _ d| _ | jrn| j d7 _ d| _d| _d| _ d| _d | _d | _t | _d| _d| _d| _t | _d | _|sd}n|d krd}|| _|rt | _| j d7 _ | j t|}| j || _ d S )N #Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u| ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz Fz'"\" r Tz();<>|&z~-./*?=) isinstancestrr instreaminfilesysstdinposixeof commenters wordchars whitespacewhitespace_splitquotesescape escapedquotesstater pushbacklinenodebugtoken filestacksource_punctuation_chars_pushback_chars maketransdictfromkeys translate)selfr r r punctuation_charst r, */opt/alt/python37/lib64/python3.7/shlex.py__init__ sJ zshlex.__init__c C s | j S )N)r# )r) r, r, r- r* D s zshlex.punctuation_charsc C s* | j dkrtdt| | j| dS )z:Push a token onto the stack popped by the get_token methodr zshlex: pushing token N)r printreprr appendleft)r) tokr, r, r- push_tokenH s zshlex.push_tokenc C sp t |trt|}| j| j| j| jf || _|| _d| _| jrl|dk r\t d| jf nt d| jf 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! r1 r r r r r/ )r) newstreamnewfiler, r, r- push_sourceN s zshlex.push_sourcec C sD | j | j \| _| _ | _| jr:td| j | jf d| _dS )zPop the input source stack.zshlex: popping to %s, line %dr N) r closer! popleftr r r r/ r )r) r, r, r- pop_source\ s zshlex.pop_sourcec C s | j r.| j }| jdkr*tdt| |S | }| jdk r~x<|| jkr|| | }|rr|\}}| || | }qBW x*|| j kr| js| j S | | }qW | jdkr|| j krtdt| ntd |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 r8 r r/ r0 read_tokenr" sourcehookr6 get_tokenr r! r9 )r) r2 rawspecr5 r4 r, r, r- r<