Scanner style.

This commit is contained in:
Ferdinand Majerech 2014-07-23 02:46:36 +02:00
parent 10120b53c2
commit aadf3232f0

View file

@ -811,7 +811,10 @@ final class Scanner
dstring scanToNextBreak() @safe
{
uint length = 0;
while(!"\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek(length))){++length;}
while(!"\0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek(length)))
{
++length;
}
return reader_.get(length);
}
@ -912,7 +915,7 @@ final class Scanner
enforce(isDigit(reader_.peek()),
new Error("While scanning a directive", startMark,
"expected a digit, but found: " ~
to!string(reader_.peek()), reader_.mark));
reader_.peek().to!string, reader_.mark));
// Already found the first digit in the enforce(), so set length to 1.
uint length = 1;
@ -1461,7 +1464,9 @@ final class Scanner
break;
}
}
return scalarToken(startMark, endMark, to!string(cast(dstring)appender_.data), ScalarStyle.Plain);
return scalarToken(startMark, endMark,
to!string(cast(dstring)appender_.data),
ScalarStyle.Plain);
}
/// Scan spaces in a plain scalar.
@ -1518,7 +1523,7 @@ final class Scanner
dchar c = reader_.peek();
enforce(c == '!',
new Error("While scanning a " ~ name, startMark,
"expected a '!', but found: " ~ to!string(c), reader_.mark));
"expected a '!', but found: " ~ c.to!string, reader_.mark));
uint length = 1;
c = reader_.peek(length);
@ -1533,7 +1538,7 @@ final class Scanner
{
reader_.forward(length);
throw new Error("While scanning a " ~ name, startMark,
"expected a '!', but found: " ~ to!string(c),
"expected a '!', but found: " ~ c.to!string,
reader_.mark);
}
++length;
@ -1568,7 +1573,7 @@ final class Scanner
}
enforce(appender_.data.length > 0,
new Error("While parsing a " ~ name, startMark,
"expected URI, but found: " ~ to!string(c), reader_.mark));
"expected URI, but found: " ~ c.to!string, reader_.mark));
return cast(dstring)appender_.data;
}
@ -1593,7 +1598,7 @@ final class Scanner
new Error("While scanning a " ~ name, startMark,
"expected URI escape sequence of "
"2 hexadecimal numbers, but found: " ~
to!string(c), reader_.mark));
c.to!string, reader_.mark));
uint digit;
if(c - '0' < 10) { digit = c - '0'; }