Fixes special case for chained logical operators

When writing something like "1 and 2 and 3" or "not not not 0", commas
are erroneously inserted.  This commit corrects these cases.