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

Method NextToken

IDEHelper/Compiler/BfParser.cpp:1545–3595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1543}
1544
1545void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePreprocessor)
1546{
1547 auto prevToken = mToken;
1548
1549 mToken = BfToken_None;
1550 if (mSyntaxToken == BfSyntaxToken_EOF)
1551 Fail("Unexpected end of file");
1552
1553 mTriviaStart = mSrcIdx;
1554
1555 bool isLineStart = true;
1556 bool isVerbatim = false;
1557 int interpolateSetting = 0;
1558 int stringStart = -1;
1559
1560 while (true)
1561 {
1562 bool setVerbatim = false;
1563 bool setInterpolate = false;
1564 uint32 checkTokenHash = 0;
1565
1566 if ((endIdx != -1) && (mSrcIdx >= endIdx))
1567 {
1568 mSyntaxToken = BfSyntaxToken_HIT_END_IDX;
1569 return;
1570 }
1571
1572 mTokenStart = mSrcIdx;
1573 mTokenEnd = mSrcIdx + 1;
1574 char c = mSrc[mSrcIdx++];
1575
1576 if (outerIsInterpolate)
1577 {
1578 if (c == '"')
1579 {
1580 mSyntaxToken = BfSyntaxToken_StringQuote;
1581 return;
1582 }
1583 }
1584
1585 if ((mPreprocessorIgnoreDepth > 0) && (endIdx == -1))
1586 {
1587 if (c == 0)
1588 {
1589 mSyntaxToken = BfSyntaxToken_EOF;
1590 mSrcIdx--;
1591 break;
1592 }
1593
1594 if ((c == '>') && (mSrc[mSrcIdx] == '>') && (mSrc[mSrcIdx + 1] == '>'))
1595 {
1596 // Allow through
1597 }
1598 else if ((c != '#') || (!isLineStart))
1599 {
1600 if (c == '\n')
1601 {
1602 NewLine();

Callers

nothing calls this directly

Calls 15

FailFunction · 0.85
BfSizedArrayInitIndirectFunction · 0.85
FailAtMethod · 0.80
AppendMethod · 0.80
MoreInfoAtMethod · 0.80
FailAfterAtMethod · 0.80
SetSrcEndMethod · 0.80
GetTriviaStartMethod · 0.80
WarnAtMethod · 0.80
IsWhitespaceFunction · 0.70
GetLengthMethod · 0.45

Tested by

no test coverage detected