alternatives.txt

来自「有关编译器的编译器.」· 文本 代码 · 共 313 行

TXT
313
字号
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This file is part of SableCC.                             * * See the file "LICENSE" for copyright information and the  * * terms and conditions for copying, distribution and        * * modification of SableCC.                                  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */Macro:AlternativeHeader/* This file was generated by SableCC (http://www.sablecc.org/). */package $0$;import java.util.*;import $1$.*;public final class $2$ extends $3${$Macro:NodeElement    private $0$ _$1$_;$Macro:ListElement    private final LinkedList _$1$_ = new TypedLinkedList(new $0$_Cast());$Macro:ConstructorHeader    public $0$($Macro:ConstructorHeaderDeclNode        $0$ _$1$_$2$$Macro:ConstructorHeaderDeclList        $0$ _$1$_$2$$Macro:ConstructorBodyHeader)    {$Macro:ConstructorBodyNode        set$0$(_$1$_);$Macro:ConstructorBodyList        {            this._$0$_.clear();            this._$0$_.addAll(_$0$_);        }$Macro:ConstructorBodyQMark        if(_$2$_ instanceof X1QMark$1$)        {            set$0$(((X1QMark$1$) _$2$_).get$1$());        }        else        {            set$0$(null);        }$Macro:ConstructorBodyStar        while(_$0$_ instanceof X1Star$1$)        {            this._$0$_.add(((X1Star$1$) _$0$_).get$1$());            _$0$_ = ((X1Star$1$) _$0$_).getXStar$1$();        }$Macro:ConstructorBodyPlus        if(_$0$_ != null)        {            while(_$0$_ instanceof X1$1$)            {                this._$0$_.addFirst(((X1$1$) _$0$_).get$1$());                _$0$_ = ((X1$1$) _$0$_).getX$1$();            }            this._$0$_.addFirst(((X2$1$) _$0$_).get$1$());        }$Macro:ConstructorBodyTail    }$Macro:CloneHeader    public Object clone()    {        return new $0$($Macro:CloneBodyNode            ($0$) cloneNode(_$1$_)$2$$Macro:CloneBodyList            cloneList(_$0$_)$1$$Macro:CloneTail);    }$Macro:Apply    public void apply(Switch sw)    {        ((Analysis) sw).case$0$(this);    }$Macro:GetSetNode    public $0$ get$1$()    {        return _$2$_;    }    public void set$1$($0$ node)    {        if(_$2$_ != null)        {            _$2$_.parent(null);        }        if(node != null)        {            if(node.parent() != null)            {                node.parent().removeChild(node);            }            node.parent(this);        }        _$2$_ = node;    }$Macro:GetSetList    public LinkedList get$0$()    {        return _$1$_;    }    public void set$0$(List list)    {        _$1$_.clear();        _$1$_.addAll(list);    }$Macro:ToStringHeader    public String toString()    {        return ""$Macro:ToStringBodyNode            + toString(_$0$_)$Macro:ToStringBodyList            + toString(_$0$_)$Macro:ToStringTail;    }$Macro:RemoveChildHeader    void removeChild(Node child)    {$Macro:RemoveChildNode        if(_$0$_ == child)        {            _$0$_ = null;            return;        }$Macro:RemoveChildList        if(_$0$_.remove(child))        {            return;        }$Macro:RemoveChildTail    }$Macro:ReplaceChildHeader    void replaceChild(Node oldChild, Node newChild)    {$Macro:ReplaceChildNode        if(_$0$_ == oldChild)        {            set$1$(($2$) newChild);            return;        }$Macro:ReplaceChildList        for(ListIterator i = _$0$_.listIterator(); i.hasNext();)        {            if(i.next() == oldChild)            {                if(newChild != null)                {                    i.set(newChild);                    oldChild.parent(null);                    return;                }                i.remove();                oldChild.parent(null);                return;            }        }$Macro:ReplaceChildTail    }$Macro:Cast    private class $0$_Cast implements Cast    {        public Object cast(Object o)        {            $1$ node = ($1$) o;            if((node.parent() != null) &&                (node.parent() != $2$.this))            {                node.parent().removeChild(node);            }            if((node.parent() == null) ||                (node.parent() != $2$.this))            {                node.parent($2$.this);            }            return node;        }    }$Macro:AlternativeTail}$

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?