             parentheses.push char
           when char == ')' and inDSLParams? and !inString?
             inDSLParams = parentheses.pop()
-            endMatched = !inDSLParams?
+            endMatched = true unless inDSLParams?
           when char.match /'|"/ and inDSLParams? and strings.indexOf(char) < 0
             strings.push(char)
             inString = true
           when char.match /'|"/ and inDSLParams?
-            inString = strings.splice(strings.indexOf(char), 1).length > 0
+            strings.splice(strings.indexOf(char), 1)
+            inString = strings.length > 0
 
       return '' unless fn?
       result = []

        result.push(endWrap) if endMatched?
        result.push char
        result.push(beginWrap) if beginMatched?

      eval "(#{result.join('')});"


        dump.push char
        beginMatched = undefined if beginMatched?
        endMatched = undefined if endMatched?
        inDSLParams = undefined if inDSLParams? and inDSLParams == false
        inString = undefined if inString? and inString == false

        switch
          when dump.buffer() == '.is('
