From c580bcab7ab0eb19a43eef1f98bd3019dc6e3042 Mon Sep 17 00:00:00 2001 From: Smit Hinsu Date: Thu, 23 Aug 2018 19:52:45 -0700 Subject: [PATCH 1/2] Handle docstring in raw format in main source file --- compiler/python_archive.py | 3 ++- compiler/python_archive_test.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/python_archive.py b/compiler/python_archive.py index fc810c6..42c1677 100755 --- a/compiler/python_archive.py +++ b/compiler/python_archive.py @@ -64,7 +64,8 @@ ('[^'].*?') | # module doc comment form 1 ("[^"].*?") | # module doc comment form 2 (\'\'\'.*?(\'\'\')) | # module doc comment form 3 - (""".*?""") # module doc comment form 4 + (""".*?""") | # module doc comment form 4 + (r""".*?""") # module doc comment form 4 ) [\\r\\n]+ # end of line(s) for Mac, Unix and/or Windows )* diff --git a/compiler/python_archive_test.py b/compiler/python_archive_test.py index b918399..4d819ed 100644 --- a/compiler/python_archive_test.py +++ b/compiler/python_archive_test.py @@ -170,6 +170,8 @@ def test_generate_main(self): b"'''Triple-single-quote module \"'\n\n docstring'''\nBOILERPLATE\n"), (b'"""Triple-double-quote module "\'\n\n docstring"""\n', b'"""Triple-double-quote module "\'\n\n docstring"""\nBOILERPLATE\n'), + (b'r"""Triple-double-quote module "\'\n\n raw docstring"""\n', + b'r"""Triple-double-quote module "\'\n\n raw docstring"""\nBOILERPLATE\n'), ] for main_content, expected in cases: with test_utils.temp_file(main_content) as main_file: From 8b4ac7a91560e793afe73eb8b813c5676aec3072 Mon Sep 17 00:00:00 2001 From: Smit Hinsu <1990079+smit-hinsu@users.noreply.github.com> Date: Thu, 23 Aug 2018 20:00:21 -0700 Subject: [PATCH 2/2] Update python_archive.py --- compiler/python_archive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/python_archive.py b/compiler/python_archive.py index 42c1677..167c314 100755 --- a/compiler/python_archive.py +++ b/compiler/python_archive.py @@ -65,7 +65,7 @@ ("[^"].*?") | # module doc comment form 2 (\'\'\'.*?(\'\'\')) | # module doc comment form 3 (""".*?""") | # module doc comment form 4 - (r""".*?""") # module doc comment form 4 + (r""".*?""") # module doc comment form 5 ) [\\r\\n]+ # end of line(s) for Mac, Unix and/or Windows )*