Replaced 'in' by 'const' in exception, scanner.
This commit is contained in:
parent
163b3c9d54
commit
f33918748a
|
@ -38,7 +38,7 @@ struct Mark
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///Construct a Mark with specified line and column in the file.
|
///Construct a Mark with specified line and column in the file.
|
||||||
this(in uint line, in uint column) pure @safe nothrow
|
this(const uint line, const uint column) pure @safe nothrow
|
||||||
{
|
{
|
||||||
line_ = cast(ushort)min(ushort.max, line);
|
line_ = cast(ushort)min(ushort.max, line);
|
||||||
column_ = cast(ushort)min(ushort.max, column);
|
column_ = cast(ushort)min(ushort.max, column);
|
||||||
|
|
|
@ -182,7 +182,7 @@ final class Scanner
|
||||||
* or if there are any tokens left if no types specified.
|
* or if there are any tokens left if no types specified.
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
bool checkToken(in TokenID[] ids ...) @safe
|
bool checkToken(const TokenID[] ids ...) @safe
|
||||||
{
|
{
|
||||||
//Check if the next token is one of specified types.
|
//Check if the next token is one of specified types.
|
||||||
while(needMoreTokens()){fetchToken();}
|
while(needMoreTokens()){fetchToken();}
|
||||||
|
@ -379,7 +379,7 @@ final class Scanner
|
||||||
*
|
*
|
||||||
* Params: column = Current column in the file/stream.
|
* Params: column = Current column in the file/stream.
|
||||||
*/
|
*/
|
||||||
void unwindIndent(in int column) @trusted
|
void unwindIndent(const int column) @trusted
|
||||||
{
|
{
|
||||||
if(flowLevel_ > 0)
|
if(flowLevel_ > 0)
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan a string of alphanumeric or "-_" characters.
|
///Scan a string of alphanumeric or "-_" characters.
|
||||||
dstring scanAlphaNumeric(string name)(in Mark startMark) @trusted
|
dstring scanAlphaNumeric(string name)(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
uint length = 0;
|
uint length = 0;
|
||||||
dchar c = reader_.peek();
|
dchar c = reader_.peek();
|
||||||
|
@ -873,7 +873,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan name of a directive token.
|
///Scan name of a directive token.
|
||||||
dstring scanDirectiveName(in Mark startMark) @trusted
|
dstring scanDirectiveName(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
//Scan directive name.
|
//Scan directive name.
|
||||||
const name = scanAlphaNumeric!"a directive"(startMark);
|
const name = scanAlphaNumeric!"a directive"(startMark);
|
||||||
|
@ -886,7 +886,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan value of a YAML directive token. Returns major, minor version separated by '.'.
|
///Scan value of a YAML directive token. Returns major, minor version separated by '.'.
|
||||||
dstring scanYAMLDirectiveValue(in Mark startMark) @trusted
|
dstring scanYAMLDirectiveValue(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
findNextNonSpace();
|
findNextNonSpace();
|
||||||
|
|
||||||
|
@ -907,7 +907,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan a number from a YAML directive.
|
///Scan a number from a YAML directive.
|
||||||
dstring scanYAMLDirectiveNumber(in Mark startMark) @trusted
|
dstring scanYAMLDirectiveNumber(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
enforce(isDigit(reader_.peek()),
|
enforce(isDigit(reader_.peek()),
|
||||||
new Error("While scanning a directive", startMark,
|
new Error("While scanning a directive", startMark,
|
||||||
|
@ -922,7 +922,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan value of a tag directive.
|
///Scan value of a tag directive.
|
||||||
dstring scanTagDirectiveValue(in Mark startMark) @safe
|
dstring scanTagDirectiveValue(const Mark startMark) @safe
|
||||||
{
|
{
|
||||||
findNextNonSpace();
|
findNextNonSpace();
|
||||||
const handle = scanTagDirectiveHandle(startMark);
|
const handle = scanTagDirectiveHandle(startMark);
|
||||||
|
@ -931,7 +931,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan handle of a tag directive.
|
///Scan handle of a tag directive.
|
||||||
dstring scanTagDirectiveHandle(in Mark startMark) @trusted
|
dstring scanTagDirectiveHandle(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
const value = scanTagHandle("directive", startMark);
|
const value = scanTagHandle("directive", startMark);
|
||||||
enforce(reader_.peek() == ' ',
|
enforce(reader_.peek() == ' ',
|
||||||
|
@ -942,7 +942,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan prefix of a tag directive.
|
///Scan prefix of a tag directive.
|
||||||
dstring scanTagDirectivePrefix(in Mark startMark) @trusted
|
dstring scanTagDirectivePrefix(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
const value = scanTagURI("directive", startMark);
|
const value = scanTagURI("directive", startMark);
|
||||||
enforce(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()),
|
enforce(" \0\n\r\u0085\u2028\u2029"d.canFind(reader_.peek()),
|
||||||
|
@ -954,7 +954,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan (and ignore) ignored line after a directive.
|
///Scan (and ignore) ignored line after a directive.
|
||||||
void scanDirectiveIgnoredLine(in Mark startMark) @trusted
|
void scanDirectiveIgnoredLine(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
findNextNonSpace();
|
findNextNonSpace();
|
||||||
if(reader_.peek() == '#'){scanToNextBreak();}
|
if(reader_.peek() == '#'){scanToNextBreak();}
|
||||||
|
@ -1061,7 +1061,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan a block scalar token with specified style.
|
///Scan a block scalar token with specified style.
|
||||||
Token scanBlockScalar(in ScalarStyle style) @system
|
Token scanBlockScalar(const ScalarStyle style) @system
|
||||||
{
|
{
|
||||||
const startMark = reader_.mark;
|
const startMark = reader_.mark;
|
||||||
|
|
||||||
|
@ -1142,7 +1142,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan chomping and indentation indicators of a scalar token.
|
///Scan chomping and indentation indicators of a scalar token.
|
||||||
Tuple!(Chomping, int) scanBlockScalarIndicators(in Mark startMark) @trusted
|
Tuple!(Chomping, int) scanBlockScalarIndicators(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
auto chomping = Chomping.Clip;
|
auto chomping = Chomping.Clip;
|
||||||
int increment = int.min;
|
int increment = int.min;
|
||||||
|
@ -1185,7 +1185,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan (and ignore) ignored line in a block scalar.
|
///Scan (and ignore) ignored line in a block scalar.
|
||||||
void scanBlockScalarIgnoredLine(in Mark startMark) @trusted
|
void scanBlockScalarIgnoredLine(const Mark startMark) @trusted
|
||||||
{
|
{
|
||||||
findNextNonSpace();
|
findNextNonSpace();
|
||||||
if(reader_.peek == '#'){scanToNextBreak();}
|
if(reader_.peek == '#'){scanToNextBreak();}
|
||||||
|
@ -1220,7 +1220,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan line breaks at lower or specified indentation in a block scalar.
|
///Scan line breaks at lower or specified indentation in a block scalar.
|
||||||
Tuple!(dchar[], Mark) scanBlockScalarBreaks(in uint indent) @safe
|
Tuple!(dchar[], Mark) scanBlockScalarBreaks(const uint indent) @safe
|
||||||
{
|
{
|
||||||
dchar[] chunks;
|
dchar[] chunks;
|
||||||
Mark endMark = reader_.mark;
|
Mark endMark = reader_.mark;
|
||||||
|
@ -1237,7 +1237,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan a qouted flow scalar token with specified quotes.
|
///Scan a qouted flow scalar token with specified quotes.
|
||||||
Token scanFlowScalar(in ScalarStyle quotes) @system
|
Token scanFlowScalar(const ScalarStyle quotes) @system
|
||||||
{
|
{
|
||||||
const startMark = reader_.mark;
|
const startMark = reader_.mark;
|
||||||
const quote = reader_.get();
|
const quote = reader_.get();
|
||||||
|
@ -1259,7 +1259,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan nonspace characters in a flow scalar.
|
///Scan nonspace characters in a flow scalar.
|
||||||
void scanFlowScalarNonSpaces(in ScalarStyle quotes, in Mark startMark) @system
|
void scanFlowScalarNonSpaces(const ScalarStyle quotes, const Mark startMark) @system
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -1346,7 +1346,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan space characters in a flow scalar.
|
///Scan space characters in a flow scalar.
|
||||||
void scanFlowScalarSpaces(in Mark startMark) @system
|
void scanFlowScalarSpaces(const Mark startMark) @system
|
||||||
{
|
{
|
||||||
uint length = 0;
|
uint length = 0;
|
||||||
while(" \t"d.canFind(reader_.peek(length))){++length;}
|
while(" \t"d.canFind(reader_.peek(length))){++length;}
|
||||||
|
@ -1374,7 +1374,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan line breaks in a flow scalar.
|
///Scan line breaks in a flow scalar.
|
||||||
dstring scanFlowScalarBreaks(in Mark startMark) @system
|
dstring scanFlowScalarBreaks(const Mark startMark) @system
|
||||||
{
|
{
|
||||||
auto appender = appender!dstring();
|
auto appender = appender!dstring();
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -1464,7 +1464,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan spaces in a plain scalar.
|
///Scan spaces in a plain scalar.
|
||||||
dstring scanPlainSpaces(in Mark startMark) @system
|
dstring scanPlainSpaces(const Mark startMark) @system
|
||||||
{
|
{
|
||||||
///The specification is really confusing about tabs in plain scalars.
|
///The specification is really confusing about tabs in plain scalars.
|
||||||
///We just forbid them completely. Do not use tabs in YAML!
|
///We just forbid them completely. Do not use tabs in YAML!
|
||||||
|
@ -1512,7 +1512,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan handle of a tag token.
|
///Scan handle of a tag token.
|
||||||
dstring scanTagHandle(const string name, in Mark startMark) @system
|
dstring scanTagHandle(const string name, const Mark startMark) @system
|
||||||
{
|
{
|
||||||
dchar c = reader_.peek();
|
dchar c = reader_.peek();
|
||||||
enforce(c == '!',
|
enforce(c == '!',
|
||||||
|
@ -1541,7 +1541,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan URI in a tag token.
|
///Scan URI in a tag token.
|
||||||
dstring scanTagURI(const string name, in Mark startMark) @system
|
dstring scanTagURI(const string name, const Mark startMark) @system
|
||||||
{
|
{
|
||||||
//Note: we do not check if URI is well-formed.
|
//Note: we do not check if URI is well-formed.
|
||||||
//Using appender_, so clear it when we're done.
|
//Using appender_, so clear it when we're done.
|
||||||
|
@ -1573,7 +1573,7 @@ final class Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scan URI escape sequences.
|
///Scan URI escape sequences.
|
||||||
dstring scanURIEscapes(const string name, in Mark startMark) @system
|
dstring scanURIEscapes(const string name, const Mark startMark) @system
|
||||||
{
|
{
|
||||||
ubyte[] bytes;
|
ubyte[] bytes;
|
||||||
Mark mark = reader_.mark;
|
Mark mark = reader_.mark;
|
||||||
|
|
Loading…
Reference in a new issue