Inheritance: ContainerAction
コード例 #1
0
ファイル: Compiler.cs プロジェクト: lateralusX/runtime
        public virtual IfAction CreateIfAction(IfAction.ConditionType type)
        {
            IfAction action = new IfAction(type);

            action.Compile(this);
            return(action);
        }
コード例 #2
0
ファイル: Compiler.cs プロジェクト: geoffkizer/corefx
 public virtual IfAction CreateIfAction(IfAction.ConditionType type)
 {
     IfAction action = new IfAction(type);
     action.Compile(this);
     return action;
 }
コード例 #3
0
        private void CompileConditions(Compiler compiler)
        {
            NavigatorInput input     = compiler.Input;
            bool           when      = false;
            bool           otherwise = false;

            do
            {
                switch (input.NodeType)
                {
                case XPathNodeType.Element:
                    compiler.PushNamespaceScope();
                    string nspace = input.NamespaceURI;
                    string name   = input.LocalName;

                    if (Keywords.Equals(nspace, input.Atoms.XsltNamespace))
                    {
                        IfAction action = null;
                        if (Keywords.Equals(name, input.Atoms.When))
                        {
                            if (otherwise)
                            {
                                throw XsltException.Create(Res.Xslt_WhenAfterOtherwise);
                            }
                            action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen);
                            when   = true;
                        }
                        else if (Keywords.Equals(name, input.Atoms.Otherwise))
                        {
                            if (otherwise)
                            {
                                throw XsltException.Create(Res.Xslt_DupOtherwise);
                            }
                            action    = compiler.CreateIfAction(IfAction.ConditionType.ConditionOtherwise);
                            otherwise = true;
                        }
                        else
                        {
                            throw compiler.UnexpectedKeyword();
                        }
                        AddAction(action);
                    }
                    else
                    {
                        throw compiler.UnexpectedKeyword();
                    }
                    compiler.PopScope();
                    break;

                case XPathNodeType.Comment:
                case XPathNodeType.ProcessingInstruction:
                case XPathNodeType.Whitespace:
                case XPathNodeType.SignificantWhitespace:
                    break;

                default:
                    throw XsltException.Create(Res.Xslt_InvalidContents, Keywords.s_Choose);
                }
            }while (compiler.Advance());
            if (!when)
            {
                throw XsltException.Create(Res.Xslt_NoWhen);
            }
        }
コード例 #4
0
 public override IfAction CreateIfAction(IfAction.ConditionType type) {
     IfAction action = new IfActionDbg(type);
     action.Compile(this);
     return action;
 }