On 2/28/2013 10:52 AM, Jonathan M Davis wrote:
Notice that it has to check for empty every time that the front is popped, and it can't avoid that,
Yes it can avoid it - that is the whole point. Notice there are no checks for the sentinel here - but the code is correct:
case '>':
p++;
if (*p == '=')
{ p++;
t->value = TOKge; // >=
}
else if (*p == '>')
{ p++;
if (*p == '=')
{ p++;
t->value = TOKshrass; // >>=
}
else if (*p == '>')
{ p++;
if (*p == '=')
{ p++;
t->value = TOKushrass; // >>>=
}
else
t->value = TOKushr; // >>>
}
else
t->value = TOKshr; // >>
}
else
t->value = TOKgt; // >
return;
