From a23c41385add849d8d93830b927aab6ac1336eb7 Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Thu, 31 Jul 2014 01:56:36 +0200 Subject: [PATCH] Very minor Parser/Event @nogc/style. --- source/dyaml/event.d | 32 +++++++++++++++----------------- source/dyaml/parser.d | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/source/dyaml/event.d b/source/dyaml/event.d index 0a346ca..22c5903 100644 --- a/source/dyaml/event.d +++ b/source/dyaml/event.d @@ -74,7 +74,7 @@ struct Event ScalarStyle scalarStyle = ScalarStyle.Invalid; union { - ///Should the tag be implicitly resolved? + ///Should the tag be implicitly resolved? bool implicit; /** * Is this document event explicit? @@ -106,7 +106,7 @@ struct Event * end = End position of the event in the file/stream. * anchor = Anchor, if this is an alias event. */ -Event event(EventID id)(const Mark start, const Mark end, const Anchor anchor = Anchor()) +Event event(EventID id)(const Mark start, const Mark end, const Anchor anchor = Anchor()) pure @trusted nothrow { Event result; @@ -150,7 +150,7 @@ Event collectionStartEvent(EventID id) * end = End position of the event in the file/stream. * encoding = Encoding of the stream. */ -Event streamStartEvent(const Mark start, const Mark end, const Encoding encoding) +Event streamStartEvent(const Mark start, const Mark end, const Encoding encoding) pure @trusted nothrow { Event result; @@ -210,20 +210,18 @@ Event documentEndEvent(const Mark start, const Mark end, const bool explicit) pu return result; } -/** - * Construct a scalar event. - * - * Params: start = Start position of the event in the file/stream. - * end = End position of the event in the file/stream. - * anchor = Anchor of the scalar, if any. - * tag = Tag of the scalar, if specified. - * implicit = Should the tag be implicitly resolved? - * value = String value of the scalar. - * style = Scalar style. - */ -Event scalarEvent(const Mark start, const Mark end, const Anchor anchor, const Tag tag, - const Tuple!(bool, bool) implicit, const string value, - const ScalarStyle style = ScalarStyle.Invalid) pure @trusted nothrow +/// Construct a scalar event. +/// +/// Params: start = Start position of the event in the file/stream. +/// end = End position of the event in the file/stream. +/// anchor = Anchor of the scalar, if any. +/// tag = Tag of the scalar, if specified. +/// implicit = Should the tag be implicitly resolved? +/// value = String value of the scalar. +/// style = Scalar style. +Event scalarEvent(const Mark start, const Mark end, const Anchor anchor, const Tag tag, + const Tuple!(bool, bool) implicit, const string value, + const ScalarStyle style = ScalarStyle.Invalid) @safe pure nothrow @nogc { Event result; result.value = value; diff --git a/source/dyaml/parser.d b/source/dyaml/parser.d index bd5f8f3..13d2687 100644 --- a/source/dyaml/parser.d +++ b/source/dyaml/parser.d @@ -945,7 +945,7 @@ final class Parser } ///Return an empty scalar. - Event processEmptyScalar(const Mark mark) const pure @safe nothrow + Event processEmptyScalar(const Mark mark) @safe pure nothrow const @nogc { return scalarEvent(mark, mark, Anchor(), Tag(), tuple(true, false), ""); }