public override void OnVisitMatch(ParseNode node) { var cleanStates = new CleanupAstNodeStates(node.Parent.Children); var advance = cleanStates.MappedNodes.IndexOf(node); if (advance == 0) return; cleanStates.ShiftBlock(advance); }
static void FoldBlocks(CleanupAstNodeStates cleanStates) { for (var pos = 0; pos < cleanStates.Count; pos++) { var currentNode = cleanStates[pos]; var tokenKind = currentNode.GetTokenKind(); switch (tokenKind) { case TokenKind.OpenCurly: cleanStates.ShiftBlock(pos); break; } } }