| 111 | } |
| 112 | |
| 113 | TUnstrictConfig::TPathUnit TUnstrictConfig::ProcessPathUnit(const TString& element) const { |
| 114 | size_t indexBeginPos = element.find('['); |
| 115 | if (indexBeginPos == TString::npos) { |
| 116 | return TPathUnit(element, 0); |
| 117 | } |
| 118 | |
| 119 | size_t indexEndPos = element.find(']', indexBeginPos); |
| 120 | if (indexEndPos == TString::npos) { |
| 121 | ythrow yexception() << "Syntax error: ] symbol expected: " << element; |
| 122 | } |
| 123 | |
| 124 | const TCiString name(element.data(), indexBeginPos); |
| 125 | const TStringBuf range(element.data() + indexBeginPos + 1, indexEndPos - indexBeginPos - 1); |
| 126 | if (range.find(':') == range.npos) { |
| 127 | const size_t index = FromString<size_t>(range); |
| 128 | return TPathUnit(name, index); |
| 129 | } else { |
| 130 | const size_t startIndex = FromStringWithDefaultForEmpty<size_t>(range.Before(':'), 0); |
| 131 | const size_t endIndex = FromStringWithDefaultForEmpty<size_t>(range.After(':'), Max<size_t>()); |
| 132 | if (startIndex > endIndex) { |
| 133 | ythrow yexception() << "Incorrect range " << range; |
| 134 | } |
| 135 | return TPathUnit(name, startIndex, endIndex); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | const TYandexConfig::Section* TUnstrictConfig::GetSection(const TYandexConfig::Section* section, const TVector<TString>::const_iterator& begin, const TVector<TString>::const_iterator& end) const { |
| 140 | auto sections = GetSections(section, begin, end); |