#NEWLINE# def __init__( self , flag_token , error_handler = None ) : #NEWLINE# #INDENT# 'Creates the DocFlag object and attaches it to the given start token.\n\n    Args:\n      flag_token: The starting token of the flag.\n      error_handler: An optional error handler for errors occurring while\n        parsing the doctype.\n    ' #NEWLINE# self . flag_token = flag_token #NEWLINE# self . flag_type = flag_token . string . strip ( ) . lstrip ( '@' ) #NEWLINE# self . type = None #NEWLINE# self . jstype = None #NEWLINE# self . type_start_token = None #NEWLINE# self . type_end_token = None #NEWLINE# if ( self . flag_type in self . HAS_TYPE ) : #NEWLINE# #INDENT# brace = tokenutil . SearchUntil ( flag_token , [ Type . DOC_START_BRACE ] , Type . FLAG_ENDING_TYPES ) #NEWLINE# if brace : #NEWLINE# #INDENT# ( end_token , contents ) = _GetMatchingEndBraceAndContents ( brace ) #NEWLINE# self . type = contents #NEWLINE# self . jstype = typeannotation . Parse ( brace , end_token , error_handler ) #NEWLINE# self . type_start_token = brace #NEWLINE# self . type_end_token = end_token #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( self . flag_type in self . TYPE_ONLY ) and ( flag_token . next . type not in Type . FLAG_ENDING_TYPES ) and ( flag_token . line_number == flag_token . next . line_number ) ) : #NEWLINE# #INDENT# self . type_start_token = flag_token . next #NEWLINE# ( self . type_end_token , self . type ) = _GetEndTokenAndContents ( self . type_start_token ) #NEWLINE# if ( self . type is not None ) : #NEWLINE# #INDENT# self . type = self . type . strip ( ) #NEWLINE# self . jstype = typeannotation . Parse ( flag_token , self . type_end_token , error_handler ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . name_token = None #NEWLINE# self . name = None #NEWLINE# if ( self . flag_type in self . HAS_NAME ) : #NEWLINE# #INDENT# self . name_token = _GetNextPartialIdentifierToken ( flag_token ) #NEWLINE# if ( self . type and self . name_token and ( tokenutil . Compare ( self . name_token , self . type_start_token ) > 0 ) ) : #NEWLINE# #INDENT# self . name_token = _GetNextPartialIdentifierToken ( self . type_end_token ) #NEWLINE# #UNINDENT# if search_start_token . name_token : #NEWLINE# #INDENT# self . name = self . name_token . string #NEWLINE# #UNINDENT# #UNINDENT# self . description_start_token = None #NEWLINE# self . description_end_token = None #NEWLINE# self . description = None #NEWLINE# if ( self . flag_type in self . HAS_DESCRIPTION ) : #NEWLINE# #INDENT# search_start_token = flag_token #NEWLINE# if ( self . name_token and self . type_end_token ) : #NEWLINE# #INDENT# if ( tokenutil . Compare ( self . type_end_token , self . name_token ) > 0 ) : #NEWLINE# #INDENT# search_start_token = self . type_end_token #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# search_start_token = self . name_token #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if self . name_token : #NEWLINE# #INDENT# search_start_token = self . name_token #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . type : #NEWLINE# #INDENT# search_start_token = self . type_end_token #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# interesting_token = tokenutil . Search ( search_start_token , ( Type . FLAG_DESCRIPTION_TYPES | Type . FLAG_ENDING_TYPES ) ) #NEWLINE# if ( interesting_token . type in Type . FLAG_DESCRIPTION_TYPES ) : #NEWLINE# #INDENT# self . description_start_token = interesting_token #NEWLINE# ( self . description_end_token , self . description ) = _GetEndTokenAndContents ( interesting_token )