public Token Next() { this.NextTokenIndentMode = TokenIndentMode.None; this.IsStartOfLine = (CurrentToken == null || CurrentToken.Kind == TokenKind.NewLine); ++Index; this.CurrentToken = this.NextToken; this.NextToken = PeekToken(1); this.IsEndOfLine = (CurrentToken.Kind == TokenKind.NewLine || CurrentToken.Kind == TokenKind.EndOfInput || NextToken.Kind == TokenKind.NewLine || NextToken.Kind == TokenKind.EndOfInput); //Set indent level switch (CurrentToken.GetPSTokenType()) { case PSTokenType.GroupStart: { ++IndentLevel; break; } case PSTokenType.GroupEnd: { if (IndentLevel != 0) { --IndentLevel; } break; } } return(this.CurrentToken); }
public int GetIndentLevel() { return((this.IsStartOfLine && CurrentToken.GetPSTokenType() == PSTokenType.GroupStart) ? this.IndentLevel - 1 : this.IndentLevel); }