# Grammar rules for tag searching; BNF. # The grammar defines expressions in the following forms: # TAG - search blog posts that contain the tag; # !TAG - search blog posts that don't contain the tag; # TAG & TAG - search blog posts that contain both tags; # TAG | TAG - search blog posts that contain any of the tags; # Parentheses are allowed to group expressions; for example: # TAG & (TAG | TAG) # !(TAG | TAG) # Allowed operators: conjunction - & && # disjunction - | || # negation - ! # 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. NAME : '[a-z][a-z0-9_]+' AND_OP : '&' OR_OP : '|' NOT_OP : '!' SP1 : '[ \t]+' expression : NAME | expression AND_OP AND_OP expression | expression AND_OP expression | expression OR_OP OR_OP expression | expression OR_OP expression | NOT_OP expression | '(' expression ')'