import re


def GetClasses(input_filename):
  """Computes the set of classes for AST objects in the given file.

  Args:
    input_filename: The input file.

  Returns:
    A pair (concrete_classes, abstract_classes) where concrete_classes is a list
    of all final (concrete) class names in the input file, and abstract_classes
    is a list of non-final class names.
  """
  concrete_classes = []
  abstract_classes = ['ASTNode']
  for input_line in open(input_filename):
    m = re.search('^class (AST[a-zA-Z]*) final : public', input_line)
    if m:
      concrete_classes.append(m.group(1))
    m = re.search('^class (AST[a-zA-Z]*) : public', input_line)
    if m:
      abstract_classes.append(m.group(1))
  return (concrete_classes, abstract_classes)