Exemplo n.º 1
0
def process_file(config, infile, outfile):
    """
  Parse the input cmake file, re-format it, and print to the output file.
  """

    pretty_printer = formatter.TreePrinter(config, outfile)
    tokens = lexer.tokenize(infile.read())
    tok_seqs = parser.digest_tokens(tokens)
    fst = parser.construct_fst(tok_seqs)
    pretty_printer.print_node(fst)
Exemplo n.º 2
0
def process_file(config, infile, outfile):
  """
  Parse the input cmake file, re-format it, and print to the output file.
  """

  pretty_printer = formatter.TreePrinter(config, outfile)
  infile_content = infile.read()
  if config.line_ending == 'auto':
    detected = detect_line_endings(infile_content)
    config.set_line_ending(detected)
  tokens = lexer.tokenize(infile_content)
  tok_seqs = parser.digest_tokens(tokens)
  fst = parser.construct_fst(tok_seqs)
  pretty_printer.print_node(fst)