mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Changed parse_error to derive from std::runtime_error
This commit is contained in:
parent
0aec248de3
commit
4d67d96d7a
10
peglib.h
10
peglib.h
@ -620,13 +620,9 @@ private:
|
|||||||
*/
|
*/
|
||||||
// Note: 'parse_error' exception class should be be used in sematic action
|
// Note: 'parse_error' exception class should be be used in sematic action
|
||||||
// handlers to reject the rule.
|
// handlers to reject the rule.
|
||||||
struct parse_error {
|
class parse_error : public std::runtime_error {
|
||||||
parse_error() = default;
|
public:
|
||||||
parse_error(const char *s) : s_(s) {}
|
parse_error(const char *what_arg) : std::runtime_error(what_arg) {}
|
||||||
const char *what() const { return s_.empty() ? nullptr : s_.data(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string s_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user