Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbrzt committed Oct 20, 2014
1 parent 43f7b84 commit 2078ece
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions httpie/input.py
Expand Up @@ -452,8 +452,8 @@ def __call__(self, string):
class Escaped(str):
"""Represents an escaped character."""

def tokenize(s):
"""Tokenize `s`. There are only two token types - strings
def tokenize(string):
"""Tokenize `string`. There are only two token types - strings
and escaped characters:
tokenize(r'foo\=bar\\baz')
Expand All @@ -462,16 +462,16 @@ def tokenize(s):
"""
backslash = '\\'
tokens = ['']
s = iter(s)
for c in s:
if c == backslash:
nc = next(s, '')
if nc in self.special_characters:
tokens.extend([Escaped(nc), ''])
characters = iter(string)
for char in characters:
if char == backslash:
next_char = next(characters, '')
if next_char in self.special_characters:
tokens.extend([Escaped(next_char), ''])
else:
tokens[-1] += c + nc
tokens[-1] += char + next_char
else:
tokens[-1] += c
tokens[-1] += char
return tokens

tokens = tokenize(string)
Expand Down

0 comments on commit 2078ece

Please sign in to comment.