Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Visual AST for ANTLR Generated Parser Output

, 17 May 2012
Build a visual AST from ANTLR parser
EntityMapping_src.zip
EntityMapping
binaries
Antlr3.Runtime.dll
Antlr3.Runtime.pdb
EntityMapping.g
EntMapping
EntMapping.suo
EntMapping.csproj.user
Properties
Settings.settings
Utility
output
EntityMapping.tokens
EntMapping.suo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using Antlr.Runtime.Tree;
using System.Windows.Forms;


namespace EntMapping.Utility
{
    public class ASTTreeNode : IASTTreeNode
    {
        ITree _tree;

        public ASTTreeNode(ITree tree)
        {
            _tree = tree;
        }

        public string Text
        {
            get { return _tree.Text; }
        }

        public int Count
        {
            get { return _tree.ChildCount; }
        }

        public IEnumerable<IASTTreeNode> Children
        {
            get
            {
                for (int i = 0; i < _tree.ChildCount; ++i)
                {
                    yield return new ASTTreeNode(_tree.GetChild(i));
                }
            }
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

matthew_from_hk
Founder
Hong Kong Hong Kong
I am always interested in finding innovative ways for building better applications and founded a technology company since 2003. Welcome to exchange any idea with you and if I am not too busy before deadline of projects, I will reply your emails. Also, if you willing to pay for consulting works and customized software development, you can leave me message.

| Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 17 May 2012
Article Copyright 2012 by matthew_from_hk
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid