Mercurial > hg > expressionparser
changeset 13:ec0e83ec329f
allow both kinds of strings
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 03 Jun 2011 11:15:40 -0700 |
parents | 835efd8acb04 |
children | facdc089ffbc |
files | expr.py test.py |
diffstat | 2 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/expr.py Fri Jun 03 11:09:08 2011 -0700 +++ b/expr.py Fri Jun 03 11:15:40 2011 -0700 @@ -139,7 +139,7 @@ (r"true|false", bool_), (r"[a-zA-Z_]\w*", identifier), (r"[0-9]+", integer), - (r'"[^"]*"', string_), + (r'("[^"]*")|(\'[^\']*\')', string_), (r"==", eq), (r"!=", neq), (r"\|\|", or_),
--- a/test.py Fri Jun 03 11:09:08 2011 -0700 +++ b/test.py Fri Jun 03 11:15:40 2011 -0700 @@ -13,6 +13,7 @@ self.assertEqual(False, parse("false")) self.assertEqual("", parse('""')) self.assertEqual("foo bar", parse('"foo bar"')) + self.assertEqual("foo bar", parse("'foo bar'")) self.assertEqual(1, parse("foo", foo=1)) self.assertEqual(True, parse("bar", bar=True)) self.assertEqual("xyz", parse("abc123", abc123="xyz"))