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:
beder
2008-07-08 05:48:38 +00:00
parent 1acc0e4982
commit 2f5c19fa00
12 changed files with 114 additions and 113 deletions

View File

@@ -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 {};