public WebFormsRootState (
			HtmlTagState tagState,
			HtmlClosingTagState closingTagState,
			XmlCommentState commentState,
			XmlCDataState cDataState,
			XmlDocTypeState docTypeState,
		        XmlProcessingInstructionState processingInstructionState,
			WebFormsExpressionState expressionState,
			WebFormsDirectiveState directiveState,
			WebFormsServerCommentState serverCommentState
			)
			: base (tagState, closingTagState, commentState, cDataState, docTypeState, processingInstructionState)
		{
			this.expressionState = expressionState;
			this.directiveState = directiveState;
			this.serverCommentState = serverCommentState;
			
			Adopt (this.ExpressionState);
			Adopt (this.DirectiveState);
			Adopt (this.ServerCommentState);
		}
Пример #2
0
        public WebFormsRootState(
            HtmlTagState tagState,
            HtmlClosingTagState closingTagState,
            XmlCommentState commentState,
            XmlCDataState cDataState,
            XmlDocTypeState docTypeState,
            XmlProcessingInstructionState processingInstructionState,
            WebFormsExpressionState expressionState,
            WebFormsDirectiveState directiveState,
            WebFormsServerCommentState serverCommentState
            )
            : base(tagState, closingTagState, commentState, cDataState, docTypeState, processingInstructionState)
        {
            this.expressionState    = expressionState;
            this.directiveState     = directiveState;
            this.serverCommentState = serverCommentState;

            Adopt(this.ExpressionState);
            Adopt(this.DirectiveState);
            Adopt(this.ServerCommentState);
        }
Пример #3
0
        public override XmlParserState PushChar(char c, IXmlParserContext context, ref string rollback)
        {
            var maskedTag = (AttState)((context.StateTag & TagMask) >> XmlAttributeValueState.TagShift);

            switch (maskedTag)
            {
            case AttState.Incoming:
                if (c == '<')
                {
                    SetTag(context, AttState.Bracket);
                    return(null);
                }
                return(base.PushChar(c, context, ref rollback));

            case AttState.Bracket:
                if (c == '%')
                {
                    SetTag(context, AttState.Percent);
                    return(null);
                }
                rollback = "<";
                return(Parent);

            case AttState.Percent:
                if (c == '-')
                {
                    SetTag(context, AttState.PercentDash);
                    return(null);
                }
                if (c == '@')
                {
                    context.LogError(GettextCatalog.GetString("Invalid directive location"));
                    rollback = "<%";
                    return(Parent);
                }
                WebFormsExpressionState.AddExpressionNode(c, context);
                SetTag(context, AttState.Expression);
                return(null);

            case AttState.PercentDash:
                if (c == '-')
                {
                    context.Nodes.Push(new WebFormsServerComment(context.LocationMinus(4)));
                    SetTag(context, AttState.Comment);
                    return(null);
                }
                context.LogError(GettextCatalog.GetString("Malformed server comment"));
                rollback = "<%-";
                return(Parent);

            case AttState.Expression:
                if (c == '%')
                {
                    SetTag(context, AttState.EndPercent);
                }
                return(null);

            case AttState.EndPercent:
                if (c == '>')
                {
                    //TODO: attach nodes
                    var n = context.Nodes.Pop();
                    n.End(context.Location);
                    SetTag(context, AttState.Incoming);
                    //ensure attribute get closed if value is unquoted
                    var baseState = (context.StateTag & XmlAttributeValueState.TagMask);
                    if (baseState == FREE || baseState == UNQUOTED)
                    {
                        var att = (XAttribute)context.Nodes.Peek();
                        att.Value = "";
                        return(Parent);
                    }
                    return(null);
                }
                SetTag(context, AttState.Expression);
                return(null);

            case AttState.Comment:
                if (c == '-')
                {
                    SetTag(context, AttState.EndDash);
                }
                return(null);

            case AttState.EndDash:
                if (c == '-')
                {
                    SetTag(context, AttState.EndDashDash);
                }
                else
                {
                    SetTag(context, AttState.Comment);
                }
                return(null);

            case AttState.EndDashDash:
                if (c == '%')
                {
                    SetTag(context, AttState.EndDashDashPercent);
                }
                else if (c != '-')
                {
                    SetTag(context, AttState.Comment);
                }
                return(null);

            case AttState.EndDashDashPercent:
                if (c == '>')
                {
                    //TODO: attach nodes
                    var n = context.Nodes.Pop();
                    n.End(context.Location);
                    SetTag(context, AttState.Incoming);
                    return(null);
                }
                SetTag(context, AttState.Comment);
                return(null);

            default:
                return(base.PushChar(c, context, ref rollback));
            }
        }