parameters: (filename)
return_statement: return buf
docstring: :param filename: d file name
  	:type filename: string
  	:rtype: list
  	:return: a list of characters
docstring_summary: :param filename: d file name
  	:type filename: string
  	:rtype: list
  	:return: a list of characters
docstring_tokens: : param filename : d file name : type filename : string : rtype : list : return : a list of characters
function: def filter_comments(filename):
  	"""
  	:param filename: d file name
  	:type filename: string
  	:rtype: list
  	:return: a list of characters
  	"""
  	txt = Utils.readf(filename)
  	i = 0
  	buf = []
  	max = len(txt)
  	begin = 0
  	while i < max:
  		c = txt[i]
  		if c == '"' or c == "'":  # skip a string or character literal
  			buf.append(txt[begin:i])
  			delim = c
  			i += 1
  			while i < max:
  				c = txt[i]
  				if c == delim:
  					break
  				elif c == '\\':  # skip the character following backslash
  					i += 1
  				i += 1
  			i += 1
  			begin = i
  		elif c == '/':  # try to replace a comment with whitespace
  			buf.append(txt[begin:i])
  			i += 1
  			if i == max:
  				break
  			c = txt[i]
  			if c == '+':  # eat nesting /+ +/ comment
  				i += 1
  				nesting = 1
  				c = None
  				while i < max:
  					prev = c
  					c = txt[i]
  					if prev == '/' and c == '+':
  						nesting += 1
  						c = None
  					elif prev == '+' and c == '/':
  						nesting -= 1
  						if nesting == 0:
  							break
  						c = None
  					i += 1
  			elif c == '*':  # eat /* */ comment
  				i += 1
  				c = None
  				while i < max:
  					prev = c
  					c = txt[i]
  					if prev == '*' and c == '/':
  						break
  					i += 1
  			elif c == '/':  # eat // comment
  				i += 1
  				while i < max and txt[i] != '\n':
  					i += 1
  			else:  # no comment
  				begin = i - 1
  				continue
  			i += 1
  			begin = i
  			buf.append(' ')
  		else:
  			i += 1
  	buf.append(txt[begin:])
  	return buf
function_tokens: def filter_comments ( filename ) : txt = Utils . readf ( filename ) i = 0 buf = [ ] max = len ( txt ) begin = 0 while i < max : c = txt [ i ] if c == '"' or c == "'" : # skip a string or character literal buf . append ( txt [ begin : i ] ) delim = c i += 1 while i < max : c = txt [ i ] if c == delim : break elif c == '\\' : # skip the character following backslash i += 1 i += 1 i += 1 begin = i elif c == '/' : # try to replace a comment with whitespace buf . append ( txt [ begin : i ] ) i += 1 if i == max : break c = txt [ i ] if c == '+' : # eat nesting /+ +/ comment i += 1 nesting = 1 c = None while i < max : prev = c c = txt [ i ] if prev == '/' and c == '+' : nesting += 1 c = None elif prev == '+' and c == '/' : nesting -= 1 if nesting == 0 : break c = None i += 1 elif c == '*' : # eat /* */ comment i += 1 c = None while i < max : prev = c c = txt [ i ] if prev == '*' and c == '/' : break i += 1 elif c == '/' : # eat // comment i += 1 while i < max and txt [ i ] != '\n' : i += 1 else : # no comment begin = i - 1 continue i += 1 begin = i buf . append ( ' ' ) else : i += 1 buf . append ( txt [ begin : ] ) return buf