OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 file.SetContents(input); | 975 file.SetContents(input); |
976 Err err; | 976 Err err; |
977 // Tokenize. | 977 // Tokenize. |
978 std::vector<Token> tokens = Tokenizer::Tokenize(&file, &err); | 978 std::vector<Token> tokens = Tokenizer::Tokenize(&file, &err); |
979 if (err.has_error()) { | 979 if (err.has_error()) { |
980 err.PrintToStdout(); | 980 err.PrintToStdout(); |
981 return false; | 981 return false; |
982 } | 982 } |
983 | 983 |
984 // Parse. | 984 // Parse. |
985 scoped_ptr<ParseNode> parse_node = Parser::Parse(tokens, &err); | 985 std::unique_ptr<ParseNode> parse_node = Parser::Parse(tokens, &err); |
986 if (err.has_error()) { | 986 if (err.has_error()) { |
987 err.PrintToStdout(); | 987 err.PrintToStdout(); |
988 return false; | 988 return false; |
989 } | 989 } |
990 | 990 |
991 DoFormat(parse_node.get(), dump_tree, output); | 991 DoFormat(parse_node.get(), dump_tree, output); |
992 return true; | 992 return true; |
993 } | 993 } |
994 | 994 |
995 int RunFormat(const std::vector<std::string>& args) { | 995 int RunFormat(const std::vector<std::string>& args) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 } | 1068 } |
1069 } else { | 1069 } else { |
1070 printf("%s", output_string.c_str()); | 1070 printf("%s", output_string.c_str()); |
1071 } | 1071 } |
1072 } | 1072 } |
1073 | 1073 |
1074 return 0; | 1074 return 0; |
1075 } | 1075 } |
1076 | 1076 |
1077 } // namespace commands | 1077 } // namespace commands |
OLD | NEW |