in src/PSDocs/Common/ObjectHelper.cs [70:112]
public int IndexOf(out NameTokenType tokenType)
{
tokenType = Position == 0 && Current == Separator ? NameTokenType.Self : NameTokenType.Field;
if (tokenType == NameTokenType.Self)
return Position;
while (Position < Last)
{
Position++;
Current = Name[Position];
if (inQuote)
{
if (Current == Quoted)
{
inQuote = false;
return Position - 1;
}
}
else if (Current == Separator)
{
return Position - 1;
}
else if (inIndex)
{
if (Current == CloseIndex)
{
tokenType = NameTokenType.Index;
inIndex = false;
return Position - 1;
}
}
else if (Current == OpenIndex)
{
// Next token will be an Index
inIndex = true;
// Return end of token
return Position - 1;
}
}
return Position;
}