public override object VisitBond([NotNull] smilesParser.BondContext context) { if (context.GetText() == "-") { return(BondType.Single); } else if (context.GetText() == "=") { return(BondType.Double); } else if (context.GetText() == "#") { return(BondType.Triple); } else if (context.GetText() == "$") { return(BondType.Any); } else if (context.GetText() == "\\") { if (string.IsNullOrEmpty(cisTrans)) { cisTrans = context.GetText(); } else { if (context.GetText() == cisTrans) { if (((doubleBonds.Count - 1) % 2) == 0) { foreach (Bond b in doubleBonds) { b.Stereo = BondStereo.trans; } } } else { if (((doubleBonds.Count - 1) % 2) == 0) { foreach (Bond b in doubleBonds) { b.Stereo = BondStereo.cis; } } } cisTrans = string.Empty; doubleBonds.Clear(); } } else if (context.GetText() == "/") { if (string.IsNullOrEmpty(cisTrans)) { cisTrans = context.GetText(); } else { if (context.GetText() == cisTrans) { if (((doubleBonds.Count - 1) % 2) == 0) { foreach (Bond b in doubleBonds) { b.Stereo = BondStereo.trans; } } } else { if (((doubleBonds.Count - 1) % 2) == 0) { foreach (Bond b in doubleBonds) { b.Stereo = BondStereo.cis; } } } cisTrans = string.Empty; doubleBonds.Clear(); } } return(BondType.Single); }
/// <summary> /// Visit a parse tree produced by <see cref="smilesParser.bond"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitBond([NotNull] smilesParser.BondContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="smilesParser.bond"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitBond([NotNull] smilesParser.BondContext context) { }