21 #include "Typedefs.hpp" 48 const std::string&
file =
"",
size_t error_line = 0,
unsigned int error_offset = 0)
49 : _rule_spec(rule_spec),
51 _offset(error_offset),
84 void setFileInfo(
const std::string&
file,
size_t error_line,
size_t error_offset = 0)
88 _offset = error_offset;
96 const char*
what() const noexcept
98 return "RuleParserError";
106 const std::string&
rule()
const 116 const std::string&
hint()
const 129 return !_file.empty();
140 return _file +
": line=" + std::to_string(_line) +
": offset=" + std::to_string(_offset);
148 const std::string&
file()
const 174 const std::string _rule_spec;
192 DLL_PUBLIC Rule parseRuleFromString(
const std::string& rule_spec,
const std::string& file = std::string(),
size_t line = 0,
void setOffset(size_t offset)
Sets the offset where the error occured.
Definition: RuleParser.hpp:72
const char * what() const noexcept
Describes the exception.
Definition: RuleParser.hpp:96
const std::string & rule() const
Returns string representation of the rule.
Definition: RuleParser.hpp:106
const std::string & hint() const
Returns error hint.
Definition: RuleParser.hpp:116
Represents error during the rule parsing.
Definition: RuleParser.hpp:34
const std::string fileInfo() const
Returns string containing file, line and offset where the error occured.
Definition: RuleParser.hpp:138
bool hasFileInfo() const
Decides whether information about error location is set.
Definition: RuleParser.hpp:127
void setHint(const std::string &hint)
Sets the describtion of the error.
Definition: RuleParser.hpp:62
const std::string & file() const
File where the rule is located.
Definition: RuleParser.hpp:148
size_t offset() const
Offset where the error occured.
Definition: RuleParser.hpp:168
size_t line() const
Line number where the rule is located.
Definition: RuleParser.hpp:158
RuleParserError(const std::string &rule_spec, const std::string &hint="", const std::string &file="", size_t error_line=0, unsigned int error_offset=0)
Constructs RuleParserError.
Definition: RuleParser.hpp:47
void setFileInfo(const std::string &file, size_t error_line, size_t error_offset=0)
Sets exact location where the error occured.
Definition: RuleParser.hpp:84