ok i am completly agree
Similar we could think about even [CH2X4] or even more complex expression
even more complex like [CH2X4+] .
JJTree creates AST tree nodes representing these
expressions and tokens. Then in the visitor class, I build a tree
structure containing all logical operators, and make the matches()
method in SMARTSAtom recursively traversing this tree.

Well that will be easy. i am only worry about performace but that won't matter if this
solution works well. But while recursively transversing the tree you will use the if and else
statements write.
 means if node==atom do this like this or else...
this will be very important i think.
[CH2X4] -> C & H2 & X4 ->
i have already made a SMARTSOperatorAtom class that can handle this expression.
Well what about bonds.
how do we know that atom is finished and bond has to be added because in the same container we have to add it and UIT or SQT both use this very extensively.
The class logicalOperator:
 if you can see the smartsOperatorAtom class instead of using logicalOperator we can
adapt the similar logic.  i strongly believe it should be created at the time of parsing.
Well let's experiment with this.
We need to come up with some API for that.
sure doing recursive smarts will be milestone.
i will also study your code.
sushil ronghe
Center of Pharmacoinformatics