示例#1
0
    //전위 순회 Enumerator
    public IEnumerator GetEnumerator()
    {
        head.unvisit();

        now = head;

        while (true)
        {
            if (!now.isVisited)
            {
                now.isVisited = true;

                yield return(now);
            }

            GolLangNode temp = now.getFirstUnvisitedChild();

            if (temp != null)
            {
                now = temp;
            }
            else if (now.hasRightSibling())
            {
                now = now.rightSibling;
            }
            else if (now.parents != null)
            {
                now = now.parents;
            }
            else
            {
                break;
            }
        }
    }
示例#2
0
    public EditorNode()
    {
        golLangNode = new GolLangNode(new GolLangLine());

        blocks = new List <Block>();

        parents = null;

        leftSibling = null;

        rightSibling = null;

        children = new List <EditorNode>();
    }
示例#3
0
    public GolLangNode(GolLangLine line)
    {
        this.line = line;

        parents = null;

        leftSibling = null;

        rightSibling = null;

        children = new List <GolLangNode>();

        isVisited = false;
    }
示例#4
0
    public void addChild(GolLangNode child)
    {
        children.Add(child);

        child.parents = this;

        if (children.Count > 1)
        {
            GolLangNode now = children[0];

            while (now.rightSibling != null)
            {
                now = now.rightSibling;
            }

            now.rightSibling  = child;
            child.leftSibling = now;
        }
    }
示例#5
0
    public EditorNode(Block firstBlock)
    {
        golLangNode = new GolLangNode(new GolLangLine());



        golLangNode.line.keywords.Add(firstBlock.keyword);

        blocks = new List <Block>();
        blocks.Add(firstBlock);

        firstBlock.node = this;

        parents = null;

        leftSibling = null;

        rightSibling = null;

        children = new List <EditorNode>();
    }
示例#6
0
 public GolLangTree(GolLangNode head)
 {
     this.head = head;
 }
示例#7
0
 public GolLangTree()
 {
     head = null;
 }