offlineimap rev 497
"Automatic Subversion Change Mailer" <[email protected]> Wed, 16 Jul 2003 14:12:13 -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-16 14:11:53 -0500 (Wed, 16 Jul 2003)
New Revision: 497
Modified:
imaplib/head/Makefile
imaplib/head/imap2/__init__.py
imaplib/head/imap2/parser/__init__.py
imaplib/head/imap2/parser/imap.g
imaplib/head/imap2/parser/imap.py
imaplib/head/runtests.py
Log:
Fixed some syntax errors in the parser now that we've imported it.
Added some more infrastructure
Diff:
Modified: imaplib/head/Makefile
==============================================================================
--- imaplib/head/Makefile 2003-07-16 18:58:20 UTC (rev 496)
+++ imaplib/head/Makefile 2003-07-16 19:11:53 UTC (rev 497)
@@ -24,7 +24,7 @@
imap2/parser/imap.py: imap2/parser/imap.g
-rm imap2/parser/imap.py
$(PYTHON) contrib/yapps2/yapps2.py imap2/parser/imap.g
- test -f imap2/parser/imap.py
+ cp contrib/yapps2/yappsrt.py imap2/parser/
clean:
-$(PYTHON) setup.py clean --all
Added: imaplib/head/imap2/__init__.py
==============================================================================
Added: imaplib/head/imap2/parser/__init__.py
==============================================================================
Modified: imaplib/head/imap2/parser/imap.g
==============================================================================
--- imaplib/head/imap2/parser/imap.g 2003-07-16 18:58:20 UTC (rev 496)
+++ imaplib/head/imap2/parser/imap.g 2003-07-16 19:11:53 UTC (rev 497)
@@ -51,7 +51,7 @@
# Defined tokens
token ATOM_CHAR: r'(?![(){ \x00-\x1f\x7f%*"\\\]])[\x01-\x7f]'
- token atom_specials_tok: r'[()}'
+ token atom_specials_tok: r'[()}]'
token base64_char: r'[a-zA-Z0-9+/]'
token base64_char_x2: r'[a-zA-Z0-9+/]{2}'
token base64_char_x3: r'[a-zA-Z0-9+/]{3}'
@@ -66,7 +66,7 @@
token list_wildcards: r'[%*]'
token mailbox_data_tok: r'(?i)(EXISTS|RECENT)'
token mbx_list_sflag: r'(?i)\\(Noselect|Marked|Unmarked)'
- token media_basic_tok: r'(?i)(APPLICATION|AUDIO|IMAGE|MESSAGE|VIDEO'
+ token media_basic_tok: r'(?i)(APPLICATION|AUDIO|IMAGE|MESSAGE|VIDEO)'
token media_message: r'(?i)"MESSAGE" "RFC822"'
token msg_att_static_tok: r'(?i)RFC822(\.HEADER|\.TEXT){0,1}'
token msg_att_static_bodytok: r'(?i)BODY(STRUCTURE){0,1}'
@@ -75,7 +75,7 @@
token QUOTED_CHAR_TOK: r'(?![\n\r"\\])[\x01-\x7f]'
token quoted_specials: r'["\\]'
token resp_cond_auth_tok: r'(?i)(OK|PREAUTH)'
- token resp_cond_state_tok: r'(?i){OK|NO|BAD)'
+ token resp_cond_state_tok: r'(?i)(OK|NO|BAD)'
token resp_specials: r'\]'
token RESP_TEXT_CHAR: r'(?![\n\r\]])[\x01-\x7f]'
token section_msgtext_tok: r'(?i)HEADER(\.FIELDS){0,1}(\.NOT){0,1}'
@@ -84,8 +84,11 @@
token TEXT_CHAR: r'(?![\n\r])[\x01-\x7f]'
+ # ENTRY POINT
+ rule goal: response END
+
# Rules
rule address: LPAREN addr_name SP addr_adl SP addr_mailbox SP addr_host
@@ -137,18 +140,18 @@
)
{{ return v }}
rule body_ext_1part: body_fld_md5 {{ v = {'md5': body_fld_md5, 'extension': []} }}
- [SP body_fld_dsp {{ v['dsp']: body_fld_dsp}}
- [SP body_fld_lang {{ v['lang']: body_fld_lang}}
- [SP body_fld_loc {{ v['loc']: body_fld_loc }}
+ [SP body_fld_dsp {{ v['dsp'] = body_fld_dsp}}
+ [SP body_fld_lang {{ v['lang'] = body_fld_lang}}
+ [SP body_fld_loc {{ v['loc'] = body_fld_loc }}
(SP body_extension {{ v['extension'].append(body_extension)}}) *
]
]
]
{{ return v }}
rule body_ext_mpart: body_fld_param {{ v = {'param': body_fld_param, 'extension': []} }}
- [SP body_fld_dsp {{ v['dsp']: body_fld_dsp }}
- [SP body_fld_lang {{ v['lang']: body_fld_lang}}
- [SP body_fld_loc {{ v['loc']: body_fld_loc}}
+ [SP body_fld_dsp {{ v['dsp'] = body_fld_dsp }}
+ [SP body_fld_lang {{ v['lang'] = body_fld_lang}}
+ [SP body_fld_loc {{ v['loc'] = body_fld_loc}}
(SP body_extension {{ v['extension'].append(body_extension)}} )*
]
]
@@ -188,12 +191,12 @@
[SP body_ext_1part {{v.append(body_ext_1part) }} ]
{{ return v}}
rule body_type_basic: media_basic {{ v = {'media_basic': media_basic} }}
- SP body_fields {{ v['body_fields']: body_fields }}
+ SP body_fields {{ v['body_fields'] = body_fields }}
{{ return v }}
rule body_type_mpart: {{ v_body = []}} (body {{v_body.append(body)}} )+
{{ v = {'body': v_body} }}
- SP media_subtype {{v['media_subtype']: media_subtype}}
- [SP body_ext_mpart {{v['body_ext_mpart']: body_ext_mpart}} ]
+ SP media_subtype {{v['media_subtype'] = media_subtype}}
+ [SP body_ext_mpart {{v['body_ext_mpart'] = body_ext_mpart}} ]
{{ return v }}
rule body_type_msg: media_message SP body_fields SP envelope SP
body SP body_fld_lines
@@ -475,7 +478,7 @@
rule section_part: nz_number {{ v = str(nz_number) }}
(PERIOD nz_number {{ v += '.' + str(nz_number) }})* {{ return v }}
rule section_spec: (section_msgtext {{ v = {'msgtext': section_msgtext} }}
- | section_part {{ v = {'part'}: section_part }}
+ | section_part {{ v = {'part': section_part} }}
[PERIOD section_text {{ v['text'] = section_text}} ]
) {{ return v }}
rule section_text: (section_msgtext {{ v = section_msgtext}}
@@ -508,8 +511,8 @@
rule time: DIGITx2 {{ x = {'hours': DIGITx2} }}
- ":" DIGITx2 {{ x['minutes']= DIGITx2} }}
- ":" DIGITx2 {{ x['seconds']= DIGITx2} }} {{ return x }}
+ ":" DIGITx2 {{ x['minutes']= DIGITx2 }}
+ ":" DIGITx2 {{ x['seconds']= DIGITx2 }} {{ return x }}
##############################
# U
Modified: imaplib/head/imap2/parser/imap.py
==============================================================================
--- imaplib/head/imap2/parser/imap.py 2003-07-16 18:58:20 UTC (rev 496)
+++ imaplib/head/imap2/parser/imap.py 2003-07-16 19:11:53 UTC (rev 497)
@@ -1,5 +1,5 @@
# Implementation of grammar from RFC3501
-# $Id: imap.g 494 2003-07-16 18:38:03Z jgoerzen $
+# $Id: imap.g 495 2003-07-16 18:58:20Z jgoerzen $
# COPYRIGHT #
# Copyright (C) 2002 John Goerzen
@@ -86,7 +86,7 @@
('CRLF', re.compile('\\r\\n')),
('CTL', re.compile('[\\x00-\\x1f\\x7f]')),
('ATOM_CHAR', re.compile('(?![(){ \\x00-\\x1f\\x7f%*"\\\\\\]])[\\x01-\\x7f]')),
- ('atom_specials_tok', re.compile('[()}')),
+ ('atom_specials_tok', re.compile('[()}]')),
('base64_char', re.compile('[a-zA-Z0-9+/]')),
('base64_char_x2', re.compile('[a-zA-Z0-9+/]{2}')),
('base64_char_x3', re.compile('[a-zA-Z0-9+/]{3}')),
@@ -101,7 +101,7 @@
('list_wildcards', re.compile('[%*]')),
('mailbox_data_tok', re.compile('(?i)(EXISTS|RECENT)')),
('mbx_list_sflag', re.compile('(?i)\\\\(Noselect|Marked|Unmarked)')),
- ('media_basic_tok', re.compile('(?i)(APPLICATION|AUDIO|IMAGE|MESSAGE|VIDEO')),
+ ('media_basic_tok', re.compile('(?i)(APPLICATION|AUDIO|IMAGE|MESSAGE|VIDEO)')),
('media_message', re.compile('(?i)"MESSAGE" "RFC822"')),
('msg_att_static_tok', re.compile('(?i)RFC822(\\.HEADER|\\.TEXT){0,1}')),
('msg_att_static_bodytok', re.compile('(?i)BODY(STRUCTURE){0,1}')),
@@ -110,7 +110,7 @@
('QUOTED_CHAR_TOK', re.compile('(?![\\n\\r"\\\\])[\\x01-\\x7f]')),
('quoted_specials', re.compile('["\\\\]')),
('resp_cond_auth_tok', re.compile('(?i)(OK|PREAUTH)')),
- ('resp_cond_state_tok', re.compile('(?i){OK|NO|BAD)')),
+ ('resp_cond_state_tok', re.compile('(?i)(OK|NO|BAD)')),
('resp_specials', re.compile('\\]')),
('RESP_TEXT_CHAR', re.compile('(?![\\n\\r\\]])[\\x01-\\x7f]')),
('section_msgtext_tok', re.compile('(?i)HEADER(\\.FIELDS){0,1}(\\.NOT){0,1}')),
@@ -122,6 +122,10 @@
Scanner.__init__(self,None,[],str)
class IMAP(Parser):
+ def goal(self):
+ response = self.response()
+ END = self._scan('END')
+
def address(self):
LPAREN = self._scan('LPAREN')
addr_name = self.addr_name()
@@ -272,15 +276,15 @@
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_fld_dsp = self.body_fld_dsp()
- v['dsp']: body_fld_dsp
+ v['dsp'] = body_fld_dsp
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_fld_lang = self.body_fld_lang()
- v['lang']: body_fld_lang
+ v['lang'] = body_fld_lang
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_fld_loc = self.body_fld_loc()
- v['loc']: body_fld_loc
+ v['loc'] = body_fld_loc
while self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_extension = self.body_extension()
@@ -293,15 +297,15 @@
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_fld_dsp = self.body_fld_dsp()
- v['dsp']: body_fld_dsp
+ v['dsp'] = body_fld_dsp
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_fld_lang = self.body_fld_lang()
- v['lang']: body_fld_lang
+ v['lang'] = body_fld_lang
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_fld_loc = self.body_fld_loc()
- v['loc']: body_fld_loc
+ v['loc'] = body_fld_loc
while self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_extension = self.body_extension()
@@ -422,7 +426,7 @@
v = {'media_basic': media_basic}
SP = self._scan('SP')
body_fields = self.body_fields()
- v['body_fields']: body_fields
+ v['body_fields'] = body_fields
return v
def body_type_mpart(self):
@@ -434,11 +438,11 @@
v = {'body': v_body}
SP = self._scan('SP')
media_subtype = self.media_subtype()
- v['media_subtype']: media_subtype
+ v['media_subtype'] = media_subtype
if self._peek('SP', 'RPAREN') == 'SP':
SP = self._scan('SP')
body_ext_mpart = self.body_ext_mpart()
- v['body_ext_mpart']: body_ext_mpart
+ v['body_ext_mpart'] = body_ext_mpart
return v
def body_type_msg(self):
@@ -1182,7 +1186,7 @@
v = {'msgtext': section_msgtext}
else: # == 'nz_number_tok'
section_part = self.section_part()
- v = {'part'}: section_part
+ v = {'part': section_part}
if self._peek('PERIOD', 'RBRACKET') == 'PERIOD':
PERIOD = self._scan('PERIOD')
section_text = self.section_text()
@@ -1253,10 +1257,10 @@
x = {'hours': DIGITx2}
self._scan('":"')
self._scan('DIGITx2')
- x['minutes']= DIGITx2}
+ x['minutes']= DIGITx2
self._scan('":"')
self._scan('DIGITx2')
- x['seconds']= DIGITx2}
+ x['seconds']= DIGITx2
return x
def uniqueid(self):
Modified: imaplib/head/runtests.py
==============================================================================
--- imaplib/head/runtests.py 2003-07-16 18:58:20 UTC (rev 496)
+++ imaplib/head/runtests.py 2003-07-16 19:11:53 UTC (rev 497)
@@ -1,5 +1,4 @@
#!/usr/bin/python2.2
-# Python-based gopher server
# Module: main test runner
# COPYRIGHT #
# Copyright (C) 2002 John Goerzen
@@ -22,25 +21,10 @@
# sys.path.insert("-1", "..")
import unittest
-from pygopherd import *
-import pygopherd.protocols
-import pygopherd.protocols.ProtocolMultiplexerTest
-import pygopherd.protocols.baseTest
-import pygopherd.protocols.rfc1436Test
-import pygopherd.protocols
-import pygopherd.handlers.ZIP
+import imap2.parser.imapTest
def suite():
- tests = [initializationTest,
- GopherExceptionsTest,
- fileextTest,
- gopherentryTest,
- loggerTest,
- pipeTest,
- pygopherd.protocols.ProtocolMultiplexerTest,
- pygopherd.protocols.baseTest,
- pygopherd.protocols.rfc1436Test,
- pygopherd.handlers.ZIP
+ tests = [imap2.parser.imapTest \
]
suite = unittest.TestSuite()
for module in tests:
@@ -48,6 +32,6 @@
return suite
if __name__ == '__main__':
- profile.run("unittest.main(defaultTest='suite')", 'profile.out')
-# unittest.main(defaultTest='suite')
+# profile.run("unittest.main(defaultTest='suite')", 'profile.out')
+ unittest.main(defaultTest='suite')