| 1672 | } |
| 1673 | |
| 1674 | bool CeDebugger::ParseFormatInfo(const StringImpl& formatInfoStr, CeFormatInfo* formatInfo, BfPassInstance* bfPassInstance, int* assignExprOffset, String* assignExprString, String* errorString, BfTypedValue contextTypedValue) |
| 1675 | { |
| 1676 | String formatFlags = formatInfoStr; |
| 1677 | if (assignExprOffset != NULL) |
| 1678 | *assignExprOffset = -1; |
| 1679 | |
| 1680 | while (formatFlags.length() > 0) |
| 1681 | { |
| 1682 | formatFlags = Trim(formatFlags); |
| 1683 | if (formatFlags.IsEmpty()) |
| 1684 | break; |
| 1685 | if (formatFlags[0] != ',') |
| 1686 | { |
| 1687 | return false; |
| 1688 | } |
| 1689 | else |
| 1690 | { |
| 1691 | int nextComma = (int)formatFlags.IndexOf(',', 1); |
| 1692 | int quotePos = (int)formatFlags.IndexOf('"', 1); |
| 1693 | if ((quotePos != -1) && (quotePos < nextComma)) |
| 1694 | { |
| 1695 | int nextQuotePos = (int)formatFlags.IndexOf('"', quotePos + 1); |
| 1696 | if (nextQuotePos != -1) |
| 1697 | nextComma = (int)formatFlags.IndexOf(',', nextQuotePos + 1); |
| 1698 | } |
| 1699 | if (nextComma == -1) |
| 1700 | nextComma = (int)formatFlags.length(); |
| 1701 | |
| 1702 | String formatCmd = formatFlags.Substring(1, nextComma - 1); |
| 1703 | formatCmd = Trim(formatCmd); |
| 1704 | bool hadError = false; |
| 1705 | |
| 1706 | if (strncmp(formatCmd.c_str(), "this=", 5) == 0) |
| 1707 | { |
| 1708 | formatCmd = formatFlags.Substring(1); |
| 1709 | formatCmd = Trim(formatCmd); |
| 1710 | String thisExpr = formatCmd.Substring(5); |
| 1711 | if (thisExpr.empty()) |
| 1712 | break; |
| 1713 | CeEvaluationContext dbgEvaluationContext(this, thisExpr, formatInfo); |
| 1714 | formatInfo->mExplicitThis = dbgEvaluationContext.EvaluateInContext(contextTypedValue); |
| 1715 | if (dbgEvaluationContext.HadError()) |
| 1716 | { |
| 1717 | if (errorString != NULL) |
| 1718 | *errorString = dbgEvaluationContext.GetErrorStr(); |
| 1719 | return false; |
| 1720 | } |
| 1721 | formatFlags = thisExpr.Substring(dbgEvaluationContext.mExprString.GetLength()); |
| 1722 | continue; |
| 1723 | } |
| 1724 | else if (strncmp(formatCmd.c_str(), "count=", 6) == 0) |
| 1725 | { |
| 1726 | formatCmd = formatFlags.Substring(1); |
| 1727 | formatCmd = Trim(formatCmd); |
| 1728 | String countExpr = formatCmd.Substring(6); |
| 1729 | if (countExpr.empty()) |
| 1730 | break; |
| 1731 | CeEvaluationContext dbgEvaluationContext(this, countExpr, formatInfo); |
no test coverage detected