exceptions.h 1.79 KB
Newer Older
beder's avatar
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 {};
beder's avatar
beder committed
9
	class ParserException: public Exception {};
10
	class RepresentationException: public Exception {};
beder's avatar
beder committed
11

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

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

beder's avatar
beder committed
44
45
46
47
48
49
	// parser exceptions
	class MapEndNotFound: public ParserException {};
	class SeqEndNotFound: public ParserException {};
	class BadYAMLDirective: public ParserException {};
	class BadTAGDirective: public ParserException {};

50
51
52
	// representation exceptions
	class InvalidScalar: public RepresentationException {};
	class BadDereference: public RepresentationException {};
beder's avatar
beder committed
53
}