make Scanner a struct

This commit is contained in:
Cameron Ross 2019-01-15 05:31:05 -04:00 committed by BBasile
parent c61f569f19
commit d6300bc52e
3 changed files with 18 additions and 3 deletions

View file

@ -152,7 +152,7 @@ struct Loader
try try
{ {
reader_ = new Reader(yamlData); reader_ = new Reader(yamlData);
scanner_ = new Scanner(reader_); scanner_ = Scanner(reader_);
parser_ = new Parser(scanner_); parser_ = new Parser(scanner_);
} }
catch(YAMLException e) catch(YAMLException e)

View file

@ -95,7 +95,22 @@ public:
@disable bool opEquals(ref Queue); @disable bool opEquals(ref Queue);
@disable int opCmp(ref Queue); @disable int opCmp(ref Queue);
@disable this(this); this(this) @safe nothrow @nogc
{
auto node = first_;
first_ = null;
last_ = null;
while (node !is null)
{
Node* newLast = makeNewNode(node.payload_);
if (last_ !is null)
last_.next_ = newLast;
if (first_ is null)
first_ = newLast;
last_ = newLast;
node = node.next_;
}
}
~this() @safe nothrow @nogc ~this() @safe nothrow @nogc
{ {

View file

@ -79,7 +79,7 @@ class ScannerException : MarkedYAMLException
} }
/// Generates tokens from data provided by a Reader. /// Generates tokens from data provided by a Reader.
final class Scanner struct Scanner
{ {
private: private:
/// A simple key is a key that is not denoted by the '?' indicator. /// A simple key is a key that is not denoted by the '?' indicator.