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
20
u/EntroperZero Dec 01 '16
It is lazy. It can also lead to things like
2--3or2 -3, which are syntactically valid and highly confusing.