@param offset: terminating curly brace position
| 306 | |
| 307 | /// @param offset: terminating curly brace position |
| 308 | void OnLeaveScope(size_t offset) { |
| 309 | if (!Scope) { |
| 310 | size_t contextOffsetBegin = (offset >= 256) ? offset - 256 : 0; |
| 311 | TString codeContext = TString(Data + contextOffsetBegin, offset - contextOffsetBegin + 1); |
| 312 | ythrow yexception() << "C++ source parse failed: unbalanced scope. Did you miss a closing '}' bracket? " |
| 313 | "Context: enum " << CurrentEnum.CppName.Quote() << |
| 314 | " in scope " << TEnumParser::ScopeStr(CurrentEnum.Scope).Quote() << ". Code context:\n... " << |
| 315 | codeContext << " ..."; |
| 316 | } |
| 317 | Scope.pop_back(); |
| 318 | |
| 319 | if (InEnum) { |
| 320 | Y_ASSERT(offset > EnumPos); |
| 321 | InEnum = false; |
| 322 | try { |
| 323 | ParseEnum(Data + EnumPos, offset - EnumPos + 1); |
| 324 | } catch (...) { |
| 325 | TString ofFile; |
| 326 | if (SourceFileName) { |
| 327 | ofFile += " of file "; |
| 328 | ofFile += SourceFileName.Quote(); |
| 329 | } |
| 330 | ythrow yexception() << "Failed to parse enum " << CurrentEnum.CppName << |
| 331 | " in scope " << TEnumParser::ScopeStr(CurrentEnum.Scope) << ofFile << |
| 332 | "\n<C++ parser error message>: " << CurrentExceptionMessage(); |
| 333 | } |
| 334 | } |
| 335 | //PrintScope(); |
| 336 | } |
| 337 | |
| 338 | void ParseEnum(const char* data, size_t length) { |
| 339 | TEnumContext enumContext(CurrentEnum); |
nothing calls this directly
no test coverage detected