Module Modeling.QualifierParser
This module is where any Qualifier strings are interpreted and turned into
real qualifier.
It is still unfinished: built qualifiers are not optimal at all. For example,
the expression "NOT ( name=='truc' AND age>30 AND age<65 )" builts two
AndQualifier, the first one joining "name=='truc' AND age>30", the second
one joining the result of the latter with "age < 65". There should better
be one AndQualifier joining the three sub-expression.
This was primarily derived from the calculator example given in package
'spark'. For sure the big part was to handle parens... I did not manipulate
grammars for years and I did not get back to the theory before doing this,
hence purists will surely get mad looking at this. If you are one and wanna
give a helpful hand, you're welcome here!
The grammar used here is the following:
qual ::= qual operator qual
qual ::= paren_open qual paren_close
qual ::= expr
expr ::= expr comp_op expr
expr ::= paren_open expr paren_close
expr ::= term
expr ::= not_expr
term ::= number
term ::= float
term ::= string
term ::= keypath
not_expr ::= not_operator qual
comp_op ::= +
comp_op ::= *
comp_op ::= <
comp_op ::= >
comp_op ::= ==
comp_op ::= >=
comp_op ::= <=
comp_op ::= !=
comp_op ::= IN
comp_op ::= NOT IN
operator ::= AND
operator ::= OR
not_operator ::= NOT
- (Refer to the QualifierScanner class for a 'regexp-description' of literals
- like 'string', 'keypath', etc.)
Function Summary |
|
generate(ast)
|
|
parse(tokens)
|
|
qualifierWithQualifierFormat (anExpression)
Used by Qualifier.qualifierFromQualifierFormat |
|
scan(f)
|
|
semantic(ast)
|
|
trace(msg,
*args)
|
qualifierWithQualifierFormat(anExpression)
Used by Qualifier.qualifierFromQualifierFormat -
|