| 93 | }; |
| 94 | |
| 95 | bool DoubleQuoteValidator::addDoubleQuote(bool isInserted) |
| 96 | { |
| 97 | if (!m_unmatchedDoubleQuote) { |
| 98 | m_unmatchedDoubleQuote = true; |
| 99 | m_unmatchedDoubleQuoteWasInserted = isInserted; |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | if (m_matchDoubleQuotes || m_unmatchedDoubleQuoteWasInserted != isInserted) { |
| 104 | // Either the two double quotes are matched and cleared, or one was inserted and another removed, |
| 105 | // which unconditionally cancels them out (could be some code reordering by the formatter). |
| 106 | m_unmatchedDoubleQuote = false; |
| 107 | return true; |
| 108 | } |
| 109 | |
| 110 | // Fail because of two consecutive inserted or removed double quotes, matching which has been disabled. |
| 111 | printFailureWarning(); |
| 112 | return false; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Tracks and validates inserted and removed, opening and closing brackets of a single type, e.g. '{' and '}'. |