source: icGREP/icgrep-devel/icgrep/re/parsefailure.h @ 4304

Last change on this file since 4304 was 4304, checked in by cameron, 5 years ago

NothingToRepeat? exception/error message.

File size: 2.1 KB
RevLine 
[3850]1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef PARSEFAILURE_H
8#define PARSEFAILURE_H
9
10#include <string>
[4182]11#include <stdexcept>
[3850]12
[4182]13class ParseFailure : public std::exception {
[3850]14public:
[4182]15    ParseFailure(const std::string && msg) noexcept;
16    virtual ~ParseFailure() noexcept;
17    virtual const char* what() const noexcept;
[3850]18private:
[4182]19    inline ParseFailure() noexcept {}
20    const std::string _msg;
[3850]21};
22
[4182]23class NoRegularExpressionFound : public ParseFailure {
24public:
25    NoRegularExpressionFound() noexcept : ParseFailure("No regular expression found!") { }
26    virtual ~NoRegularExpressionFound() noexcept {}
27};
28
29class IncompleteRegularExpression : public ParseFailure {
30public:
31    IncompleteRegularExpression() noexcept : ParseFailure("Incomplete regular expression!") { }
32    virtual ~IncompleteRegularExpression() noexcept {}
33};
34
35class UnclosedCharacterClass : public ParseFailure {
36public:
37    UnclosedCharacterClass() noexcept : ParseFailure("Unclosed character class!") { }
38    virtual ~UnclosedCharacterClass() noexcept {}
39};
40
41class InvalidUTF8Encoding : public ParseFailure {
42public:
43    InvalidUTF8Encoding() noexcept : ParseFailure("Invalid UTF-8 encoding!") { }
44    virtual ~InvalidUTF8Encoding() noexcept {}
45};
46
47class UnclosedUnicodeCharacterClass : public ParseFailure {
48public:
49    UnclosedUnicodeCharacterClass() noexcept : ParseFailure("Unclosed Unicode character class!") { }
50    virtual ~UnclosedUnicodeCharacterClass() noexcept {}
51};
52
53class BadLowerBound : public ParseFailure {
54public:
55    BadLowerBound() noexcept : ParseFailure("Bad lower bound!") { }
56    virtual ~BadLowerBound() noexcept {}
57};
58
59class BadUpperBound : public ParseFailure {
60public:
61    BadUpperBound() noexcept : ParseFailure("Bad upper bound!") { }
62    virtual ~BadUpperBound() noexcept {}
63};
64
[4304]65class NothingToRepeat : public ParseFailure {
66public:
67    NothingToRepeat() noexcept : ParseFailure("Need something to repeat before *, +, ? or {.") { }
68    virtual ~NothingToRepeat() noexcept {}
69};
70
[3850]71#endif // PARSEFAILURE_H
Note: See TracBrowser for help on using the repository browser.