diff --git a/parser/parser.cpp b/parser/parser.cpp index bc4d6520..19b6b226 100644 --- a/parser/parser.cpp +++ b/parser/parser.cpp @@ -94,8 +94,8 @@ struct false_pred : pegtl_istring_t("falsepredicate") {}; 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 > > {}; -struct or_op : sor< pad< two< '|' >, blank> , pad_plus< pegtl_istring_t("or"), blank > > {}; +struct and_op : pad< sor< two< '&' >, pegtl_istring_t("and") >, blank > {}; +struct or_op : pad< sor< two< '|' >, pegtl_istring_t("or") >, blank > {}; struct or_ext : if_must< or_op, pred > {}; struct and_ext : if_must< and_op, pred > {}; diff --git a/parser/test.cpp b/parser/test.cpp index 636ea316..e47dcee7 100644 --- a/parser/test.cpp +++ b/parser/test.cpp @@ -65,6 +65,15 @@ static std::vector valid_queries = { "NOT(0=0)", "not (0=0)", "NOT (!0=0)", + + // compound + "a==a && a==a", + "a==a || a==a", + "a==a&&a==a||a=a", + "a==a and a==a", + "a==a OR a==a", + "and=='AND'&&'or'=='||'", + "and == or && ORE > GRAND", }; static std::vector invalid_queries = { @@ -109,6 +118,13 @@ static std::vector invalid_queries = { "(!!0=0)", "0=0 !", + // compound + "a==a & a==a", + "a==a | a==a", + "a==a &| a==a", + "a==a && OR a==a", + "a==aORa==a", + "truepredicate &&", "truepredicate & truepredicate", };