MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / EatInlineComment

Method EatInlineComment

LuaParser/src/Ast/LuaSyntaxTree.cpp:100–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void LuaSyntaxTree::EatInlineComment(LuaParser &p) {
101 auto &tokens = p.GetTokens();
102 if (_tokenIndex > 0 && _tokenIndex < tokens.size()) {
103 auto index = _tokenIndex;
104 switch (tokens[index].TokenType) {
105 case TK_SHORT_COMMENT:
106 case TK_LONG_COMMENT:
107 case TK_SHEBANG: {
108 auto prevToken = tokens[index - 1];
109 if (_source->GetLine(prevToken.Range.GetEndOffset()) == _source->GetLine(tokens[index].Range.StartOffset)) {
110 EatToken(p);
111 }
112 break;
113 }
114 default: {
115 return;
116 }
117 }
118 }
119}
120
121void LuaSyntaxTree::EatToken(LuaParser &p) {
122 auto &token = p.GetTokens()[_tokenIndex];

Callers

nothing calls this directly

Calls 4

GetTokensMethod · 0.80
GetLineMethod · 0.80
sizeMethod · 0.45
GetEndOffsetMethod · 0.45

Tested by

no test coverage detected