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

Method ParseShortOptWithinArg

library/cpp/getopt/small/last_getopt_parser.cpp:108–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 }
107
108 bool TOptsParser::ParseShortOptWithinArg(size_t pos, size_t sop) {
109 Y_ASSERT(pos < Argc_);
110 const TStringBuf arg(Argv_[pos]);
111 Y_ASSERT(sop > 0);
112 Y_ASSERT(sop < arg.length());
113 Y_ASSERT(EIO_NONE != IsOpt(arg));
114
115 size_t p = sop;
116 char c = arg[p];
117 const TOpt* opt = Opts_->FindCharOption(c);
118 if (!opt)
119 return ParseUnknownShortOptWithinArg(pos, sop);
120 p += 1;
121 if (p == arg.length()) {
122 return ParseOptParam(opt, pos + 1);
123 }
124 if (opt->GetHasArg() == NO_ARGUMENT) {
125 return Commit(opt, nullptr, pos, p);
126 }
127 return Commit(opt, arg.SubStr(p), pos + 1, 0);
128 }
129
130 bool TOptsParser::ParseShortOptArg(size_t pos) {
131 Y_ASSERT(pos < Argc_);

Callers

nothing calls this directly

Calls 3

FindCharOptionMethod · 0.80
lengthMethod · 0.45
SubStrMethod · 0.45

Tested by

no test coverage detected