More @safe pure nothrow @nogc in Scanner.

This commit is contained in:
Ferdinand Majerech 2014-07-23 02:47:46 +02:00
parent aadf3232f0
commit 8a378471e6

View file

@ -783,13 +783,13 @@ final class Scanner
}
/// Move to the next non-space character.
void findNextNonSpace() @safe
void findNextNonSpace() @safe pure nothrow @nogc
{
while(reader_.peek() == ' ') { reader_.forward(); }
}
/// Scan a string of alphanumeric or "-_" characters.
dstring scanAlphaNumeric(string name)(const Mark startMark) @trusted
dstring scanAlphaNumeric(string name)(const Mark startMark) @safe pure
{
uint length = 0;
dchar c = reader_.peek();
@ -807,8 +807,8 @@ final class Scanner
return reader_.get(length);
}
///Scan all characters until nex line break.
dstring scanToNextBreak() @safe
/// Scan all characters until next line break.
dstring scanToNextBreak() @safe pure nothrow @nogc
{
uint length = 0;
while(!"\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek(length)))
@ -910,7 +910,7 @@ final class Scanner
}
/// Scan a number from a YAML directive.
dstring scanYAMLDirectiveNumber(const Mark startMark) @trusted
dstring scanYAMLDirectiveNumber(const Mark startMark) @safe pure
{
enforce(isDigit(reader_.peek()),
new Error("While scanning a directive", startMark,
@ -1403,7 +1403,7 @@ final class Scanner
}
/// Scan plain scalar token (no block, no quotes).
Token scanPlain() @system
Token scanPlain() @system pure
{
// We keep track of the allowSimpleKey_ flag here.
// Indentation rules are loosed for the flow context
@ -1470,7 +1470,7 @@ final class Scanner
}
/// Scan spaces in a plain scalar.
dstring scanPlainSpaces(const Mark startMark) @system
dstring scanPlainSpaces(const Mark startMark) @safe pure nothrow
{
// The specification is really confusing about tabs in plain scalars.
// We just forbid them completely. Do not use tabs in YAML!
@ -1486,7 +1486,7 @@ final class Scanner
const lineBreak = scanLineBreak();
allowSimpleKey_ = true;
static bool end(Reader reader)
static bool end(Reader reader) nothrow
{
return ["---"d, "..."d].canFind(reader.prefix(3)) &&
" \t\0\n\r\u0085\u2028\u2029"d.canFind(reader.peek(3));
@ -1518,7 +1518,7 @@ final class Scanner
}
/// Scan handle of a tag token.
dstring scanTagHandle(const string name, const Mark startMark) @system
dstring scanTagHandle(const string name, const Mark startMark) @safe pure
{
dchar c = reader_.peek();
enforce(c == '!',
@ -1547,7 +1547,7 @@ final class Scanner
}
/// Scan URI in a tag token.
dstring scanTagURI(const string name, const Mark startMark) @system
dstring scanTagURI(const string name, const Mark startMark) @system pure
{
// Note: we do not check if URI is well-formed.
// Using appender_, so clear it when we're done.
@ -1579,7 +1579,7 @@ final class Scanner
}
/// Scan URI escape sequences.
dstring scanURIEscapes(const string name, const Mark startMark) @system
dstring scanURIEscapes(const string name, const Mark startMark) @system pure
{
ubyte[] bytes;
Mark mark = reader_.mark;
@ -1635,7 +1635,7 @@ final class Scanner
/// '\u2028' : '\u2028'
/// '\u2029 : '\u2029'
/// no break : '\0'
dchar scanLineBreak() @safe
dchar scanLineBreak() @safe pure nothrow @nogc
{
const c = reader_.peek();