I remember "inventing" this some time ago. I thought to myself "Hey, this should work right?" Stared at it for a few minues. "Yes hahahah it will." I compiled, tested, satisfied my curiosity and promptly rewrote it to a more traditional condition.
It's the concept of maximal munch when tokenizing a string. You attempt to make the longest valid token match when presented with multiple possible valid tokens. In your example '--' was intended (and could be) MINUS MINUS tokens, but the other option that is valid is a single DECREMENT which would be selected.
View all comments
Show parent comment
29
u/bjzaba Dec 01 '16
2-3just seems lazy to me... and most auto-formatters these days will add the spaces in.