File: //lib/python2.7/site-packages/awscli/shorthand.pyc
�
R$�_c @ s� d Z d d l Z d d l Z e � Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d
� � YZ d e f d � � YZ
d
e f d � � YZ d e f d � � YZ d S( s� Module for parsing shorthand syntax.
This module parses any CLI options that use a "shorthand"
syntax::
--foo A=b,C=d
|------|
|
Shorthand syntax
This module provides two main classes to do this.
First, there's a ``ShorthandParser`` class. This class works
on a purely syntactic level. It looks only at the string value
provided to it in order to figure out how the string should be parsed.
However, because there was a pre-existing shorthand parser, we need
to remain backwards compatible with the previous parser. One of the
things the previous parser did was use the associated JSON model to
control how the expression was parsed.
In order to accommodate this a post processing class is provided that
takes the parsed values from the ``ShorthandParser`` as well as the
corresponding JSON model for the CLI argument and makes any adjustments
necessary to maintain backwards compatibility. This is done in the
``BackCompatVisitor`` class.
i����Nt _NamedRegexc B s e Z d � Z d � Z RS( c C s% | | _ t j | t j � | _ d S( N( t namet ret compilet UNICODEt regex( t selfR t regex_str( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyt __init__1 s c C s | j j | � S( N( R t match( R t value( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR 5 s ( t __name__t
__module__R R ( ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR 0 s t ShorthandParseErrorc B s e Z d � Z RS( c C s� | j d | j } } } d | j | j k r] | j | j j d � } | j | d } n d | j | j k r� | j | j | j j d � } | j | } | j | } n d | d | d | f S( Nt s
i s %s
%s%st t ^( R
t indext rindex( R t consumedt remainingt
num_spacest last_newlinet next_newline( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyt _error_location; s
( R R R ( ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR
9 s t ShorthandParseSyntaxErrorc B s e Z d � Z d � Z RS( c C sJ | | _ | | _ | | _ | | _ | j � } t t | � j | � d S( N( R
t expectedt actualR t _construct_msgt superR R ( R R
R R R t msg( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR S s c C s# d | j | j | j � f } | S( Ns, Expected: '%s', received: '%s' for input:
%s( R R R ( R R ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR [ s ( R R R R ( ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR R s t DuplicateKeyInObjectErrorc B s e Z d � Z d � Z RS( c C sA | | _ | | _ | | _ | j � } t t | � j | � d S( N( t keyR
R R R R R ( R R R
R R ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR d s
c C s d | j | j � f } | S( Nsy Second instance of key "%s" encountered for input:
%s
This is often because there is a preceeding "," instead of a space.( R R ( R R ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR k s ( R R R R ( ( ( s4 /usr/lib/python2.7/site-packages/awscli/shorthand.pyR c s t ShorthandParserc B sg e Z d Z e d d � Z e d d � Z d Z d Z d Z d Z e d d
j
d e d e d
e � � Z e d d
j
d e d e d
e � � Z d � Z
d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d&