summaryrefslogtreecommitdiff
path: root/examples/lucene_grammar.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2018-12-30 21:04:57 -0600
committerPaul McGuire <ptmcg@austin.rr.com>2018-12-30 21:04:57 -0600
commitb5bdb59d39c9202899bb6302095028a979089ba8 (patch)
tree8d549bac260851e23e4a610cd385bdc6e5ca2952 /examples/lucene_grammar.py
parentc2fdc55b760c04ceb04ad7e1bb3d9cd6b070aa3e (diff)
downloadpyparsing-git-b5bdb59d39c9202899bb6302095028a979089ba8.tar.gz
Update Lucene grammar example, but remove from Travis-CI acceptance scripts
Diffstat (limited to 'examples/lucene_grammar.py')
-rw-r--r--examples/lucene_grammar.py6
1 files changed, 5 insertions, 1 deletions
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