From bc1a2c2d0f56edaec777298361797dd582f3d7aa Mon Sep 17 00:00:00 2001 From: ZombineDev Date: Fri, 4 Nov 2016 02:50:32 +0200 Subject: [PATCH] Stop using implicit string literal concatenation Implicit string litaral concatenation was deprecated with this DMD PR: dlang/dmd/pull/6155. --- source/dyaml/composer.d | 16 ++++++++-------- source/dyaml/constructor.d | 2 +- source/dyaml/dumper.d | 2 +- source/dyaml/emitter.d | 4 ++-- source/dyaml/flags.d | 22 +++++++++++----------- source/dyaml/node.d | 2 +- source/dyaml/reader.d | 2 +- source/dyaml/resolver.d | 30 +++++++++++++++--------------- source/dyaml/scanner.d | 10 +++++----- 9 files changed, 45 insertions(+), 45 deletions(-) diff --git a/source/dyaml/composer.d b/source/dyaml/composer.d index e9bba34..70f08f6 100644 --- a/source/dyaml/composer.d +++ b/source/dyaml/composer.d @@ -110,7 +110,7 @@ final class Composer { //Get the root node of the next document. assert(!parser_.checkEvent(EventID.StreamEnd), - "Trying to get a node from Composer when there is no node to " + "Trying to get a node from Composer when there is no node to " ~ "get. use checkNode() to determine if there is a node."); return composeDocument(); @@ -120,14 +120,14 @@ final class Composer Node getSingleNode() @trusted { assert(!parser_.checkEvent(EventID.StreamEnd), - "Trying to get a node from Composer when there is no node to " + "Trying to get a node from Composer when there is no node to " ~ "get. use checkNode() to determine if there is a node."); Node document = composeDocument(); //Ensure that the stream contains no more documents. enforce(parser_.checkEvent(EventID.StreamEnd), - new ComposerException("Expected single document in the stream, " + new ComposerException("Expected single document in the stream, " ~ "but found another document.", parser_.getEvent().startMark)); @@ -292,11 +292,11 @@ final class Composer void error(Node node) { //this is Composer, but the code is related to Constructor. - throw new ConstructorException("While constructing a mapping, " - "expected a mapping or a list of " - "mappings for merging, but found: " - ~ node.type.toString() ~ - " NOTE: line/column shows topmost parent " + throw new ConstructorException("While constructing a mapping, " ~ + "expected a mapping or a list of " ~ + "mappings for merging, but found: " ~ + node.type.toString() ~ + " NOTE: line/column shows topmost parent " ~ "to which the content is being merged", startMark, endMark); } diff --git a/source/dyaml/constructor.d b/source/dyaml/constructor.d index e18025d..301c665 100644 --- a/source/dyaml/constructor.d +++ b/source/dyaml/constructor.d @@ -352,7 +352,7 @@ final class Constructor assert((tag in fromScalar_) is null && (tag in fromSequence_) is null && (tag in fromMapping_) is null, - "Constructor function for tag " ~ tag.get ~ " is already " + "Constructor function for tag " ~ tag.get ~ " is already " ~ "specified. Can't specify another one."); diff --git a/source/dyaml/dumper.d b/source/dyaml/dumper.d index 54c57e1..46bb8c1 100644 --- a/source/dyaml/dumper.d +++ b/source/dyaml/dumper.d @@ -297,7 +297,7 @@ struct Dumper foreach(handle, prefix; tags) { assert(handle.length >= 1 && handle[0] == '!' && handle[$ - 1] == '!', - "A tag handle is empty or does not start and end with a " + "A tag handle is empty or does not start and end with a " ~ "'!' character : " ~ handle); assert(prefix.length >= 1, "A tag prefix is empty"); t ~= TagDirective(handle, prefix); diff --git a/source/dyaml/emitter.d b/source/dyaml/emitter.d index fe5d997..5a047b4 100644 --- a/source/dyaml/emitter.d +++ b/source/dyaml/emitter.d @@ -228,7 +228,7 @@ struct Emitter int popIndent() @trusted { enforce(indents_.length > 0, - new YAMLException("Emitter: Need to pop an indent level but there" + new YAMLException("Emitter: Need to pop an indent level but there" ~ " are no indent levels left")); const result = indents_.back; indents_.length = indents_.length - 1; @@ -490,7 +490,7 @@ struct Emitter } break; default: - throw new Error("Expected Alias, Scalar, SequenceStart or " + throw new Error("Expected Alias, Scalar, SequenceStart or " ~ "MappingStart, but got: " ~ event_.idString); } } diff --git a/source/dyaml/flags.d b/source/dyaml/flags.d index 19e86ca..7d03bb1 100644 --- a/source/dyaml/flags.d +++ b/source/dyaml/flags.d @@ -52,17 +52,17 @@ struct Flags(names ...) if(names.length <= 8) foreach(index, name; names) { string istr = to!string(index); - result ~= "\n" - "@property bool " ~ name ~ "(bool value) pure @safe nothrow\n" - "{\n" - " flags_ = value ? flags_ | (1 <<" ~ istr ~ ")\n" - " : flags_ & (0xFF ^ (1 << " ~ istr ~"));\n" - " return value;\n" - "}\n" - "\n" - "@property bool " ~ name ~ "() const pure @safe nothrow\n" - "{\n" - " return (flags_ >> " ~ istr ~ ") & 1;\n" + result ~= "\n" ~ + "@property bool " ~ name ~ "(bool value) pure @safe nothrow\n" ~ + "{\n" ~ + " flags_ = value ? flags_ | (1 <<" ~ istr ~ ")\n" ~ + " : flags_ & (0xFF ^ (1 << " ~ istr ~"));\n" ~ + " return value;\n" ~ + "}\n" ~ + "\n" ~ + "@property bool " ~ name ~ "() const pure @safe nothrow\n" ~ + "{\n" ~ + " return (flags_ >> " ~ istr ~ ") & 1;\n" ~ "}\n"; } return result; diff --git a/source/dyaml/node.d b/source/dyaml/node.d index 03d4d4d..57e102e 100644 --- a/source/dyaml/node.d +++ b/source/dyaml/node.d @@ -454,7 +454,7 @@ struct Node in { assert(keys.length == values.length, - "Lengths of keys and values arrays to construct " + "Lengths of keys and values arrays to construct " ~ "a YAML node from don't match"); } body diff --git a/source/dyaml/reader.d b/source/dyaml/reader.d index b2a25a4..3cfe69a 100644 --- a/source/dyaml/reader.d +++ b/source/dyaml/reader.d @@ -99,7 +99,7 @@ final class Reader auto endianResult = fixUTFByteOrder(buffer); if(endianResult.bytesStripped > 0) { - throw new ReaderException("Size of UTF-16 or UTF-32 input not aligned " + throw new ReaderException("Size of UTF-16 or UTF-32 input not aligned " ~ "to 2 or 4 bytes, respectively"); } diff --git a/source/dyaml/resolver.d b/source/dyaml/resolver.d index fca505e..9344c7e 100644 --- a/source/dyaml/resolver.d +++ b/source/dyaml/resolver.d @@ -226,33 +226,33 @@ final class Resolver void addImplicitResolvers() @safe { addImplicitResolver("tag:yaml.org,2002:bool", - regex(r"^(?:yes|Yes|YES|no|No|NO|true|True|TRUE" + regex(r"^(?:yes|Yes|YES|no|No|NO|true|True|TRUE" ~ "|false|False|FALSE|on|On|ON|off|Off|OFF)$"), "yYnNtTfFoO"); addImplicitResolver("tag:yaml.org,2002:float", - regex(r"^(?:[-+]?([0-9][0-9_]*)\\.[0-9_]*" - "(?:[eE][-+][0-9]+)?|[-+]?(?:[0-9][0-9_]" - "*)?\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?" - "[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]" - "*|[-+]?\\.(?:inf|Inf|INF)|\\." + regex(r"^(?:[-+]?([0-9][0-9_]*)\\.[0-9_]*" ~ + "(?:[eE][-+][0-9]+)?|[-+]?(?:[0-9][0-9_]" ~ + "*)?\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?" ~ + "[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]" ~ + "*|[-+]?\\.(?:inf|Inf|INF)|\\." ~ "(?:nan|NaN|NAN))$"), "-+0123456789."); addImplicitResolver("tag:yaml.org,2002:int", - regex(r"^(?:[-+]?0b[0-1_]+" - "|[-+]?0[0-7_]+" - "|[-+]?(?:0|[1-9][0-9_]*)" - "|[-+]?0x[0-9a-fA-F_]+" + regex(r"^(?:[-+]?0b[0-1_]+" ~ + "|[-+]?0[0-7_]+" ~ + "|[-+]?(?:0|[1-9][0-9_]*)" ~ + "|[-+]?0x[0-9a-fA-F_]+" ~ "|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$"), "-+0123456789"); addImplicitResolver("tag:yaml.org,2002:merge", regex(r"^<<$"), "<"); addImplicitResolver("tag:yaml.org,2002:null", regex(r"^$|^(?:~|null|Null|NULL)$"), "~nN\0"); addImplicitResolver("tag:yaml.org,2002:timestamp", - regex(r"^[0-9][0-9][0-9][0-9]-[0-9][0-9]-" - "[0-9][0-9]|[0-9][0-9][0-9][0-9]-[0-9]" - "[0-9]?-[0-9][0-9]?[Tt]|[ \t]+[0-9]" - "[0-9]?:[0-9][0-9]:[0-9][0-9]" - "(?:\\.[0-9]*)?(?:[ \t]*Z|[-+][0-9]" + regex(r"^[0-9][0-9][0-9][0-9]-[0-9][0-9]-" ~ + "[0-9][0-9]|[0-9][0-9][0-9][0-9]-[0-9]" ~ + "[0-9]?-[0-9][0-9]?[Tt]|[ \t]+[0-9]" ~ + "[0-9]?:[0-9][0-9]:[0-9][0-9]" ~ + "(?:\\.[0-9]*)?(?:[ \t]*Z|[-+][0-9]" ~ "[0-9]?(?::[0-9][0-9])?)?$"), "0123456789"); addImplicitResolver("tag:yaml.org,2002:value", regex(r"^=$"), "="); diff --git a/source/dyaml/scanner.d b/source/dyaml/scanner.d index 9de772a..fb3d696 100644 --- a/source/dyaml/scanner.d +++ b/source/dyaml/scanner.d @@ -320,7 +320,7 @@ final class Scanner default: if(checkPlain()) { return fetchPlain(); } } - throw new ScannerException("While scanning for the next token, found character " + throw new ScannerException("While scanning for the next token, found character " ~ "\'%s\', index %s that cannot start any token" .format(c, to!int(c)), reader_.mark); } @@ -368,7 +368,7 @@ final class Scanner { // Check if a simple key is required at the current position. const required = (flowLevel_ == 0 && indent_ == reader_.column); - assert(allowSimpleKey_ || !required, "A simple key is required only if it is " + assert(allowSimpleKey_ || !required, "A simple key is required only if it is " ~ "the first token in the current line. Therefore it is always allowed."); if(!allowSimpleKey_) { return; } @@ -1606,7 +1606,7 @@ final class Scanner if(overflow) { error("While scanning a double quoted scalar", startMark, - "overflow when parsing an escape sequence of " + "overflow when parsing an escape sequence of " ~ "hexadecimal numbers.", reader_.mark); return; } @@ -1773,7 +1773,7 @@ final class Scanner reader_.sliceBuilder.finish(); reader_.forward(length); error("While scanning a plain scalar", startMark, - "found unexpected ':' . Please check " + "found unexpected ':' . Please check " ~ "http://pyyaml.org/wiki/YAMLColonInFlowContext for details.", reader_.mark); return Token.init; @@ -2015,7 +2015,7 @@ final class Scanner const dchar c = reader_.peek(k); if(!c.isHexDigit) { - auto msg = expected("URI escape sequence of 2 hexadecimal " + auto msg = expected("URI escape sequence of 2 hexadecimal " ~ "numbers", c); error(contextMsg, startMark, msg, reader_.mark); return;