Your IP : 18.119.135.231
��YfY � @ 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
� Z d d d d
d d d � Z d d � Z d d � Z e d k r� e j e e � � � 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 s7 | | _ | d k r! t j � } | | _ | | _ d S)N)r �logging� getLogger�logger�convert)�selfr r
r � r �9/opt/alt/python35/lib64/python3.5/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 } | | k r| |
| | � 7} | } | t j t j f k rT| | 7} | \ } } | j d � rQ | d 7} d } qQ | t
j k rpt j | } | r�| j
j d t
j | | | � | j | | | | f � r�| r�| j
j d � Pd } | \ } } | j d � rQ | d 7} d } 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&