Changeset 144:f644601710b1 for imapclient
- Timestamp:
- 04/29/10 22:49:35 (2 years ago)
- Branch:
- default
- Files:
-
- 1 modified
-
imapclient/response_parser.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
imapclient/response_parser.py
r142 r144 141 141 142 142 def read(self, n): 143 # We also hack into the lexer so we get special treatment for '\\' 144 # chars - they are only special inside a quoted string. 143 # Two additional hacks: 144 # 1. Hack into the lexer so we get special treatment for backslash 145 # chars - they are only special inside a quoted string. 146 # 2. For quoted strings return the quotes around the string so 147 # that atom() can distinguish numbers from strings. Eg. "123" vs 123. 148 # These are stripped off before returning them to the user. 145 149 assert n==1 146 150 if self.pushed is not None: … … 149 153 else: 150 154 ret = self.src.read(n) 151 if ret =="\\" and self.lexer.state not in '"\\':155 if ret == "\\" and self.lexer.state not in '"\\': 152 156 self.pushed = "\\" 157 elif ret == '"' and self.lexer.state != '\\': 158 self.lexer.token += '"' 153 159 return ret 154 160 … … 208 214 literal_len, len(literal_text))) 209 215 return literal_text 216 elif len(token) >= 2 and (token[0] == token[-1] == '"'): 217 return token[1:-1] 210 218 elif token.isdigit(): 211 219 return int(token)
