관리-도구
편집 파일: driver.cpython-34.pyc
� j f! � @ s� d Z d Z d d g Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z Gd d � d e � Z d d d d d d d � Z d d � Z d d � Z e d k r� e j e e � � � n d S)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum <guido@python.org>�Driver�load_grammar� N� )�grammar�parse�token�tokenize�pgenc @ sp e Z d Z d d d d � Z d d d � Z d d d � Z d d d � Z d d d d � Z d d d � Z d S)r Nc C s: | | _ | d k r$ t j � } n | | _ | | _ d S)N)r �logging� getLogger�logger�convert)�selfr r r � r �9/opt/alt/python34/lib64/python3.4/lib2to3/pgen2/driver.py�__init__ s zDriver.__init__Fc C s@ t j | j | j � } | j � d } d } d } } } } } d } x�| D]�} | \ } } } } } | | | f k r | | f | k s� t | | f | f � � | \ } } | | k r� | d | | 7} | } d } n | | k r | | | | � 7} | } q n | t j t j f k rc| | 7} | \ } } | j d � rQ | d 7} d } qQ qQ n | t j k r�t j | } n | r�| j j d t j | | | � n | j | | | | f � r�| r�| j j d � n Pn d } | \ } } | j d � rQ | d 7} d } qQ qQ Wt j d | | | | f � � | j S) z4Parse a series of tokens and return the syntax tree.r r N� � z%s %r (prefix=%r)zStop.zincomplete input)r ZParserr r Zsetup�AssertionErrorr �COMMENT�NL�endswithr �OPZopmapr �debug�tok_nameZaddtokenZ ParseErrorZrootnode)r �tokensr �p�lineno�column�type�value�start�endZ line_text�prefixZ quintupleZs_linenoZs_columnr r r �parse_tokens&