private void TreatSwitchStatement(CSharpParser.SwitchStatementContext statement, Node parentNode)
        {
            // Creating node indicating it's a switch statement:
            IToken switchToken = statement.SWITCH().Symbol;
            Node   switchNode  = new Node(switchToken, Node.Kind.SwitchStatement, null);

            ast.AddNode(switchNode);
            int switchNodeIndex = ast.NodeIndex(switchNode);

            parentNode.AddChildIndex(switchNodeIndex);

            // Creating sub tree for the expression being switched:
            beginTreatExpression(statement.expression(), switchNode);

            // For each switch section:
            CSharpParser.Switch_sectionContext[] sections = statement.switch_section();
            foreach (CSharpParser.Switch_sectionContext section in sections)
            {
                // Creating a node for the switch section:
                Node sectionNode = new Node(null, Node.Kind.SwitchSection, null);
                ast.AddNode(sectionNode);
                int sectionIndex = ast.NodeIndex(sectionNode);
                switchNode.AddChildIndex(sectionIndex);

                // Entering the section scope:
                symbolTable.EnterScope(sectionIndex);

                // Treating the switch label:
                CSharpParser.Switch_labelContext[] labels = section.switch_label();
                foreach (CSharpParser.Switch_labelContext label in labels)
                {
                    // Creating node for the default label:
                    if (label.DEFAULT() != null)
                    {
                        Node defaultNode = new Node(label.DEFAULT().Symbol, Node.Kind.SwitchDefaultLabel, null);
                        ast.AddNode(defaultNode);
                        int defaultIndex = ast.NodeIndex(defaultNode);
                        sectionNode.AddChildIndex(defaultIndex);
                    }
                    else if (label.CASE() != null)
                    {
                        Node caseNode = new Node(label.CASE().Symbol, Node.Kind.SwitchCaseLabel, null);
                        ast.AddNode(caseNode);
                        int caseIndex = ast.NodeIndex(caseNode);
                        sectionNode.AddChildIndex(caseIndex);
                    }
                }

                // Treating the statements list:
                CSharpParser.Statement_listContext statementList = section.statement_list();
                CSharpParser.StatementContext[]    statements    = statementList.statement();
                foreach (CSharpParser.StatementContext s in statements)
                {
                    TreatStatement(s, sectionNode);
                }

                // Exiting the section scope:
                symbolTable.ExitScope();
            }
        }
        private void TreatBlock(CSharpParser.BlockContext context, Node parentNode)
        {
            // Creating a new node for the code block:
            Node blockNode = new Node(null, Node.Kind.CodeBlock, null);

            ast.AddNode(blockNode);
            int blockNodeIndex = ast.NodeIndex(blockNode);

            parentNode.AddChildIndex(blockNodeIndex);

            // Treating each statement in the statement list:
            CSharpParser.Statement_listContext listContext = context.statement_list();
            if (listContext != null)
            {
                CSharpParser.StatementContext[] statements = listContext.statement();
                foreach (CSharpParser.StatementContext statement in statements)
                {
                    TreatStatement(statement, blockNode);
                }
            }
        }