diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2018-12-30 21:04:57 -0600 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2018-12-30 21:04:57 -0600 |
commit | b5bdb59d39c9202899bb6302095028a979089ba8 (patch) | |
tree | 8d549bac260851e23e4a610cd385bdc6e5ca2952 | |
parent | c2fdc55b760c04ceb04ad7e1bb3d9cd6b070aa3e (diff) | |
download | pyparsing-git-b5bdb59d39c9202899bb6302095028a979089ba8.tar.gz |
Update Lucene grammar example, but remove from Travis-CI acceptance scripts
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | examples/lucene_grammar.py | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index a6e7415..055b10c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,6 @@ script: - python unitTests.py - python simple_unit_tests.py - PYTHONPATH=. python examples/numerics.py - - PYTHONPATH=. python examples/lucene_grammar.py - PYTHONPATH=. python examples/TAP.py - PYTHONPATH=. python examples/romanNumerals.py - PYTHONPATH=. python examples/sexpParser.py diff --git a/examples/lucene_grammar.py b/examples/lucene_grammar.py index 2791b7c..6afaad4 100644 --- a/examples/lucene_grammar.py +++ b/examples/lucene_grammar.py @@ -19,7 +19,7 @@ keyword = and_ | or_ | not_ | to_ expression = Forward()
-valid_word = Regex(r'([a-zA-Z0-9*_+.-]|\\[!(){}\[\]^"~*?\\:])+').setName("word")
+valid_word = Regex(r'([a-zA-Z0-9*_+.-]|\\\\|\\([+\-!(){}\[\]^"~*?:]|\|\||&&))+').setName("word")
valid_word.setParseAction(
lambda t : t[0].replace('\\\\',chr(127)).replace('\\','').replace(chr(127),'\\')
)
@@ -57,6 +57,7 @@ expression << infixNotation(term, # test strings taken from grammar description doc, and TestQueryParser.java
tests = r"""
+ # Success tests
a and b
a and not b
a and !b
@@ -225,6 +226,8 @@ tests = r""" \*
*
\\
+ \||
+ \&&
a\:b\:c
a\\b\:c
a\:b\\c
@@ -266,6 +269,7 @@ tests = r""" """
failtests = r"""
+ # Failure tests
field:term:with:colon some more terms
(sub query)^5.0^2.0 plus more
a:b:c
|