def __init__(self, flag_token, error_handler=None):
    self.flag_token = flag_token
    self.flag_type = flag_token.string.strip().lstrip('@')

    # Extract type, if applicable.
    self.type = None
    self.jstype = None
    self.type_start_token = None
    self.type_end_token = None
    if self.flag_type in self.HAS_TYPE:
      brace = tokenutil.SearchUntil(flag_token, [Type.DOC_START_BRACE],
                                    Type.FLAG_ENDING_TYPES)
      if brace:
        end_token, contents = _GetMatchingEndBraceAndContents(brace)
        self.type = contents
        self.jstype = typeannotation.Parse(brace, end_token,
                                           error_handler)
        self.type_start_token = brace
        self.type_end_token = end_token
      elif (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):
        # b/10407058. If the flag is expected to be followed by a type then
        # search for type in same line only. If no token after flag in same
        # line then conclude that no type is specified.
        self.type_start_token = flag_token.next
        self.type_end_token, self.type = _GetEndTokenAndContents(
            self.type_start_token)
        if self.type is not None:
          self.type = self.type.strip()
          self.jstype = typeannotation.Parse(flag_token, self.type_end_token,
                                             error_handler)

    # Extract name, if applicable.
    self.name_token = None
    self.name = None
    if self.flag_type in self.HAS_NAME:
      # Handle bad case, name could be immediately after flag token.
      self.name_token = _GetNextPartialIdentifierToken(flag_token)

      # Handle good case, if found token is after type start, look for
      # a identifier (substring to cover cases like [cnt] b/4197272) after
      # type end, since types contain identifiers.
      if (self.type and self.name_token and
          tokenutil.Compare(self.name_token, self.type_start_token) > 0):
        self.name_token = _GetNextPartialIdentifierToken(self.type_end_token)

      if self.name_token:
        self.name = self.name_token.string

    # Extract description, if applicable.
    self.description_start_token = None
    self.description_end_token = None
    self.description = None
    if self.flag_type in self.HAS_DESCRIPTION:
      search_start_token = flag_token
      if self.name_token and self.type_end_token:
        if tokenutil.Compare(self.type_end_token, self.name_token) > 0:
          search_start_token = self.type_end_token
        else:
          search_start_token = self.name_token
      elif self.name_token:
        search_start_token = self.name_token
      elif self.type:
        search_start_token = self.type_end_token

      interesting_token = tokenutil.Search(search_start_token,
          Type.FLAG_DESCRIPTION_TYPES | Type.FLAG_ENDING_TYPES)
      if interesting_token.type in Type.FLAG_DESCRIPTION_TYPES:
        self.description_start_token = interesting_token
        self.description_end_token, self.description = (
            _GetEndTokenAndContents(interesting_token))
Creates the DocFlag object and attaches it to the given start token.
dataset/ETHPy150Open google/closure-linter/closure_linter/statetracker.py/DocFlag.__init__