MCPcopy Create free account
hub / github.com/beefytech/Beef / GetLineCharAtIdx

Method GetLineCharAtIdx

IDEHelper/Compiler/BfParser.cpp:298–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void BfParserData::GetLineCharAtIdx(int idx, int& line, int& lineChar)
299{
300 if (mJumpTableSize <= 0)
301 {
302 line = 0;
303 lineChar = 0;
304 return;
305 }
306
307 if (idx >= mSrcLength)
308 idx = mSrcLength - 1;
309 auto* jumpEntry = mJumpTable + (idx / PARSER_JUMPTABLE_DIVIDE);
310 if (jumpEntry->mCharIdx > idx)
311 jumpEntry--;
312
313 line = jumpEntry->mLineNum;
314 lineChar = 0;
315 int curSrcPos = jumpEntry->mCharIdx;
316
317 while (curSrcPos < idx)
318 {
319 if (mSrc[curSrcPos] == '\n')
320 {
321 line++;
322 lineChar = 0;
323 }
324 else
325 {
326 lineChar++;
327 }
328
329 curSrcPos++;
330 }
331}
332
333bool BfParserData::IsUnwarnedAt(BfAstNode* node)
334{

Callers 10

FixitGetLocationMethod · 0.80
LocationToStringMethod · 0.80
AddLocationMethod · 0.80
GetEmitLocationMethod · 0.80
GetStackFrameInfoMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected