parameters: (self, token, state_tracker)
docstring: Processes the given token for dependency information.
  
      Args:
        token: The token to process.
        state_tracker: The JavaScript state tracker.
docstring_summary: Processes the given token for dependency information.
docstring_tokens: Processes the given token for dependency information .
function: def ProcessToken(self, token, state_tracker):
      """Processes the given token for dependency information.
  
      Args:
        token: The token to process.
        state_tracker: The JavaScript state tracker.
      """
  
      # Note that this method is in the critical path for the linter and has been
      # optimized for performance in the following ways:
      # - Tokens are checked by type first to minimize the number of function
      #   calls necessary to determine if action needs to be taken for the token.
      # - The most common tokens types are checked for first.
      # - The number of function calls has been minimized (thus the length of this
      #   function.
  
      if token.type == TokenType.IDENTIFIER:
        # TODO(user): Consider saving the whole identifier in metadata.
        whole_identifier_string = self._GetWholeIdentifierString(token)
        if whole_identifier_string is None:
          # We only want to process the identifier one time. If the whole string
          # identifier is None, that means this token was part of a multi-token
          # identifier, but it was not the first token of the identifier.
          return
  
        # In the odd case that a goog.require is encountered inside a function,
        # just ignore it (e.g. dynamic loading in test runners).
        if token.string == 'goog.require' and not state_tracker.InFunction():
          self._require_tokens.append(token)
          namespace = tokenutil.Search(token, TokenType.STRING_TEXT).string
          if namespace in self._required_namespaces:
            self._duplicate_require_tokens.append(token)
          else:
            self._required_namespaces.append(namespace)
  
          # If there is a suppression for the require, add a usage for it so it
          # gets treated as a regular goog.require (i.e. still gets sorted).
          jsdoc = state_tracker.GetDocComment()
          if jsdoc and ('extraRequire' in jsdoc.suppressions):
            self._suppressed_requires.append(namespace)
            self._AddUsedNamespace(state_tracker, namespace)
  
        elif token.string == 'goog.provide':
          self._provide_tokens.append(token)
          namespace = tokenutil.Search(token, TokenType.STRING_TEXT).string
          if namespace in self._provided_namespaces:
            self._duplicate_provide_tokens.append(token)
          else:
            self._provided_namespaces.append(namespace)
  
          # If there is a suppression for the provide, add a creation for it so it
          # gets treated as a regular goog.provide (i.e. still gets sorted).
          jsdoc = state_tracker.GetDocComment()
          if jsdoc and ('extraProvide' in jsdoc.suppressions):
            self._AddCreatedNamespace(state_tracker, namespace)
  
        elif token.string == 'goog.scope':
          self._scopified_file = True
  
        else:
          jsdoc = state_tracker.GetDocComment()
          if jsdoc and jsdoc.HasFlag('typedef'):
            self._AddCreatedNamespace(state_tracker, whole_identifier_string,
                                      self.GetClosurizedNamespace(
                                          whole_identifier_string))
          else:
            self._AddUsedNamespace(state_tracker, whole_identifier_string)
  
      elif token.type == TokenType.SIMPLE_LVALUE:
        identifier = token.values['identifier']
        namespace = self.GetClosurizedNamespace(identifier)
        if state_tracker.InFunction():
          self._AddUsedNamespace(state_tracker, identifier)
        elif namespace and namespace != 'goog':
          self._AddCreatedNamespace(state_tracker, identifier, namespace)
  
      elif token.type == TokenType.DOC_FLAG:
        flag_type = token.attached_object.flag_type
        is_interface = state_tracker.GetDocComment().HasFlag('interface')
        if flag_type == 'implements' or (flag_type == 'extends' and is_interface):
          # Interfaces should be goog.require'd.
          doc_start = tokenutil.Search(token, TokenType.DOC_START_BRACE)
          interface = tokenutil.Search(doc_start, TokenType.COMMENT)
          self._AddUsedNamespace(state_tracker, interface.string)
function_tokens: def ProcessToken ( self , token , state_tracker ) : # Note that this method is in the critical path for the linter and has been # optimized for performance in the following ways: # - Tokens are checked by type first to minimize the number of function #   calls necessary to determine if action needs to be taken for the token. # - The most common tokens types are checked for first. # - The number of function calls has been minimized (thus the length of this #   function. if token . type == TokenType . IDENTIFIER : # TODO(user): Consider saving the whole identifier in metadata. whole_identifier_string = self . _GetWholeIdentifierString ( token ) if whole_identifier_string is None : # We only want to process the identifier one time. If the whole string # identifier is None, that means this token was part of a multi-token # identifier, but it was not the first token of the identifier. return # In the odd case that a goog.require is encountered inside a function, # just ignore it (e.g. dynamic loading in test runners). if token . string == 'goog.require' and not state_tracker . InFunction ( ) : self . _require_tokens . append ( token ) namespace = tokenutil . Search ( token , TokenType . STRING_TEXT ) . string if namespace in self . _required_namespaces : self . _duplicate_require_tokens . append ( token ) else : self . _required_namespaces . append ( namespace ) # If there is a suppression for the require, add a usage for it so it # gets treated as a regular goog.require (i.e. still gets sorted). jsdoc = state_tracker . GetDocComment ( ) if jsdoc and ( 'extraRequire' in jsdoc . suppressions ) : self . _suppressed_requires . append ( namespace ) self . _AddUsedNamespace ( state_tracker , namespace ) elif token . string == 'goog.provide' : self . _provide_tokens . append ( token ) namespace = tokenutil . Search ( token , TokenType . STRING_TEXT ) . string if namespace in self . _provided_namespaces : self . _duplicate_provide_tokens . append ( token ) else : self . _provided_namespaces . append ( namespace ) # If there is a suppression for the provide, add a creation for it so it # gets treated as a regular goog.provide (i.e. still gets sorted). jsdoc = state_tracker . GetDocComment ( ) if jsdoc and ( 'extraProvide' in jsdoc . suppressions ) : self . _AddCreatedNamespace ( state_tracker , namespace ) elif token . string == 'goog.scope' : self . _scopified_file = True else : jsdoc = state_tracker . GetDocComment ( ) if jsdoc and jsdoc . HasFlag ( 'typedef' ) : self . _AddCreatedNamespace ( state_tracker , whole_identifier_string , self . GetClosurizedNamespace ( whole_identifier_string ) ) else : self . _AddUsedNamespace ( state_tracker , whole_identifier_string ) elif token . type == TokenType . SIMPLE_LVALUE : identifier = token . values [ 'identifier' ] namespace = self . GetClosurizedNamespace ( identifier ) if state_tracker . InFunction ( ) : self . _AddUsedNamespace ( state_tracker , identifier ) elif namespace and namespace != 'goog' : self . _AddCreatedNamespace ( state_tracker , identifier , namespace ) elif token . type == TokenType . DOC_FLAG : flag_type = token . attached_object . flag_type is_interface = state_tracker . GetDocComment ( ) . HasFlag ( 'interface' ) if flag_type == 'implements' or ( flag_type == 'extends' and is_interface ) : # Interfaces should be goog.require'd. doc_start = tokenutil . Search ( token , TokenType . DOC_START_BRACE ) interface = tokenutil . Search ( doc_start , TokenType . COMMENT ) self . _AddUsedNamespace ( state_tracker , interface . string )