@@ -43,13 +43,14 @@ def _split_line(self, line, lineno, data_only=False):
43
43
splitter = self ._split_from_pipes
44
44
columnno = 1
45
45
data , sepa = Token .DATA , Token .SEPARATOR
46
- trailing_whitespace = self ._trailing_whitespace .search (line )
47
46
for value , is_data in splitter (line .rstrip ()):
48
47
if is_data or not data_only :
49
48
yield Token (data if is_data else sepa , value , lineno , columnno )
50
49
columnno += len (value )
51
- if trailing_whitespace and not data_only :
52
- yield Token (sepa , trailing_whitespace .group (), lineno , columnno )
50
+ if not data_only :
51
+ trailing_whitespace = re .search (r'\s+$' , line , flags = re .UNICODE )
52
+ if trailing_whitespace :
53
+ yield Token (sepa , trailing_whitespace .group (), lineno , columnno )
53
54
54
55
def _split_from_spaces (self , line ):
55
56
for index , value in enumerate (self ._space_splitter .split (line )):
@@ -101,15 +102,14 @@ def _remove_trailing_empty(self, tokens):
101
102
if not token .value :
102
103
tokens .remove (token )
103
104
elif token .type == token .DATA :
104
- return
105
+ break
105
106
106
107
def _remove_leading_empty (self , tokens ):
107
- # TODO: dropwhile - also above
108
108
for token in list (tokens ):
109
109
if not token .value :
110
110
tokens .remove (token )
111
111
elif token .type in (token .DATA , token .CONTINUATION ):
112
- return
112
+ break
113
113
114
114
def _ensure_data_after_continuation (self , tokens ):
115
115
if not any (t .type == t .DATA for t in tokens ):
0 commit comments