cpp-hocon  0.3.0
path_parser.hpp
1 #pragma once
2 
3 #include "path_builder.hpp"
4 #include "simple_config_origin.hpp"
5 #include "tokenizer.hpp"
6 #include <hocon/config_syntax.hpp>
7 #include <internal/nodes/config_node_path.hpp>
8 
9 #include <string>
10 #include <vector>
11 
12 namespace hocon {
13 
14  class path_parser {
15  public:
16  static config_node_path parse_path_node(std::string const& path_string,
17  config_syntax flavor = config_syntax::CONF);
18 
19  static path parse_path(std::string const& path_string);
20 
21  static path parse_path_expression(iterator& expression, shared_origin origin,
22  std::string const& original_text = "",
23  token_list* path_tokens = nullptr,
24  config_syntax flavor = config_syntax::CONF);
25 
26  static config_node_path parse_path_node_expression(iterator& expression,
27  shared_origin origin,
28  std::string const& original_text = "",
29  config_syntax flavor = config_syntax::CONF);
30 
31  private:
32  class element {
33  public:
34  element(std::string initial, bool can_be_empty);
35 
36  std::string to_string() const;
37 
38  std::string _value;
39  bool _can_be_empty;
40  };
41 
42  static token_list split_token_on_period(shared_token t, config_syntax flavor);
43 
44  static void add_path_text(std::vector<element>& buff, bool was_quoted, std::string new_text);
45 
46  static bool looks_unsafe_for_fast_parser(std::string s);
47 
48  static path fast_path_build(path tail, std::string s);
49 
50  static path speculative_fast_parse_path(std::string const& path);
51 
52  static const shared_origin api_origin;
53  };
54 
55 } // namespace hocon
hocon::path_parser
Definition: path_parser.hpp:14
hocon
Factory for creating config_document instances.
Definition: config.hpp:18
hocon::iterator
Definition: tokenizer.hpp:24
hocon::path
Definition: path.hpp:13
hocon::config_node_path
Definition: config_node_path.hpp:9