From de6c1aacdb100d0fef840abf8fbc849f331ad3ec Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Tue, 29 Jul 2014 03:11:38 +0200 Subject: [PATCH] UTF-8 scanTagHandle. --- source/dyaml/scanner.d | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source/dyaml/scanner.d b/source/dyaml/scanner.d index 57a7a8a..ffdda8d 100644 --- a/source/dyaml/scanner.d +++ b/source/dyaml/scanner.d @@ -1894,6 +1894,37 @@ final class Scanner reader_.sliceBuilder.write(reader_.get(length)); } + void scanTagHandleToSlice8(string name)(const Mark startMark) + @system pure nothrow @nogc + { + dchar c = reader_.peek(); + enum contextMsg = "While scanning a " ~ name; + if(c != '!') + { + error(contextMsg, startMark, expected("'!'", c), reader_.mark); + return; + } + + uint length = 1; + c = reader_.peek(length); + if(c != ' ') + { + while(c.isAlphaNum || "-_"d.canFind(c)) + { + ++length; + c = reader_.peek(length); + } + if(c != '!') + { + reader_.forward(length); + error(contextMsg, startMark, expected("'!'", c), reader_.mark); + return; + } + ++length; + } + + reader_.sliceBuilder8.write(reader_.get8(length)); + } /// Scan URI in a tag token. ///