OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "tools/gn/input_conversion.h" | 5 #include "tools/gn/input_conversion.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 if (input_conversion == "value") | 133 if (input_conversion == "value") |
134 return ParseValueOrScope(settings, input, PARSE_VALUE, origin, err); | 134 return ParseValueOrScope(settings, input, PARSE_VALUE, origin, err); |
135 if (input_conversion == "string") | 135 if (input_conversion == "string") |
136 return Value(origin, input); | 136 return Value(origin, input); |
137 if (input_conversion == "list lines") | 137 if (input_conversion == "list lines") |
138 return ParseList(input, origin, err); | 138 return ParseList(input, origin, err); |
139 if (input_conversion == "scope") | 139 if (input_conversion == "scope") |
140 return ParseValueOrScope(settings, input, PARSE_SCOPE, origin, err); | 140 return ParseValueOrScope(settings, input, PARSE_SCOPE, origin, err); |
141 | 141 |
142 *err = Err(original_input_conversion, "Not a valid input_conversion.", | 142 *err = Err(original_input_conversion, "Not a valid input_conversion.", |
143 "Have you considered a career in retail?"); | 143 "Run gn help input_conversion to see your options."); |
144 return Value(); | 144 return Value(); |
145 } | 145 } |
146 | 146 |
147 } // namespace | 147 } // namespace |
148 | 148 |
149 extern const char kInputConversion_Help[] = | 149 extern const char kInputConversion_Help[] = |
150 "input_conversion: Specifies how to transform input to a variable.\n" | 150 "input_conversion: Specifies how to transform input to a variable.\n" |
151 "\n" | 151 "\n" |
152 " input_conversion is an argument to read_file and exec_script that\n" | 152 " input_conversion is an argument to read_file and exec_script that\n" |
153 " specifies how the result of the read operation should be converted\n" | 153 " specifies how the result of the read operation should be converted\n" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 const ParseNode* origin, | 204 const ParseNode* origin, |
205 const Value& input_conversion_value, | 205 const Value& input_conversion_value, |
206 Err* err) { | 206 Err* err) { |
207 if (input_conversion_value.type() == Value::NONE) | 207 if (input_conversion_value.type() == Value::NONE) |
208 return Value(); // Allow null inputs to mean discard the result. | 208 return Value(); // Allow null inputs to mean discard the result. |
209 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err)) | 209 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err)) |
210 return Value(); | 210 return Value(); |
211 return DoConvertInputToValue(settings, input, origin, input_conversion_value, | 211 return DoConvertInputToValue(settings, input, origin, input_conversion_value, |
212 input_conversion_value.string_value(), err); | 212 input_conversion_value.string_value(), err); |
213 } | 213 } |
OLD | NEW |