MCPcopy Create free account
hub / github.com/catboost/catboost / OnLeaveScope

Method OnLeaveScope

tools/enum_parser/parse_enum/parse_enum.cpp:308–336  ·  view source on GitHub ↗

@param offset: terminating curly brace position

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 3

CurrentExceptionMessageFunction · 0.85
ParseEnumFunction · 0.50
pop_backMethod · 0.45

Tested by

no test coverage detected