mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
lit: Fix a sh lexing bug which caused annotate-token.m to fail when run with the
internal shell parser; we weren't lexing the quotes in a command like:: clang -DFOO='hello' correctly. llvm-svn: 103652
This commit is contained in:
parent
e8f8a29de5
commit
8578537b17
@ -67,6 +67,9 @@ class ShLexer:
|
|||||||
elif c == '"':
|
elif c == '"':
|
||||||
self.eat()
|
self.eat()
|
||||||
str += self.lex_arg_quoted('"')
|
str += self.lex_arg_quoted('"')
|
||||||
|
elif c == "'":
|
||||||
|
self.eat()
|
||||||
|
str += self.lex_arg_quoted("'")
|
||||||
elif not self.win32Escapes and c == '\\':
|
elif not self.win32Escapes and c == '\\':
|
||||||
# Outside of a string, '\\' escapes everything.
|
# Outside of a string, '\\' escapes everything.
|
||||||
self.eat()
|
self.eat()
|
||||||
@ -287,6 +290,10 @@ class TestShParse(unittest.TestCase):
|
|||||||
Pipeline([Command(['echo', 'hello'], [])], False))
|
Pipeline([Command(['echo', 'hello'], [])], False))
|
||||||
self.assertEqual(self.parse('echo ""'),
|
self.assertEqual(self.parse('echo ""'),
|
||||||
Pipeline([Command(['echo', ''], [])], False))
|
Pipeline([Command(['echo', ''], [])], False))
|
||||||
|
self.assertEqual(self.parse("""echo -DFOO='a'"""),
|
||||||
|
Pipeline([Command(['echo', '-DFOO=a'], [])], False))
|
||||||
|
self.assertEqual(self.parse('echo -DFOO="a"'),
|
||||||
|
Pipeline([Command(['echo', '-DFOO=a'], [])], False))
|
||||||
|
|
||||||
def test_redirection(self):
|
def test_redirection(self):
|
||||||
self.assertEqual(self.parse('echo hello > c'),
|
self.assertEqual(self.parse('echo hello > c'),
|
||||||
|
Loading…
Reference in New Issue
Block a user