1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef TOOLS_GN_COMAND_FORMAT_H_ 6 #define TOOLS_GN_COMAND_FORMAT_H_ 7 8 #include <string> 9 10 class Setup; 11 class SourceFile; 12 13 namespace commands { 14 15 enum class TreeDumpMode { 16 // Normal operation mode. Format the input file. 17 kInactive, 18 19 // Output the token tree with indented plain text. For debugging. 20 kPlainText, 21 22 // Output the token tree in JSON format. Used for exporting a tree to another 23 // program. 24 kJSON 25 }; 26 27 bool FormatFileToString(Setup* setup, 28 const SourceFile& file, 29 TreeDumpMode dump_tree, 30 std::string* output); 31 32 bool FormatStringToString(const std::string& input, 33 TreeDumpMode dump_tree, 34 std::string* output); 35 36 } // namespace commands 37 38 #endif // TOOLS_GN_COMAND_FORMAT_H_ 39