replace dyaml.scanner's Array with an Appender

This commit is contained in:
Cameron Ross 2018-06-16 02:18:09 -03:00
parent ccaa7749bb
commit 590f0cfece
No known key found for this signature in database
GPG key ID: 777897D98DC91C54

View file

@ -131,7 +131,7 @@ final class Scanner
/// Current indentation level. /// Current indentation level.
int indent_ = -1; int indent_ = -1;
/// Past indentation levels. Used as a stack. /// Past indentation levels. Used as a stack.
Array!int indents_; Appender!(int[]) indents_;
/// Processed tokens not yet emitted. Used as a queue. /// Processed tokens not yet emitted. Used as a queue.
Queue!Token tokens_; Queue!Token tokens_;
@ -440,9 +440,9 @@ final class Scanner
// In block context, we may need to issue the BLOCK-END tokens. // In block context, we may need to issue the BLOCK-END tokens.
while(indent_ > column) while(indent_ > column)
{ {
indent_ = indents_.back; indent_ = indents_.data.back;
assert(indents_.length); assert(indents_.data.length);
indents_.length = indents_.length - 1; indents_.shrinkTo(indents_.data.length - 1);
tokens_.push(blockEndToken(reader_.mark, reader_.mark)); tokens_.push(blockEndToken(reader_.mark, reader_.mark));
} }
} }