Skip to content

Commit

Permalink
Handle quadruple bonds in SMARTS matches.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay authored and egonw committed Jun 17, 2015
1 parent 1ba0333 commit c963d7b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ public Object visit(ASTSimpleBond node, Object data) {
case SMARTSParserConstants.T_BOND:
bond = new OrderQueryBond(IBond.Order.TRIPLE, builder);
break;
case SMARTSParserConstants.DOLLAR:
bond = new OrderQueryBond(IBond.Order.QUADRUPLE, builder);
break;
case SMARTSParserConstants.ANY_BOND:
bond = new AnyOrderQueryBond(builder);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ TOKEN_MGR_DECLS : {
|
<R_BRACKET : "]" >
|
<DOLLAR : "$" >
<DOLLAR : "$" > // also quad bond
|
<PLUS: "+" >
}
Expand Down Expand Up @@ -521,7 +521,9 @@ void SimpleBond() #SimpleBond : {}
<D_BOND>
|
<T_BOND>
|
|
<DOLLAR>
|
<AR_BOND>
|
<ANY_BOND>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,13 @@ public void testPropertyr5() throws Exception {
Assert.assertEquals(5, results[1]);
}

@Test
public void quadBond() throws Exception {
int[] results = match("*$*", "[Re]$[Re]");
Assert.assertEquals(2, results[0]);
Assert.assertEquals(1, results[1]);
}

@Test
public void testPropertyValence1() throws Exception {
int[] results = match("[v4]", "C");
Expand Down

0 comments on commit c963d7b

Please sign in to comment.