diff options
author | Simon Kelly <skelly@dimagi.com> | 2018-07-30 18:52:08 +0200 |
---|---|---|
committer | Simon Kelly <skelly@dimagi.com> | 2018-07-30 18:52:08 +0200 |
commit | ce9d41bb5ee83e7cf6322aec52a33987e1997b5f (patch) | |
tree | c4fc924e3b44315d564b15e13bff4c6b76be9c58 | |
parent | 2ceae1039208973e9fe1588011c902e231144efe (diff) | |
download | jsonpath-rw-ce9d41bb5ee83e7cf6322aec52a33987e1997b5f.tar.gz |
Revert "allow # in IDs"
This reverts commit 1310c0c63d3db1ff3eea36501f7d68958eae5f8b.
-rw-r--r-- | jsonpath_rw/lexer.py | 2 | ||||
-rw-r--r-- | tests/test_lexer.py | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/jsonpath_rw/lexer.py b/jsonpath_rw/lexer.py index b85b425..aa28ff5 100644 --- a/jsonpath_rw/lexer.py +++ b/jsonpath_rw/lexer.py @@ -61,7 +61,7 @@ class JsonPathLexer(object): t_ignore = ' \t' def t_ID(self, t): - r'[a-zA-Z_@#][a-zA-Z0-9_@\-]*' + r'[a-zA-Z_@][a-zA-Z0-9_@\-]*' t.type = self.reserved_words.get(t.value, 'ID') return t diff --git a/tests/test_lexer.py b/tests/test_lexer.py index 481215d..9d9fe38 100644 --- a/tests/test_lexer.py +++ b/tests/test_lexer.py @@ -53,7 +53,6 @@ class TestLexer(unittest.TestCase): self.assert_lex_equiv('`this`', [self.token('this', 'NAMED_OPERATOR')]) self.assert_lex_equiv('|', [self.token('|', '|')]) self.assert_lex_equiv('where', [self.token('where', 'WHERE')]) - self.assert_lex_equiv('a.#text', [self.token('a', 'ID'), self.token('.', '.'), self.token('#text', 'ID')]) def test_basic_errors(self): def tokenize(s): @@ -67,4 +66,4 @@ class TestLexer(unittest.TestCase): self.assertRaises(JsonPathLexerError, tokenize, '"`') self.assertRaises(JsonPathLexerError, tokenize, "'`") self.assertRaises(JsonPathLexerError, tokenize, '?') - self.assertRaises(JsonPathLexerError, tokenize, '$.foo.bar.%') + self.assertRaises(JsonPathLexerError, tokenize, '$.foo.bar.#') |