parameters: (token_name)
docstring: Parses the token from the official file if it exists, else returns None.
docstring_summary: Parses the token from the official file if it exists, else returns None.
docstring_tokens: Parses the token from the official file if it exists else returns None .
function: def _GetTokenFromOfficialFile(token_name):
    """Parses the token from the official file if it exists, else returns None."""
    official_path = os.path.join(os.path.dirname(__file__),
                                 'internal/google_chrome_api_keys.h')
    if not os.path.isfile(official_path):
      return None
  
    line_regexp = '^#define\s*%s\s*"([^"]+)"' % token_name
    line_pattern = re.compile(line_regexp)
    def ParseLine(current_line):
      result = line_pattern.match(current_line)
      if result:
        return result.group(1)
      else:
        return None
  
    with open(official_path) as f:
      current_line = ''
      for line in f:
        if line.endswith('\\\n'):
          current_line += line[:-2]
        else:
          # Last line in multi-line #define, or a line that is not a
          # continuation line.
          current_line += line
          token = ParseLine(current_line)
          if token:
            if current_line.count('"') != 2:
              raise Exception(
                'Embedded quotes and multi-line strings are not supported.')
            return token
          current_line = ''
      return None
function_tokens: def _GetTokenFromOfficialFile ( token_name ) : official_path = os . path . join ( os . path . dirname ( __file__ ) , 'internal/google_chrome_api_keys.h' ) if not os . path . isfile ( official_path ) : return None line_regexp = '^#define\s*%s\s*"([^"]+)"' % token_name line_pattern = re . compile ( line_regexp ) def ParseLine ( current_line ) : result = line_pattern . match ( current_line ) if result : return result . group ( 1 ) else : return None with open ( official_path ) as f : current_line = '' for line in f : if line . endswith ( '\\\n' ) : current_line += line [ : - 2 ] else : # Last line in multi-line #define, or a line that is not a # continuation line. current_line += line token = ParseLine ( current_line ) if token : if current_line . count ( '"' ) != 2 : raise Exception ( 'Embedded quotes and multi-line strings are not supported.' ) return token current_line = '' return None