aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-12 21:47:58 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-12 21:47:58 +0000
commitbd4fa2efd373c46dc14b87744b908f16f539c836 (patch)
treeb764373e0bedec4cb35edc02916c8b483eebba13
parent52f8dff671280dc13143ba2a5d09d2da243cbb0a (diff)
downloadexternal_llvm-bd4fa2efd373c46dc14b87744b908f16f539c836.zip
external_llvm-bd4fa2efd373c46dc14b87744b908f16f539c836.tar.gz
external_llvm-bd4fa2efd373c46dc14b87744b908f16f539c836.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103652 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/lit/lit/ShUtil.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/lit/lit/ShUtil.py b/utils/lit/lit/ShUtil.py
index c8f9332..dda622a 100644
--- a/utils/lit/lit/ShUtil.py
+++ b/utils/lit/lit/ShUtil.py
@@ -67,6 +67,9 @@ class ShLexer:
elif c == '"':
self.eat()
str += self.lex_arg_quoted('"')
+ elif c == "'":
+ self.eat()
+ str += self.lex_arg_quoted("'")
elif not self.win32Escapes and c == '\\':
# Outside of a string, '\\' escapes everything.
self.eat()
@@ -287,6 +290,10 @@ class TestShParse(unittest.TestCase):
Pipeline([Command(['echo', 'hello'], [])], False))
self.assertEqual(self.parse('echo ""'),
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):
self.assertEqual(self.parse('echo hello > c'),