#NEWLINE# def _parse_paren( source , info ) : #NEWLINE# #INDENT# if source . match ( '?' ) : #NEWLINE# #INDENT# if source . match ( '<' ) : #NEWLINE# #INDENT# if source . match ( '=' ) : #NEWLINE# #INDENT# return _parse_lookaround ( source , info , behind = True , positive = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if source . match ( '!' ) : #NEWLINE# #INDENT# return _parse_lookaround ( source , info , behind = True , positive = False ) #NEWLINE# #UNINDENT# #UNINDENT# name = _parse_name ( source ) #NEWLINE# group = info . new_group ( name ) #NEWLINE# source . expect ( '>' ) #NEWLINE# saved_flags = info . flags #NEWLINE# saved_ignore = source . ignore_space #NEWLINE# try : #NEWLINE# #INDENT# subpattern = _parse_pattern ( source , info ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# source . ignore_space = saved_ignore #NEWLINE# info . flags = saved_flags #NEWLINE# #UNINDENT# source . expect ( ')' ) #NEWLINE# info . close_group ( group ) #NEWLINE# return Group ( info , group , subpattern ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if source . match ( '=' ) : #NEWLINE# #INDENT# return _parse_lookaround ( source , info , behind = False , positive = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if source . match ( '!' ) : #NEWLINE# #INDENT# return _parse_lookaround ( source , info , behind = False , positive = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if source . match ( '#' ) : #NEWLINE# #INDENT# _parse_comment ( source ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if source . match ( '>' ) : #NEWLINE# #INDENT# return _parse_atomic ( source , info ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if source . match ( ':' ) : #NEWLINE# #INDENT# subpattern = _parse_pattern ( source , info ) #NEWLINE# source . expect ( ')' ) #NEWLINE# return subpattern #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( source . match ( '-' ) or source . match ( 'm' ) or source . match ( 'i' ) or source . match ( 'x' ) ) : #NEWLINE# #INDENT# subpattern = _parse_pattern ( source , info ) #NEWLINE# source . expect ( ')' ) #NEWLINE# return subpattern #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RegexpError ( 'undefined group option' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# group = info . new_group ( ) #NEWLINE# saved_flags = info . flags #NEWLINE# saved_ignore = source . ignore_space #NEWLINE# try : #NEWLINE# #INDENT# subpattern = _parse_pattern ( source , info ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# source . ignore_space = saved_ignore #NEWLINE# info . flags = saved_flags #NEWLINE# #UNINDENT# source . expect ( ')' ) #NEWLINE# info . close_group ( group ) #NEWLINE# return Group ( info , group , subpattern )