exceptions.h 1.52 KB
Newer Older
Jesse Beder's avatar
Jesse Beder committed
1
2
3
4
5
6
7
#pragma once

#include <exception>

namespace YAML
{
	class Exception: public std::exception {};
8
	class ScannerException: public Exception {};
9
	class RepresentationException: public Exception {};
Jesse Beder's avatar
Jesse Beder committed
10

11
	// scanner exceptions
12
13
14
15
16
17
18
19
20
21
22
23
24
25
	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 {};
Jesse Beder's avatar
Jesse Beder committed
26

27
	class UnknownEscapeSequence: public ScannerException {
28
29
30
31
	public:
		UnknownEscapeSequence(char ch_): ch(ch_) {}
		char ch;
	};
32
	class NonHexNumber: public ScannerException {
33
34
35
36
	public:
		NonHexNumber(char ch_): ch(ch_) {}
		char ch;
	};
37
	class InvalidUnicode: public ScannerException {
38
39
40
41
	public:
		InvalidUnicode(unsigned value_): value(value_) {}
		unsigned value;
	};
42
43
44
45

	// representation exceptions
	class InvalidScalar: public RepresentationException {};
	class BadDereference: public RepresentationException {};
Jesse Beder's avatar
Jesse Beder committed
46
}