From 2a8f78f46f0935a450edbe5e406a8b4a15de8291 Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Wed, 23 Jul 2014 18:25:46 +0200 Subject: [PATCH] Scanner data members for @nogc/nothrow functions to write exception data to. --- source/dyaml/scanner.d | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/dyaml/scanner.d b/source/dyaml/scanner.d index fa43d93..41a7ba1 100644 --- a/source/dyaml/scanner.d +++ b/source/dyaml/scanner.d @@ -69,6 +69,7 @@ class ScannerException : MarkedYAMLException } private alias ScannerException Error; +private alias MarkedYAMLExceptionData ErrorData; ///Generates tokens from data provided by a Reader. final class Scanner @@ -150,6 +151,16 @@ final class Scanner ///Used for constructing strings while limiting reallocation. 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: ///Construct a Scanner using specified Reader. this(Reader reader) @trusted