You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
I'm currently working on an experimental port of the Razor parser to typescript, and on reviewing the tokenizer code, I've noticed what I perceive to be a small error when performing a lookahead.
The Tokenizer.Lookahead method allows you to perform a lookahead operation on the input text document. This is called through either Tokenizer.TakeAll and Tokenizer.At, but its the TakeAll method that passes the takeIfMatch parameter set to true which preserves the existing buffer content while attempting the operation, but I've noticed that you're not actually storing the buffer content. See the following:
// Capture the current buffer content in case we have to backtrack
string oldBuffer = null;
if (takeIfMatch)
{
Buffer.ToString();
}
Later you're then trying to restore the content to the buffer:
if (takeIfMatch)
{
// Clear the buffer and put the old buffer text back
Buffer.Clear();
Buffer.Append(oldBuffer);
}
At this stage, oldBuffer is never assigned, so nothing would be restored to the buffer.
Is this intentional or just an err? Happy to do a PR to correct it if its an issue, but having been in there for quite a while, I'm guessing it's likely not an issue?