From b926b602d959706764162ccbfe5378fdac19f5d8 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 12 Nov 2015 15:19:32 -0800 Subject: [PATCH] test not, remove requirement of padding --- parser/parser.cpp | 2 +- parser/test.cpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/parser/parser.cpp b/parser/parser.cpp index 94e3f4b4..bc4d6520 100644 --- a/parser/parser.cpp +++ b/parser/parser.cpp @@ -91,7 +91,7 @@ struct group_pred : if_must< one< '(' >, pad< pred, blank >, one< ')' > > {}; struct true_pred : pegtl_istring_t("truepredicate") {}; struct false_pred : pegtl_istring_t("falsepredicate") {}; -struct not_pre : sor< seq< one< '!' >, star< blank > >, seq< pegtl_istring_t("not"), plus< blank > > > {}; +struct not_pre : seq< sor< one< '!' >, seq< pegtl_istring_t("not") >, star< blank > > > {}; struct atom_pred : seq< opt< not_pre >, pad< sor< group_pred, true_pred, false_pred, comparison_pred >, blank > > {}; struct and_op : sor< pad< two< '&' >, blank >, pad_plus< pegtl_istring_t("and"), blank > > {}; diff --git a/parser/test.cpp b/parser/test.cpp index b5fb6458..636ea316 100644 --- a/parser/test.cpp +++ b/parser/test.cpp @@ -51,6 +51,20 @@ static std::vector valid_queries = { "0 contains 0", "0 BeGiNsWiTh 0", "0 ENDSWITH 0", + + // atoms/groups + "(0=0)", + "( 0=0 )", + "((0=0))", + "!0=0", + "! 0=0", + "!(0=0)", + "! (0=0)", + "NOT0=0", // keypath NOT0 + "not 0=0", + "NOT(0=0)", + "not (0=0)", + "NOT (!0=0)", }; static std::vector invalid_queries = { @@ -86,6 +100,15 @@ static std::vector invalid_queries = { "0 contains1", "endswith 0", + // atoms/groups + "0=0)", + "(0=0", + "(0=0))", + "! =0", + "NOTNOT(0=0)", + "(!!0=0)", + "0=0 !", + "truepredicate &&", "truepredicate & truepredicate", };