Scanner data members for @nogc/nothrow functions to write exception data to.

This commit is contained in:
Ferdinand Majerech 2014-07-23 18:25:46 +02:00
parent be942564d9
commit 2a8f78f46f

View file

@ -69,6 +69,7 @@ class ScannerException : MarkedYAMLException
} }
private alias ScannerException Error; private alias ScannerException Error;
private alias MarkedYAMLExceptionData ErrorData;
///Generates tokens from data provided by a Reader. ///Generates tokens from data provided by a Reader.
final class Scanner final class Scanner
@ -150,6 +151,16 @@ final class Scanner
///Used for constructing strings while limiting reallocation. ///Used for constructing strings while limiting reallocation.
Appender!(dchar[]) appender_; Appender!(dchar[]) appender_;
/// Set on error by nothrow/@nogc inner functions along with errorData_.
///
/// Non-nothrow/GC-using caller functions can then throw an exception using
/// data stored in errorData_.
bool error_;
/// Data for the exception to throw if error_ is true.
ErrorData errorData_;
public: public:
///Construct a Scanner using specified Reader. ///Construct a Scanner using specified Reader.
this(Reader reader) @trusted this(Reader reader) @trusted