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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
#pragma once
#include "token.hpp"
#include <hocon/config_value.hpp>
namespace hocon {
class value : public token {
public:
value(shared_value value);
value(shared_value value, std::string original_text);
std::string to_string() const override;
shared_origin const& origin() const override;
shared_value get_value() const;
bool operator==(const token& other) const override;
private:
shared_value _value;
};
class line : public token {
public:
line(shared_origin origin);
std::string to_string() const override;
bool operator==(token const& other) const override;
};
class unquoted_text : public token {
public:
unquoted_text(shared_origin origin, std::string text);
std::string to_string() const override;
bool operator==(const token& other) const override;
};
class ignored_whitespace : public token {
public:
ignored_whitespace(shared_origin origin, std::string whitespace);
std::string to_string() const override;
bool operator==(const token& other) const override;
};
class problem : public token {
public:
problem(shared_origin origin, std::string what, std::string message, bool suggest_quotes);
std::string what() const;
std::string message() const;
bool suggest_quotes() const;
std::string to_string() const override;
bool operator==(const token& other) const override;
private:
std::string _what;
std::string _message;
bool _suggest_quotes;
};
class comment : public token {
public:
comment(shared_origin origin, std::string text);
std::string text() const;
std::string to_string() const override;
bool operator==(const token& other) const override;
private:
std::string _text;
};
class double_slash_comment : public comment {
public:
double_slash_comment(shared_origin origin, std::string text);
std::string token_text() const override;
};
class hash_comment : public comment {
public:
hash_comment(shared_origin origin, std::string text);
std::string token_text() const override;
};
class substitution : public token {
public:
substitution(shared_origin origin, bool optional, token_list expression);
bool optional() const;
token_list const& expression() const;
std::string token_text() const override;
std::string to_string() const override;
bool operator==(const token& other) const override;
private:
bool _optional;
token_list _expression;
};
class tokens {
public:
/** Singleton tokens */
static shared_token const& start_token();
static shared_token const& end_token();
static shared_token const& comma_token();
static shared_token const& equals_token();
static shared_token const& colon_token();
static shared_token const& open_curly_token();
static shared_token const& close_curly_token();
static shared_token const& open_square_token();
static shared_token const& close_square_token();
static shared_token const& plus_equals_token();
static bool is_newline(shared_token);
static bool is_ignored_whitespace(shared_token);
static bool is_value_with_type(shared_token t, config_value::type type);
static shared_value get_value(shared_token t);
};
} // namespace hocon
|