here is the problem: I have a file with a tab in it, and i'm matching against it piecemeal.
i.e if I go "Match 4 Columns of Whitespace, Match Another 4" and I see "\t", and everything is fine™
the last time i tried to solve this, i did the simple and slow answer: if i do not parse all of a tab stop, store the leftovers in some variables, and when i parse a tab, check the leftovers first.
it's a little clunky and i've been wondering how I can make it easier, and eventually i realise: i do not need to do anything special. i am already doing the right thing, without realising it.
i'm already tracking which column the parser is at in order to calculate the correct tabstop width. that turns out to be everything i need:
when i have a tab, and it's 8 spaces wide, and i only read four of them: i add four to the column. when i read that same tab again, i'm in column+4 and so the tabstop will be 4 columns shorter. the trick to parsing half a tab: increment the column variable, and not the file offset.
i am not sure if i feel very clever for working this out, or very stupid for missing what feels inherently obvious from the outset
edit:
the reason i am doing this? markdown. fucking markdown and four space indents
