Commits

david_walker  committed 98cebdd

more indexsplittransform fixes

  • Participants
  • Parent commits e3dbab2

Comments (0)

Files changed (3)

         return result
 
     @property
+    def is_nonspacing_punc(self):
+        """Return True if this token is a punctuation character.
+        """
+        return len(self._str) == 1 and self._str in u',.!?;%'
+
+    @property
     def is_open(self):
         """Return True if this token is any type of opening paren.
         """
 #                self._asterisk_at_bol(token, text) or
                 next_token.str in '-/' or
                 next_token.is_close or
-                next_token.is_punc or
+                next_token.is_nonspacing_punc or
                 next_token.is_eof):
                     append_space = False
             elif token.is_quote:

File transforms.py

             transform_token_index = self.rule.tokens.index(token_to_transform)
             if (self._three_way and
                 self._index < len(token_to_transform.str) - 1):
-                left = Token(token_to_transform.str[:self._index])
+                left = token_to_transform.str[:self._index]
                 middle = token_to_transform.str[self._index]
-                right = Token(token_to_transform.str[self._index + 1:])
+                right = token_to_transform.str[self._index + 1:]
 
                 self.rule.tokens.insert(transform_token_index, Token(left))
                 token_to_transform.str = middle
-                self.rule.tokens.insert(transform_token_index + 2, Token(left))
+                self.rule.tokens.insert(transform_token_index + 2, Token(right))
             else:
                 # split the token string at the supplied character index
                 index = self._index