A crazy idea for accurately tracking source position
Alix Pexton via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 17 08:57:08 PDT 2014
Just fixing an obvious typo in my code (that is still incomplete).
====
struct someRange
{
ulong seq;
bool fresh = true;
long line;
dchar front;
// and lets just pretend that there is
// somewhere for more characters to come from!
void popFront()
{
// advance by whatever means to update front.
if (front.isNewline)
{
++line;
fresh = true;
return;
}
if (fresh)
{
if (front.isTab)
{
seq = 0xffff_ffff_ffff_fffeL;
}
else
{
seq = 0x1L;
}
fresh = false;
}
else
{
seq <<= 1;
if (!front.isTab)
{
seq |= 0x1L;
}
}
}
// and the rest...
}
More information about the Digitalmars-d
mailing list