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

Method BuildNode

LuaParser/src/Ast/LuaSyntaxTree.cpp:144–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void LuaSyntaxTree::BuildNode(LuaSyntaxNodeKind kind) {
145 auto currentPos = _nodeOrTokens.size();
146 auto &currentNode = _nodeOrTokens.emplace_back(kind);
147 if (!_nodePosStack.empty()) {
148 auto parentIndex = _nodePosStack.top();
149 auto &parentNode = _nodeOrTokens[parentIndex];
150 if (parentNode.FirstChild == 0) {
151 parentNode.FirstChild = currentPos;
152 parentNode.LastChild = currentPos;
153 } else {
154 auto &lastNode = _nodeOrTokens[parentNode.LastChild];
155 lastNode.NextSibling = currentPos;
156 currentNode.PrevSibling = parentNode.LastChild;
157 parentNode.LastChild = currentPos;
158 }
159 currentNode.Parent = parentIndex;
160 }
161
162 _nodePosStack.push(currentPos);
163}
164
165void LuaSyntaxTree::BuildToken(LuaToken &token) {
166 auto currentNodePos = _nodeOrTokens.size();

Callers

nothing calls this directly

Calls 4

topMethod · 0.80
pushMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected