Backport aditional rstring fixes
This commit is contained in:
		
							parent
							
								
									268b1571b3
								
							
						
					
					
						commit
						7ea8ba4efc
					
				| @ -12,3 +12,49 @@ diff -ru pycparser-release_v2.14/pycparser/c_lexer.py pycparser-release_v2.14_pa | ||||
|   | ||||
|      def build(self, **kwargs): | ||||
|          """ Builds the lexer from the specification. Must be | ||||
| diff -ru pycparser-release_v2.14/pycparser/c_lexer.py.ply pycparser-release_v2.14_patched/pycparser/c_lexer.py.ply
 | ||||
| --- pycparser-release_v2.14/pycparser/c_lexer.py.ply	2015-06-10 05:00:55.000000000 +0200
 | ||||
| +++ pycparser-release_v2.14_patched/pycparser/c_lexer.py.ply	2019-06-06 15:53:44.972385501 +0200
 | ||||
| @@ -52,8 +52,8 @@
 | ||||
|          # Allow either "# line" or "# <num>" to support GCC's | ||||
|          # cpp output | ||||
|          # | ||||
| -        self.line_pattern = re.compile('([ \t]*line\W)|([ \t]*\d+)')
 | ||||
| -        self.pragma_pattern = re.compile('[ \t]*pragma\W')
 | ||||
| +        self.line_pattern = re.compile(r'([ \t]*line\W)|([ \t]*\d+)')
 | ||||
| +        self.pragma_pattern = re.compile(r'[ \t]*pragma\W')
 | ||||
|   | ||||
|      def build(self, **kwargs): | ||||
|          """ Builds the lexer from the specification. Must be | ||||
| diff -ru pycparser-release_v2.14/tests/test_c_lexer.py pycparser-release_v2.14_patched/tests/test_c_lexer.py
 | ||||
| --- pycparser-release_v2.14/tests/test_c_lexer.py	2015-06-10 05:00:55.000000000 +0200
 | ||||
| +++ pycparser-release_v2.14_patched/tests/test_c_lexer.py	2019-06-10 14:57:24.981643354 +0200
 | ||||
| @@ -403,12 +403,12 @@
 | ||||
|          self.assertLexerError("'b\n", ERR_UNMATCHED_QUOTE) | ||||
|   | ||||
|          self.assertLexerError("'jx'", ERR_INVALID_CCONST) | ||||
| -        self.assertLexerError("'\*'", ERR_INVALID_CCONST)
 | ||||
| +        self.assertLexerError(r"'\*'", ERR_INVALID_CCONST)
 | ||||
|   | ||||
|      def test_string_literals(self): | ||||
| -        self.assertLexerError('"jx\9"', ERR_STRING_ESCAPE)
 | ||||
| -        self.assertLexerError('"hekllo\* on ix"', ERR_STRING_ESCAPE)
 | ||||
| -        self.assertLexerError('L"hekllo\* on ix"', ERR_STRING_ESCAPE)
 | ||||
| +        self.assertLexerError(r'"jx\9"', ERR_STRING_ESCAPE)
 | ||||
| +        self.assertLexerError(r'"hekllo\* on ix"', ERR_STRING_ESCAPE)
 | ||||
| +        self.assertLexerError(r'L"hekllo\* on ix"', ERR_STRING_ESCAPE)
 | ||||
|   | ||||
|      def test_preprocessor(self): | ||||
|          self.assertLexerError('#line "ka"', ERR_FILENAME_BEFORE_LINE) | ||||
| diff -ru pycparser-release_v2.14/tests/test_c_parser.py pycparser-release_v2.14_patched/tests/test_c_parser.py
 | ||||
| --- pycparser-release_v2.14/tests/test_c_parser.py	2015-06-10 05:00:55.000000000 +0200
 | ||||
| +++ pycparser-release_v2.14_patched/tests/test_c_parser.py	2019-06-10 14:58:40.725330566 +0200
 | ||||
| @@ -1637,7 +1637,7 @@
 | ||||
|   | ||||
|          self.assertTrue(isinstance(p.ext[0], Typedef)) | ||||
|          self.assertEqual(p.ext[0].coord.line, 213) | ||||
| -        self.assertEqual(p.ext[0].coord.file, "D:\eli\cpp_stuff\libc_include/stddef.h")
 | ||||
| +        self.assertEqual(p.ext[0].coord.file, r"D:\eli\cpp_stuff\libc_include/stddef.h")
 | ||||
|   | ||||
|          self.assertTrue(isinstance(p.ext[-1], FuncDef)) | ||||
|          self.assertEqual(p.ext[-1].coord.line, 15) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user