コード例 #1
0
 private int GetPosition(IToken indentationToken)
 {
     if (indentationToken.IsEof())
     {
         // Indention is always 0 for EOF
         return 0;
     }
     else
     {
         // Indention for whitespace tokens must be calculated
         return indentationToken
             .Text
             .AsEnumerable()
             .Select(ch => this.GetWhitespaceLength(ch))
             .TakeWhile(length => length > 0)
             .Sum();
     }
 }
コード例 #2
0
 public bool IsTrigger(IToken token)
 {
     var isFirstInLine = token.CharPositionInLine == 0;
     return isFirstInLine || token.IsEof();
 }
コード例 #3
0
 public bool IsTrigger(IToken token)
 {
     return token.CharPositionInLine == 0
         && !token.IsEof();
 }