benjamin-hodgson/Pidgin

Getting current position in 3.x

Closed this issue · 4 comments

I noticed that the 2.x versions have CurrentPos as a way to get the current position. Does a similar facility exist in 3.x?

Also seeing that CurrentPos is internal right now. Is this my best option for the time being?

public class Position : Parser<char, int>
{
    public override bool TryParse(ref ParseState<char> state, ref PooledList<Expected<char>> expecteds, out int result)
    {
        result = state.Location;

        return true;
    }
}

Ah perfect, I just needed to do using static Pidgin.Parser<char>;

Thank you! This library is incredible.

Thanks! ❤️