3 ms·
I went through and commented the Perl tokeniser (toke.c) back in the late 90s/early 2000s, and my mind was blown by the "is this regular expression syntax invol
by gnat 4y ago
I went through and commented the Perl tokeniser (toke.c) back in the late 90s/early 2000s, and my mind was blown by the "is this regular expression syntax involving $ or is it a variable interpolation involving $"? logic which was basically "here are some things we might have seen, make a weighted sum of which were actually seen and then if it's greater than x, let's assume it is variable interpolation".
You'll note that we were busting that clean separation between tokeniser and parser. Yup, sometimes it's hard to DWIM and still stay in your lane.
Just checked and, thanks to the hard work of far smarter people than myself, the whole thing has been refactored and now the better code has better comments. Progress is wonderful! (I couldn't find the weighted guess, so maybe they found a way to work around it)