X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=parser%2Fgrammar;h=14753c88e28544d5252a74dc38a142fc11e20d83;hb=refs%2Fheads%2Fply;hp=33326116c917ec5300f0df9b6ebbf95e44dfa65a;hpb=02dbb2a7f4d0804c56122cc7ca681224fe659abc;p=phdru.name%2Fcgi-bin%2Fblog-ru%2Fsearch-tags.git diff --git a/parser/grammar b/parser/grammar index 3332611..14753c8 100644 --- a/parser/grammar +++ b/parser/grammar @@ -9,8 +9,8 @@ # TAG & (TAG | TAG) # !(TAG | TAG) # Allowed operators: conjunction - & && AND and -# disjunction - | || -# negation - ! +# disjunction - | || OR or +# negation - ! NOT not # This is a simple version of the grammar and it allows # rather stupid expressions, like !!TAG or ((TAG)); in the future # it will be fixed by making the grammar more complex and stricter. @@ -29,9 +29,11 @@ expression : NAME | expression SP0 AND_OP AND_OP SP0 expression | expression SP0 AND_OP SP0 expression | l_expression and_word r_expression - | NOT_OP SP0 expression | expression SP0 OR_OP OR_OP SP0 expression | expression SP0 OR_OP SP0 expression + | l_expression or_word r_expression + | NOT_OP SP0 expression + | not_word r_expression | expression_parens l_expression : expression_parens @@ -49,6 +51,12 @@ expression_sp : expression SP1 and_word : 'A' 'N' 'D' | 'a' 'n' 'd' +or_word : 'O' 'R' + | 'o' 'r' + +not_word : 'N' 'O' 'T' + | 'n' 'o' 't' + SP0 : SP1 | empty empty :