Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add more Symbol._lisp_quoted_specials and test

  • Loading branch information...
commit 3112aff15a838ac435dcbf3e6ac8c2a00ae7259c 1 parent fa50a3c
@tkf authored
Showing with 9 additions and 1 deletion.
  1. +4 −1 sexpdata.py
  2. +5 −0 test_sexpdata.py
View
5 sexpdata.py
@@ -438,7 +438,10 @@ class Symbol(SExpBase):
_lisp_quoted_specials = [
('\\', '\\\\'), # must come first to avoid doubly quoting "\"
- ('"', '\\"'), ('.', '\\.'), (' ', '\\ '),
+ ("'", r"\'"), ("`", r"\`"), ('"', r'\"'),
+ ('(', r'\('), (')', r'\)'), ('[', r'\['), (']', r'\]'),
+ (' ', r'\ '), ('.', r'\.'), (',', r'\,'), ('?', r'\?'),
+ (';', r'\;'), ('#', r'\#'),
]
_lisp_quoted_to_raw = dict((q, r) for (r, q) in _lisp_quoted_specials)
View
5 test_sexpdata.py
@@ -81,6 +81,11 @@ def test_parse_symbol_with_backslash(self):
self.assert_parse(r'path\ join', Symbol(r'path join'))
self.assert_parse(r'path\\join', Symbol(r'path\join'))
+ def test_parse_special_symbols(self):
+ for s in [r'\\', r"\'", r"\`", r'\"', r'\(', r'\)', r'\[', r'\]',
+ r'\ ', r'\.', r'\,', r'\?', r'\;', r'\#']:
+ self.assert_parse(s, Symbol(Symbol.unquote(s)))
+
class TestParseFluctuation(BaseTestCase):
Please sign in to comment.
Something went wrong with that request. Please try again.