1 /* This file is part of GCC.
2
3 GCC is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3, or (at your option)
6 any later version.
7
8 GCC is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with GCC; see the file COPYING3. If not see
15 <http://www.gnu.org/licenses/>. */
16
17 #ifndef RUST_CFG_PARSER_H
18 #define RUST_CFG_PARSER_H
19
20 #include "rust-system.h"
21
22 namespace Rust {
23 /**
24 * Parse a `key` or `key="value"` pair given to the `-frust-cfg` compiler
25 * option.
26 *
27 * The format is as follows:
28 *
29 * -frust-cfg=<input>
30 *
31 * cfg_input: identifier | identifier '=' '"' identifier '"'
32 *
33 * @param input User input given to the -frust-cfg option
34 * @param key String in which to store the parsed `key`.
35 * @param value String in which to store the parsed `value` if it exists
36 *
37 * @return false if the given input was invalid, true otherwise
38 */
39 bool
40 parse_cfg_option (std::string &input, std::string &key, std::string &value);
41 } // namespace Rust
42
43 #if CHECKING_P
44
45 namespace selftest {
46 extern void
47 rust_cfg_parser_test (void);
48 } // namespace selftest
49
50 #endif // CHECKING_P
51
52 #endif // RUST_CFG_PARSER_H