Note: This is good for stuff like brackets and semicolons, but it probably
should not be used for binary operators like + and - because you can find
yourself in weird situations. For example, is "3--4" a typo? Or is it "3 - -4"?
I have had better luck with chompWhile(isSymbol) and sorting out which
operator it is afterward.
Parse symbols like
(and,.Note: This is good for stuff like brackets and semicolons, but it probably should not be used for binary operators like
+and-because you can find yourself in weird situations. For example, is"3--4"a typo? Or is it"3 - -4"? I have had better luck withchompWhile(isSymbol)and sorting out which operator it is afterward.