internal bool IsCursorOnToken(Token t)
{
if(Buffer.Count == 0 && t.StartIndex == 0 && t.EndIndex == 0)
{
// the buffer is empty, return true if we have an empty token
return true;
}
else if(Buffer.Count == 0)
{
// the buffer is empty and the given token is not, throw
throw new ArgumentException("The given token does not appear to be a part of the buffer");
}
// never say that the cursor is on a whitespace token - not sure about this :(
if (string.IsNullOrWhiteSpace(t.Value)) return false;
// the cursor is at a point in the buffer before the current token
if(BufferPosition < t.StartIndex) return false;
// the cursor is pointing at a specific character within the current token
if (BufferPosition <= t.EndIndex) return true;
return false;
}