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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "tools/gn/commands.h" | 8 #include "tools/gn/commands.h" |
9 #include "tools/gn/input_file.h" | 9 #include "tools/gn/input_file.h" |
10 #include "tools/gn/parser.h" | 10 #include "tools/gn/parser.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 Sequence(kSequenceStyleBracedBlock, | 235 Sequence(kSequenceStyleBracedBlock, |
236 condition->if_false()->AsBlock()->statements(), | 236 condition->if_false()->AsBlock()->statements(), |
237 condition->if_false()->AsBlock()->End()); | 237 condition->if_false()->AsBlock()->End()); |
238 } | 238 } |
239 } | 239 } |
240 } else if (const FunctionCallNode* func_call = root->AsFunctionCall()) { | 240 } else if (const FunctionCallNode* func_call = root->AsFunctionCall()) { |
241 Print(func_call->function().value()); | 241 Print(func_call->function().value()); |
242 Sequence(kSequenceStyleFunctionCall, | 242 Sequence(kSequenceStyleFunctionCall, |
243 func_call->args()->contents(), | 243 func_call->args()->contents(), |
244 func_call->args()->End()); | 244 func_call->args()->End()); |
245 Print(" "); | 245 if (func_call->block()) { |
246 Sequence(kSequenceStyleBracedBlock, | 246 Print(" "); |
247 func_call->block()->statements(), | 247 Sequence(kSequenceStyleBracedBlock, |
248 func_call->block()->End()); | 248 func_call->block()->statements(), |
| 249 func_call->block()->End()); |
| 250 } |
249 } else if (const IdentifierNode* identifier = root->AsIdentifier()) { | 251 } else if (const IdentifierNode* identifier = root->AsIdentifier()) { |
250 Print(identifier->value().value()); | 252 Print(identifier->value().value()); |
251 } else if (const ListNode* list = root->AsList()) { | 253 } else if (const ListNode* list = root->AsList()) { |
252 Sequence(kSequenceStyleList, list->contents(), list->End()); | 254 Sequence(kSequenceStyleList, list->contents(), list->End()); |
253 } else if (const LiteralNode* literal = root->AsLiteral()) { | 255 } else if (const LiteralNode* literal = root->AsLiteral()) { |
254 // TODO(scottmg): Quoting? | 256 // TODO(scottmg): Quoting? |
255 Print(literal->value().value()); | 257 Print(literal->value().value()); |
256 } else if (const UnaryOpNode* unaryop = root->AsUnaryOp()) { | 258 } else if (const UnaryOpNode* unaryop = root->AsUnaryOp()) { |
257 Print(unaryop->op().value()); | 259 Print(unaryop->op().value()); |
258 Expr(unaryop->operand()); | 260 Expr(unaryop->operand()); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 401 } |
400 std::string output_string; | 402 std::string output_string; |
401 if (FormatFileToString(input_name, dump_tree, &output_string)) { | 403 if (FormatFileToString(input_name, dump_tree, &output_string)) { |
402 printf("%s", output_string.c_str()); | 404 printf("%s", output_string.c_str()); |
403 } | 405 } |
404 | 406 |
405 return 0; | 407 return 0; |
406 } | 408 } |
407 | 409 |
408 } // namespace commands | 410 } // namespace commands |
OLD | NEW |