added logic for detecting invalid operators & functions, added test for unmatched parens