mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Combined the myriad ScannerExceptions and ParserExceptions to a single ParserException class that has a message and a line/column position in the file where the error occurred.
This commit is contained in:
48
exceptions.h
48
exceptions.h
@@ -5,48 +5,16 @@
|
||||
namespace YAML
|
||||
{
|
||||
class Exception: public std::exception {};
|
||||
class ScannerException: public Exception {};
|
||||
class ParserException: public Exception {};
|
||||
class ParserException: public Exception {
|
||||
public:
|
||||
ParserException(int line_, int column_, const std::string& msg_)
|
||||
: line(line_), column(column_), msg(msg_) {}
|
||||
int line, column;
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
class RepresentationException: public Exception {};
|
||||
|
||||
// scanner exceptions
|
||||
class UnknownToken: public ScannerException {};
|
||||
class IllegalBlockEntry: public ScannerException {};
|
||||
class IllegalMapKey: public ScannerException {};
|
||||
class IllegalMapValue: public ScannerException {};
|
||||
class IllegalScalar: public ScannerException {};
|
||||
class IllegalTabInIndentation: public ScannerException {};
|
||||
class IllegalFlowEnd: public ScannerException {};
|
||||
class IllegalDocIndicator: public ScannerException {};
|
||||
class IllegalEOF: public ScannerException {};
|
||||
class RequiredSimpleKeyNotFound: public ScannerException {};
|
||||
class ZeroIndentationInBlockScalar: public ScannerException {};
|
||||
class UnexpectedCharacterInBlockScalar: public ScannerException {};
|
||||
class AnchorNotFound: public ScannerException {};
|
||||
class IllegalCharacterInAnchor: public ScannerException {};
|
||||
|
||||
class UnknownEscapeSequence: public ScannerException {
|
||||
public:
|
||||
UnknownEscapeSequence(char ch_): ch(ch_) {}
|
||||
char ch;
|
||||
};
|
||||
class NonHexNumber: public ScannerException {
|
||||
public:
|
||||
NonHexNumber(char ch_): ch(ch_) {}
|
||||
char ch;
|
||||
};
|
||||
class InvalidUnicode: public ScannerException {
|
||||
public:
|
||||
InvalidUnicode(unsigned value_): value(value_) {}
|
||||
unsigned value;
|
||||
};
|
||||
|
||||
// parser exceptions
|
||||
class MapEndNotFound: public ParserException {};
|
||||
class SeqEndNotFound: public ParserException {};
|
||||
class BadYAMLDirective: public ParserException {};
|
||||
class BadTAGDirective: public ParserException {};
|
||||
|
||||
// representation exceptions
|
||||
class InvalidScalar: public RepresentationException {};
|
||||
class BadDereference: public RepresentationException {};
|
||||
|
Reference in New Issue
Block a user