offlineimap rev 501
"Automatic Subversion Change Mailer" <[email protected]> Wed, 16 Jul 2003 14:55:55 -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:55:40 -0500 (Wed, 16 Jul 2003)
New Revision: 501
Modified:
imaplib/head/Makefile
imaplib/head/imap2/parser/GrammarClass.py
imaplib/head/imap2/parser/grammar.py
imaplib/head/runtests.py
Log:
More tweaking of tests
Diff:
Modified: imaplib/head/Makefile
==============================================================================
--- imaplib/head/Makefile 2003-07-16 19:42:50 UTC (rev 500)
+++ imaplib/head/Makefile 2003-07-16 19:55:40 UTC (rev 501)
@@ -21,9 +21,9 @@
parser: imap2/parser/imap.py
-imap2/parser/imap.py: imap2/parser/imap.g
- -rm imap2/parser/imap.py
- $(PYTHON) contrib/yapps2/yapps2.py imap2/parser/imap.g
+imap2/parser/imap.py: imap2/parser/grammar.g
+ -rm imap2/parser/grammar.py
+ $(PYTHON) contrib/yapps2/yapps2.py imap2/parser/grammar.g
cp contrib/yapps2/yappsrt.py imap2/parser/
clean:
Modified: imaplib/head/imap2/parser/GrammarClass.py
==============================================================================
--- imaplib/head/imap2/parser/GrammarClass.py 2003-07-16 19:42:50 UTC (rev 500)
+++ imaplib/head/imap2/parser/GrammarClass.py 2003-07-16 19:55:40 UTC (rev 501)
@@ -19,8 +19,31 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# END OF COPYRIGHT #
-import grammar
+import grammar, yappsrt, sys
+from StringIO import StringIO
+
def parse(rule, text):
P = grammar.IMAP(grammar.IMAPScanner(text))
- getattr(P, rule)()
+ savedstdout = sys.stdout
+ try:
+ try:
+ return getattr(P, rule)()
+ except yappsrt.SyntaxError, s:
+ input = P._scanner.input
+ #try:
+ fd = StringIO()
+ sys.stdout = fd
+ yappsrt.print_error(input, s, P._scanner)
+ sys.stdout = savedstdout
+ raise SyntaxError, fd.getvalue()
+ #except:
+ # print 'Syntax Error',s.msg,'on line',1+count(input[:s.pos], '\n')
+
+ #raise
+ except yappsrt.NoMoreTokens:
+ raise yappsrt.NoMoreTokens, 'Could not complete parsing; stopped around here: ' \
+ + str(P._scanner)
+ finally:
+ sys.stdout = savedstdout
+
Modified: imaplib/head/imap2/parser/grammar.py
==============================================================================
--- imaplib/head/imap2/parser/grammar.py 2003-07-16 19:42:50 UTC (rev 500)
+++ imaplib/head/imap2/parser/grammar.py 2003-07-16 19:55:40 UTC (rev 501)
@@ -1,5 +1,5 @@
# Implementation of grammar from RFC3501
-# $Id: imap.g 496 2003-07-16 19:11:53Z jgoerzen $
+# $Id: grammar.g 491 2003-07-16 19:38:49Z jgoerzen $
# COPYRIGHT #
# Copyright (C) 2002 John Goerzen
Modified: imaplib/head/runtests.py
==============================================================================
--- imaplib/head/runtests.py 2003-07-16 19:42:50 UTC (rev 500)
+++ imaplib/head/runtests.py 2003-07-16 19:55:40 UTC (rev 501)
@@ -24,7 +24,7 @@
import imap2.parser.grammarTest
def suite():
- tests = [imap2.parser.imapTest \
+ tests = [imap2.parser.grammarTest \
]
suite = unittest.TestSuite()
for module in tests: