Lokorin Site Admin
Joined: 03 Apr 2006 Posts: 697
|
Posted: Fri Apr 28, 2006 12:14 pm Post subject: Conjunctions and disjunctions of XML conditions |
|
|
Status: Included in version 1.3.10
Problem
The head conditions used when using DKP Log Parser's XML patterns were built with the assumption that each condition would only depend on a single element and that element's contents. That limits the possibilities, for instance one can not do the following posted in a configuration thread.
| Nomad_Wanderer wrote: |
| I.e. all purple loot, AND any loot that has a note ("Track")? |
Suggestion
The suggestion is to add conjunctions and disjunctions (AND and OR operators) on a condition level, so that e.g. only one condition has to be satisfied. Technically conjunctions are already available as per default all conditions have to be satisfied at the same time, but those conjunctions can for instance not be nested.
How the code should be modified
Rebuild the head conditions, split into a central interface (HeadCondition) with an abstract implementation (AbstractHeadCondition) and three subclasses: AtomicHeadCondition, HeadConditionConjunction and HeadConditionDisjunction.
Modify the XML pattern parser to conform to the following BNF (introducing "~" as the new OR operator):
| Code: |
xmlPattern ::= <body> ":" <head>
body ::= <element> <moreElements>
element ::= <regexp>
moreElements ::= ">" <element> <moreElements>
| ''empty''
regexp ::= "!" <regexpContents>
| <regexpContents>
regexpContents ::= <character> <moreCharacters>
character ::= ''[^:<>#"~]''
| "#".
moreCharacters ::= <character> <moreCharacters>
| ''empty''
head ::= <headCondition> <moreHeadConditions>
headCondition ::= """ <headCondition> <moreHeadConditions> """
| <atomicHeadCondition>
atomicHeadCondition ::= <regexp> "<" <regexp>
moreHeadConditions ::= ">" <headCondition> <moreHeadConditions>
| "~" <headCondition> <moreHeadConditions>
| "?" <moreHeadConditions>
| ''empty''
|
Modify the XML parser so that it provides the contents of all children of the current node instead of just the contents of a single child. |
|