예제 #1
0
파일: compiler.cs 프로젝트: ydunk/masters
        public virtual IfAction CreateIfAction(IfAction.ConditionType type)
        {
            IfAction action = new IfAction(type);

            action.Compile(this);
            return(action);
        }
예제 #2
0
        private void CompileConditions(Compiler compiler)
        {
            NavigatorInput input     = compiler.Input;
            bool           when      = false;
            bool           otherwise = false;

            do
            {
                Debug.Trace(input);

                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) && !otherwise)
                        {
                            action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen);
                            when   = true;
                        }
                        else if (Keywords.Equals(name, input.Atoms.Otherwise) && !otherwise)
                        {
                            action    = compiler.CreateIfAction(IfAction.ConditionType.ConditionOtherwise);
                            otherwise = true;
                        }
                        else
                        {
                            throw XsltException.UnexpectedKeyword(compiler);
                        }
                        AddAction(action);
                    }
                    else
                    {
                        throw XsltException.UnexpectedKeyword(compiler);
                    }
                    compiler.PopScope();
                    break;

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

                default:
                    throw new XsltException(Res.Xslt_InvalidContents, Keywords.s_Choose);
                }
            }while (compiler.Advance());
            if (!when)
            {
                throw new XsltException(Res.Xslt_NoWhen);
            }
        }
예제 #3
0
파일: compiler.cs 프로젝트: ArildF/masters
 public virtual IfAction CreateIfAction(IfAction.ConditionType type) {
     IfAction action = new IfAction(type);
     action.Compile(this);
     return action;
 }
예제 #4
0
 public override IfAction CreateIfAction(IfAction.ConditionType type) {
     IfAction action = new IfActionDbg(type);
     action.Compile(this);
     return action;
 }