offlineimap rev 508
"Automatic Subversion Change Mailer" <[email protected]> Thu, 17 Jul 2003 17:12:52 -0500 (CDT)
| Newsgroups | gmane.mail.imap.offlineimap.subversion |
|---|---|
| Message-ID | <[email protected]> |
You are receiving this message because
all commits get sent to this address.
Author: jgoerzen
Date: 2003-07-17 17:12:41 -0500 (Thu, 17 Jul 2003)
New Revision: 508
Modified:
imaplib/head/imap2/parser/grammar.g
imaplib/head/imap2/parser/grammar.py
imaplib/head/imap2/parser/grammarTest.py
Log:
Diff:
Modified: imaplib/head/imap2/parser/grammar.g
==============================================================================
--- imaplib/head/imap2/parser/grammar.g 2003-07-17 16:40:46 UTC (rev 507)
+++ imaplib/head/imap2/parser/grammar.g 2003-07-17 22:12:41 UTC (rev 508)
@@ -26,6 +26,8 @@
parser IMAP:
token END: "$"
+ token CHAR_EIGHT: r'[\x01-\xff]'
+
# custom tokens
@@ -59,7 +61,6 @@
token base64_char_x2: r'[a-zA-Z0-9+/]{2}'
token base64_char_x3: r'[a-zA-Z0-9+/]{3}'
token base64_char_x4: r'[a-zA-Z0-9+/]{4}'
- token CHAR_EIGHT: r'[\x01-\xff]'
token date_day: r'[0-9]{1,2}'
token date_day_fixed: r'[ 0-9][0-9]'
token date_month: r'(?i)(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'
@@ -309,10 +310,10 @@
| list_wildcards {{ v = list_wildcards}}
| resp_specials {{ v = resp_specials }} ) {{ return v }}
rule literal: r'\{' number r'\}' CRLF literal_load<<number>> {{ return literal_load }}
- rule literal_load<<X>>: {{ count = 0 }} {{ data = '' }}
- ( {{ if count == X: break}}
- CHAR_EIGHT {{ count += 1 }} {{ data += CHAR_EIGHT }}
- )*
+ rule literal_load<<X>>: {{ if X == 0: return }}
+ {{ data = '' }}
+ ( CHAR_EIGHT {{ data += CHAR_EIGHT; if len(data) == X): break }} )*
+ {{ assert len(data) == X, "data len is %d, X is %d" % (len(data), X) }}
{{ return data }}
#rule literal_load<<X>>: {{ if X == 0: return '' }}
# {{ data = '' }}
Modified: imaplib/head/imap2/parser/grammar.py
==============================================================================
--- imaplib/head/imap2/parser/grammar.py 2003-07-17 16:40:46 UTC (rev 507)
+++ imaplib/head/imap2/parser/grammar.py 2003-07-17 22:12:41 UTC (rev 508)
@@ -1,5 +1,5 @@
# Implementation of grammar from RFC3501
-# $Id: grammar.g 504 2003-07-17 03:14:29Z jgoerzen $
+# $Id: grammar.g 506 2003-07-17 16:33:45Z jgoerzen $
# COPYRIGHT #
# Copyright (C) 2003 John Goerzen
@@ -65,6 +65,7 @@
('"=="', re.compile('==')),
('"(?i)AUTHENTICATE"', re.compile('(?i)AUTHENTICATE')),
('END', re.compile('$')),
+ ('CHAR_EIGHT', re.compile('[\\x01-\\xff]')),
('LPAREN', re.compile('\\(')),
('RPAREN', re.compile('\\)')),
('PLUS', re.compile('\\+')),
@@ -91,7 +92,6 @@
('base64_char_x2', re.compile('[a-zA-Z0-9+/]{2}')),
('base64_char_x3', re.compile('[a-zA-Z0-9+/]{3}')),
('base64_char_x4', re.compile('[a-zA-Z0-9+/]{4}')),
- ('CHAR_EIGHT', re.compile('[\\x01-\\xff]')),
('date_day', re.compile('[0-9]{1,2}')),
('date_day_fixed', re.compile('[ 0-9][0-9]')),
('date_month', re.compile('(?i)(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)')),
@@ -695,13 +695,12 @@
return literal_load
def literal_load(self, X):
- count = 0
+ if X == 0: return
data = ''
while self._peek('CHAR_EIGHT', 'SP', 'RPAREN', 'END', 'CRLF') == 'CHAR_EIGHT':
- if count == X: break
CHAR_EIGHT = self._scan('CHAR_EIGHT')
- count += 1
- data += CHAR_EIGHT
+ data += CHAR_EIGHT; if len(data) == X): break
+ assert len(data) == X, "data len is %d, X is %d" % (len(data), X)
return data
def mailbox(self):
Modified: imaplib/head/imap2/parser/grammarTest.py
==============================================================================
--- imaplib/head/imap2/parser/grammarTest.py 2003-07-17 16:40:46 UTC (rev 507)
+++ imaplib/head/imap2/parser/grammarTest.py 2003-07-17 22:12:41 UTC (rev 508)
@@ -74,10 +74,10 @@
tests = (
('"Basic Quoted"', 'Basic Quoted'),
('NIL', None),
- ("{5}\r\nTest1", "Test1"),
- ("{7}\r\nTest\r\n1", "Test\r\n1"),
- ("{7}\r\nTest1\r\n", "Test1\r\n"),
- ("{6}\r\nTest\n1", "Test\n1"),
+ ("{5}\r\ntest1", "test1"),
+ ("{7}\r\nTest\r\n2", "Test\r\n2"),
+ ("{7}\r\nTest3\r\n", "Test3\r\n"),
+ ("{6}\r\nTest4\n1", "Test4\n1"),
('""', ""),
("{0}\r\n", ""),
(r'"Quoted with \"Quotes\""', 'Quoted with "Quotes"'),