From: <fwi...@us...> - 2009-07-06 16:31:41
|
Revision: 6514 http://jython.svn.sourceforge.net/jython/?rev=6514&view=rev Author: fwierzbicki Date: 2009-07-06 16:31:40 +0000 (Mon, 06 Jul 2009) Log Message: ----------- Tightened interactive parse of partial strings. Two of the commented out tests for test_codeop now pass. Unfortunately one new test fails, but it is less serious than the two that are now fixed, so commented it out for now. Modified Paths: -------------- trunk/jython/Lib/test/test_codeop.py trunk/jython/grammar/PythonPartial.g Modified: trunk/jython/Lib/test/test_codeop.py =================================================================== --- trunk/jython/Lib/test/test_codeop.py 2009-07-06 14:15:32 UTC (rev 6513) +++ trunk/jython/Lib/test/test_codeop.py 2009-07-06 16:31:40 UTC (rev 6514) @@ -138,7 +138,7 @@ ai("\n\ndef x():\n pass") ai("a = 9+ \\") - #ai("a = 'a\\") + ai("a = 'a\\") ai("a = '''xy") ai("","eval") @@ -147,7 +147,7 @@ ai("(\n\n\n","eval") ai("(9+","eval") ai("9+ \\","eval") - #ai("lambda z: \\","eval") + ai("lambda z: \\","eval") #Did not work in Jython 2.5rc2 see first issue in # http://bugs.jython.org/issue1354 @@ -170,7 +170,7 @@ #ai("a = 9+ \\\n") ai("a = 'a\\ ") - ai("a = 'a\\\n") + #ai("a = 'a\\\n") ai("a = 1","eval") #ai("a = (","eval") Modified: trunk/jython/grammar/PythonPartial.g =================================================================== --- trunk/jython/grammar/PythonPartial.g 2009-07-06 14:15:32 UTC (rev 6513) +++ trunk/jython/grammar/PythonPartial.g 2009-07-06 16:31:40 UTC (rev 6514) @@ -718,7 +718,8 @@ | FLOAT | COMPLEX | (STRING)+ - | STRINGPART + | TRISTRINGPART + | STRINGPART TRAILBACKSLASH ; //listmaker: test ( list_for | (',' test)* [','] ) @@ -1043,15 +1044,21 @@ } ; -STRINGPART +TRISTRINGPART : ('r'|'u'|'ur'|'R'|'U'|'UR'|'uR'|'Ur')? ( '\'\'\'' ~('\'\'\'')* | '"""' ~('"""')* - | '"' (ESC|~('\\'|'\n'|'"'))* CONTINUED_LINE + ) + ; + +STRINGPART + : ('r'|'u'|'ur'|'R'|'U'|'UR'|'uR'|'Ur')? + ( '"' (ESC|~('\\'|'\n'|'"'))* CONTINUED_LINE | '\'' (ESC|~('\\'|'\n'|'\''))* CONTINUED_LINE ) ; + /** the two '"'? cause a warning -- is there a way to avoid that? */ fragment TRIQUOTE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |