File: path_parser.hpp

package info (click to toggle)
cpp-hocon 0.3.0-1.2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,320 kB
  • sloc: cpp: 12,223; makefile: 4
file content (55 lines) | stat: -rw-r--r-- 1,923 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include "path_builder.hpp"
#include "simple_config_origin.hpp"
#include "tokenizer.hpp"
#include <hocon/config_syntax.hpp>
#include <internal/nodes/config_node_path.hpp>

#include <string>
#include <vector>

namespace hocon  {

    class path_parser {
    public:
        static config_node_path parse_path_node(std::string const& path_string,
                                                config_syntax flavor = config_syntax::CONF);

        static path parse_path(std::string const& path_string);

        static path parse_path_expression(iterator& expression, shared_origin origin,
                                          std::string const& original_text = "",
                                          token_list* path_tokens = nullptr,
                                          config_syntax flavor = config_syntax::CONF);

        static config_node_path parse_path_node_expression(iterator& expression,
                                                           shared_origin origin,
                                                           std::string const& original_text = "",
                                                           config_syntax flavor = config_syntax::CONF);

    private:
        class element {
        public:
            element(std::string initial, bool can_be_empty);

            std::string to_string() const;

            std::string _value;
            bool _can_be_empty;
        };

        static token_list split_token_on_period(shared_token t, config_syntax flavor);

        static void add_path_text(std::vector<element>& buff, bool was_quoted, std::string new_text);

        static bool looks_unsafe_for_fast_parser(std::string s);

        static path fast_path_build(path tail, std::string s);

        static path speculative_fast_parse_path(std::string const& path);

        static const shared_origin api_origin;
    };

}  // namespace hocon