Пример #1
0
        ///////////////////////////
        //  PropertyElement ::= EmptyPropertyElement | NonemptyPropertyElement
        //
        public IEnumerable <XamlNode> P_PropertyElement()
        {
            ScannerNodeType nodeType = _xamlScanner.NodeType;

            switch (nodeType)
            {
            case ScannerNodeType.EMPTYPROPERTYELEMENT:
                foreach (XamlNode node in P_EmptyPropertyElement())
                {
                    yield return(node);
                }
                break;

            case ScannerNodeType.PROPERTYELEMENT:
                foreach (XamlNode node in P_NonemptyPropertyElement())
                {
                    yield return(node);
                }
                break;

            default:
                throw new XamlUnexpectedParseException(_xamlScanner, nodeType,
                                                       PropertyElementRuleException);
            }
        }
Пример #2
0
        // =====================================================

        ///////////////////////////
        //  Element ::= EmptyElement | (StartElement ElementBody)
        //
        public IEnumerable <XamlNode> P_Element()
        {
            ScannerNodeType nodeType = _xamlScanner.NodeType;

            switch (nodeType)
            {
            case ScannerNodeType.EMPTYELEMENT:
                foreach (XamlNode node in P_EmptyElement())
                {
                    yield return(node);
                }
                break;

            case ScannerNodeType.ELEMENT:
                foreach (XamlNode node in P_StartElement())
                {
                    yield return(node);
                }
                foreach (XamlNode node in P_ElementBody())
                {
                    yield return(node);
                }
                break;

            default:
                throw new XamlUnexpectedParseException(_xamlScanner, nodeType,
                                                       SR.Get(SRID.ElementRuleException));
            }
        }
Пример #3
0
        // =====================================================

        //  Document ::= PREFIXDEFINITION* Element
        //  Element ::= EmptyElement | (StartElement ElementBody)
        //  EmptyElement ::= EMPTYELEMENT DIRECTIVE* ATTRIBUTE*
        //  StartElement ::= ELEMENT DIRECTIVE*
        //  ElementBody ::= ATTRIBUTE* ( PropertyElement | ElementContent+ )* ENDTAG
        //  PropertyElement ::= EmptyPropertyElement | NonemptyPropertyElement
        //  EmptyPropertyElement ::= EMPTYPROPERTYELEMENT
        //  NonemptyPropertyElement ::= PROPERTYELEMENT PropertyContent* ENDTAG
        //  ElementContent ::= ( PREFIXDEFINITION* Element ) | TEXT
        //  PropertyContent ::= ( PREFIXDEFINITION* Element ) | TEXT
        //
        // Attribute and Directive values can be markup extensions.


        ///////////////////////////
        //  Document::= PREFIXDEFINITION* Element
        //
        public IEnumerable <XamlNode> Parse()
        {
            _xamlScanner.Read();
            if (ProvideLineInfo)
            {
                yield return(Logic_LineInfo());
            }

            ScannerNodeType nodeType = _xamlScanner.NodeType;

            while (nodeType == ScannerNodeType.PREFIXDEFINITION)
            {
                yield return(Logic_PrefixDefinition());

                _xamlScanner.Read();
                if (ProvideLineInfo)
                {
                    yield return(Logic_LineInfo());
                }
                nodeType = _xamlScanner.NodeType;
            }

            foreach (XamlNode node in P_Element())
            {
                yield return(node);
            }
        }
        public IEnumerable <XamlNode> P_PropertyElement()
        {
            ScannerNodeType nodeType = this._xamlScanner.NodeType;

            switch (nodeType)
            {
            case ScannerNodeType.PROPERTYELEMENT:
            {
                IEnumerator <XamlNode> enumerator = this.P_NonemptyPropertyElement().GetEnumerator();
                while (enumerator.MoveNext())
                {
                    XamlNode current = enumerator.Current;
                    yield return(current);
                }
                break;
            }

            default:
                throw new XamlUnexpectedParseException(this._xamlScanner, nodeType, System.Xaml.SR.Get("PropertyElementRuleException"));
                foreach (XamlNode iteratorVariable1 in this.P_EmptyPropertyElement())
                {
                    yield return(iteratorVariable1);
                }
                break;
            }
        }
        private string Logic_ApplyFinalTextTrimming(XamlText text)
        {
            ScannerNodeType peekNodeType = this._xamlScanner.PeekNodeType;
            string          source       = text.Text;

            if (!text.IsSpacePreserved)
            {
                switch (peekNodeType)
                {
                case ScannerNodeType.ENDTAG:
                case ScannerNodeType.PROPERTYELEMENT:
                case ScannerNodeType.EMPTYPROPERTYELEMENT:
                    source = XamlText.TrimTrailingWhitespace(source);
                    break;
                }
                XamlType currentPreviousChildType = this._context.CurrentPreviousChildType;
                if ((currentPreviousChildType == null) || currentPreviousChildType.TrimSurroundingWhitespace)
                {
                    source = XamlText.TrimLeadingWhitespace(source);
                }
                if ((peekNodeType != ScannerNodeType.ELEMENT) && (peekNodeType != ScannerNodeType.EMPTYELEMENT))
                {
                    return(source);
                }
                if (this._xamlScanner.PeekType.TrimSurroundingWhitespace)
                {
                    source = XamlText.TrimTrailingWhitespace(source);
                }
            }
            return(source);
        }
        public IEnumerable <XamlNode> Parse()
        {
            this._xamlScanner.Read();
            if (this.ProvideLineInfo)
            {
                yield return(this.Logic_LineInfo());
            }
            for (ScannerNodeType iteratorVariable0 = this._xamlScanner.NodeType; iteratorVariable0 == ScannerNodeType.PREFIXDEFINITION; iteratorVariable0 = this._xamlScanner.NodeType)
            {
                yield return(this.Logic_PrefixDefinition());

                this._xamlScanner.Read();
                if (this.ProvideLineInfo)
                {
                    yield return(this.Logic_LineInfo());
                }
            }
            foreach (XamlNode iteratorVariable1 in this.P_Element())
            {
                yield return(iteratorVariable1);
            }
        }
Пример #7
0
        private string Logic_ApplyFinalTextTrimming(XamlText text)
        {
            ScannerNodeType nextNodeType = _xamlScanner.PeekNodeType;
            string          trimmed      = text.Text;

            if (!text.IsSpacePreserved)
            {
                // Trim trailing space from text if it is the last bit of content.
                // End Element and End Property Element and Start of PE all end "content"
                if (nextNodeType == ScannerNodeType.ENDTAG || nextNodeType == ScannerNodeType.PROPERTYELEMENT || nextNodeType == ScannerNodeType.EMPTYPROPERTYELEMENT)
                {
                    trimmed = XamlText.TrimTrailingWhitespace(trimmed);
                }

                // If the text is the first thing, ie. before any element
                // OR the previous element was "TrimSurroundingWhitespace"
                // then trim leading Whitespace.
                XamlType previousObject = _context.CurrentPreviousChildType;
                if (previousObject == null || previousObject.TrimSurroundingWhitespace)
                {
                    trimmed = XamlText.TrimLeadingWhitespace(trimmed);
                }

                // If next element is "TrimSurroundingWhitespace", trim trailing WS.
                if (nextNodeType == ScannerNodeType.ELEMENT ||
                    nextNodeType == ScannerNodeType.EMPTYELEMENT)
                {
                    XamlType nextXamlType = _xamlScanner.PeekType;
                    if (nextXamlType.TrimSurroundingWhitespace)
                    {
                        trimmed = XamlText.TrimTrailingWhitespace(trimmed);
                    }
                }
            }
            return(trimmed);
        }
Пример #8
0
 public XamlUnexpectedParseException(XamlScanner xamlScanner, ScannerNodeType nodetype, string parseRule) : base(xamlScanner, System.Xaml.SR.Get("UnexpectedNodeType", new object[] { nodetype.ToString(), parseRule }))
 {
 }
Пример #9
0
        ///////////////////////////
        //  PropertyContent ::= ( PREFIXDEFINITION* Element ) | TEXT
        //
        public IEnumerable <XamlNode> P_PropertyContent()
        {
            ScannerNodeType nodeType = _xamlScanner.NodeType;
            List <XamlNode> _savedPrefixDefinitions = null;
            string          trimmed   = string.Empty;
            bool            isTextXML = false;

            switch (nodeType)
            {
            case ScannerNodeType.PREFIXDEFINITION:
            case ScannerNodeType.ELEMENT:
            case ScannerNodeType.EMPTYELEMENT:
            case ScannerNodeType.TEXT:
                if (nodeType == ScannerNodeType.TEXT)
                {
                    XamlText text = _xamlScanner.TextContent;

                    if (Logic_IsDiscardableWhitespace(text))
                    {
                        trimmed = string.Empty;
                    }
                    else
                    {
                        trimmed = Logic_ApplyFinalTextTrimming(text);
                    }

                    isTextXML = _xamlScanner.IsXDataText;
                    _xamlScanner.Read();
                    if (ProvideLineInfo)
                    {
                        yield return(Logic_LineInfo());
                    }
                    if (trimmed == string.Empty)
                    {
                        break;
                    }
                }

                // Don't immediately emit the prefix Definitions.
                // buffer them for moment because if this is the first object
                // in a collection, we may need to jam an implicit _Items property
                // in before the PrefixDef's and then the ObjectType.
                while (nodeType == ScannerNodeType.PREFIXDEFINITION)
                {
                    if (_savedPrefixDefinitions == null)
                    {
                        _savedPrefixDefinitions = new List <XamlNode>();
                    }
                    _savedPrefixDefinitions.Add(Logic_PrefixDefinition());
                    if (ProvideLineInfo)
                    {
                        _savedPrefixDefinitions.Add(Logic_LineInfo());
                    }
                    _xamlScanner.Read();
                    if (ProvideLineInfo)
                    {
                        yield return(Logic_LineInfo());
                    }
                    nodeType = _xamlScanner.NodeType;
                }

                // If this is TEXT and the current Property has a TypeConverter
                // Then emit the TEXT now.
                if (nodeType == ScannerNodeType.TEXT &&
                    _context.CurrentMember.TypeConverter != null)
                {
                    yield return(new XamlNode(XamlNodeType.Value, trimmed));
                }
                else
                {
                    // Check for any preambles we need to emit before the
                    // emitting the actual element or Text.
                    if (!_context.CurrentInCollectionFromMember)
                    {
                        // Check for and emit the get collection from member.
                        foreach (XamlNode node in LogicStream_CheckForStartGetCollectionFromMember())
                        {
                            yield return(node);
                        }
                    }

                    // We couldn't emit text in the code above (directly under the property).
                    // We have now (possibly) started a get collection from member.  This TEXT might go
                    // under the _items.
                    // This might be <XDATA>.
                    // It might still be an error, ie. Unknown Content.
                    // This is the last chance to emit the TEXT.
                    if (nodeType == ScannerNodeType.TEXT)
                    {
                        if (isTextXML)
                        {
                            yield return(Logic_StartObject(XamlLanguage.XData, null));

                            XamlMember xDataTextProperty = XamlLanguage.XData.GetMember("Text");
                            yield return(Logic_EndOfAttributes());

                            yield return(Logic_StartMember(xDataTextProperty));
                        }

                        yield return(new XamlNode(XamlNodeType.Value, trimmed));

                        if (isTextXML)
                        {
                            yield return(Logic_EndMember());

                            yield return(Logic_EndObject());
                        }
                    }
                    else
                    {
                        // Now we are ready for the given element.
                        // now emit the saved prefix definitions.
                        if (_savedPrefixDefinitions != null)
                        {
                            for (int i = 0; i < _savedPrefixDefinitions.Count; i++)
                            {
                                yield return(_savedPrefixDefinitions[i]);
                            }
                        }

                        foreach (XamlNode node in P_Element())
                        {
                            yield return(node);
                        }
                    }
                }
                break;
            }
        }
Пример #10
0
        ///////////////////////////
        //  ElementContent ::= ( PREFIXDEFINITION* Element ) | TEXT
        //
        public IEnumerable <XamlNode> P_ElementContent()
        {
            XamlType currentType = _context.CurrentType;

            List <XamlNode> savedPrefixDefinitions = null;
            ScannerNodeType nodeType = _xamlScanner.NodeType;

            switch (nodeType)
            {
            case ScannerNodeType.PREFIXDEFINITION:
            case ScannerNodeType.ELEMENT:
            case ScannerNodeType.EMPTYELEMENT:
            case ScannerNodeType.TEXT:
                if (nodeType == ScannerNodeType.TEXT)
                {
                    XamlText text = _xamlScanner.TextContent;

                    if (Logic_IsDiscardableWhitespace(text))
                    {
                        _xamlScanner.Read();
                        if (ProvideLineInfo)
                        {
                            yield return(Logic_LineInfo());
                        }
                        break;
                    }
                }

                // Don't immediately emit the prefix Definitions.
                // buffer them for moment because if this is the first object
                // in a collection, we may need to jam an implicit _Items property
                // on Content Property in before the PrefixDef's and then the ObjectType.
                while (nodeType == ScannerNodeType.PREFIXDEFINITION)
                {
                    if (savedPrefixDefinitions == null)
                    {
                        savedPrefixDefinitions = new List <XamlNode>();
                    }
                    if (ProvideLineInfo)
                    {
                        savedPrefixDefinitions.Add(Logic_LineInfo());
                    }
                    savedPrefixDefinitions.Add(Logic_PrefixDefinition());
                    _xamlScanner.Read();
                    if (ProvideLineInfo)
                    {
                        yield return(Logic_LineInfo());
                    }
                    nodeType = _xamlScanner.NodeType;
                }

                // Check for any preambles we need to emit before the
                // emitting the actual element or Text.
                bool isTextInitialization = false;
                if (!_context.CurrentInItemsProperty && !_context.CurrentInUnknownContent)
                {
                    bool isContentProperty = false;
                    // In case of text, we look first for a string or object content property,
                    // then a TypeConverter
                    if (nodeType == ScannerNodeType.TEXT)
                    {
                        if (currentType.ContentProperty != null && CanAcceptString(currentType.ContentProperty))
                        {
                            isContentProperty = true;
                        }
                        // If there have been "real" properties then we are forced to use the
                        // Constructor.  Otherwise we can consider a TypeConverter on the TEXT.
                        else if (!_context.CurrentForcedToUseConstructor &&
                                 !_xamlScanner.TextContent.IsEmpty &&
                                 currentType.TypeConverter != null)
                        {
                            isTextInitialization = true;
                        }
                    }
                    // Otherwise, we look first for a collection, and then fall back to content property
                    if (!isTextInitialization && !isContentProperty)
                    {
                        // If we are first in a collection
                        if (currentType.IsCollection || currentType.IsDictionary)
                        {
                            yield return(Logic_StartItemsProperty(currentType));
                        }
                        else  // Back to ContentProperty (either element or unknown content)
                        {
                            isContentProperty = true;
                        }
                    }
                    // Don't yield more than one unknown content property for multiple,
                    // contiguous content objects and values.
                    if (isContentProperty && !_context.CurrentInUnknownContent)
                    {
                        XamlMember contentProperty = currentType.ContentProperty;
                        if (contentProperty != null)
                        {
                            bool isVisible = _context.IsVisible(
                                contentProperty, _context.CurrentTypeIsRoot ? _context.CurrentType : null);
                            // Visible content properties produce known members.
                            // Invisible content properties produce unknown members.
                            // Protected content properties of root instances and internal
                            // content properties can be visible, depending on the reader settings.
                            if (!isVisible)
                            {
                                // We use the current type, not the actual declaring type of the non-visible property,
                                // for consistency with how non-visible PEs and Attribute Properties are handled.
                                contentProperty = new XamlMember(contentProperty.Name, currentType, false);
                            }
                        }
                        // A null argument produces an unknown content member.
                        yield return(Logic_StartContentProperty(contentProperty));

                        // Check for and emit the get collection from member.
                        foreach (XamlNode node in LogicStream_CheckForStartGetCollectionFromMember())
                        {
                            yield return(node);
                        }
                    }
                }

                // Now we are ready for the given element.
                // so now emit the saved prefix definitions.
                if (savedPrefixDefinitions != null)
                {
                    for (int i = 0; i < savedPrefixDefinitions.Count; i++)
                    {
                        yield return(savedPrefixDefinitions[i]);
                    }
                    if (ProvideLineInfo)
                    {
                        yield return(Logic_LineInfo());
                    }
                }

                if (nodeType == ScannerNodeType.TEXT)
                {
                    XamlText text        = _xamlScanner.TextContent;
                    string   trimmed     = Logic_ApplyFinalTextTrimming(text);
                    bool     isXDataText = _xamlScanner.IsXDataText;
                    _xamlScanner.Read();
                    if (ProvideLineInfo)
                    {
                        yield return(Logic_LineInfo());
                    }

                    if (trimmed == string.Empty)
                    {
                        break;
                    }

                    if (isTextInitialization)
                    {
                        yield return(Logic_StartInitProperty(currentType));
                    }

                    if (isXDataText)
                    {
                        yield return(Logic_StartObject(XamlLanguage.XData, null));

                        XamlMember xDataTextProperty = XamlLanguage.XData.GetMember("Text");
                        yield return(Logic_EndOfAttributes());

                        yield return(Logic_StartMember(xDataTextProperty));
                    }

                    yield return(new XamlNode(XamlNodeType.Value, trimmed));

                    if (isXDataText)
                    {
                        yield return(Logic_EndMember());

                        yield return(Logic_EndObject());
                    }
                }
                else
                {
                    foreach (XamlNode node in P_Element())
                    {
                        yield return(node);
                    }
                }

                // If we are not in an items or unknown content property, then
                // there cannot be more objects or values that follow this content
                // (a singular property), and thus we can end this property now.
                if (!_context.CurrentInItemsProperty && !_context.CurrentInUnknownContent)
                {
                    yield return(Logic_EndMember());
                }
                break;
            } // end switch
        }
Пример #11
0
        ///////////////////////////
        //  NonemptyPropertyElement ::= PROPERTYELEMENT PropertyContent* ENDTAG
        //
        public IEnumerable <XamlNode> P_NonemptyPropertyElement()
        {
            if (_xamlScanner.NodeType != ScannerNodeType.PROPERTYELEMENT)
            {
                throw new XamlUnexpectedParseException(_xamlScanner, _xamlScanner.NodeType,
                                                       SR.Get(SRID.NonemptyPropertyElementRuleException));
            }
            yield return(Logic_StartMember(_xamlScanner.PropertyElement));

            _xamlScanner.Read();
            if (ProvideLineInfo)
            {
                yield return(Logic_LineInfo());
            }

            bool doingPropertyContent = true;

            do
            {
                ScannerNodeType nodeType = _xamlScanner.NodeType;
                switch (nodeType)
                {
                case ScannerNodeType.PREFIXDEFINITION:
                case ScannerNodeType.ELEMENT:
                case ScannerNodeType.EMPTYELEMENT:
                case ScannerNodeType.TEXT:
                    do
                    {
                        foreach (XamlNode node in P_PropertyContent())
                        {
                            yield return(node);
                        }
                        nodeType = _xamlScanner.NodeType;
                    } while (nodeType == ScannerNodeType.PREFIXDEFINITION ||
                             nodeType == ScannerNodeType.ELEMENT ||
                             nodeType == ScannerNodeType.EMPTYELEMENT ||
                             nodeType == ScannerNodeType.TEXT);
                    // If the above started a container directive, end the collection.
                    if (_context.CurrentInItemsProperty || _context.CurrentInInitProperty)
                    {
                        yield return(Logic_EndMember());   // Pseudo container property.

                        if (_context.CurrentInCollectionFromMember)
                        {
                            yield return(Logic_EndObject());    // Getter pseudo Object

                            _context.CurrentInCollectionFromMember = false;
                            if (_context.CurrentInImplicitArray)
                            {
                                _context.CurrentInImplicitArray = false;
                                yield return(Logic_EndMember());

                                yield return(Logic_EndObject());
                            }
                        }
                    }
                    break;

                default:
                    doingPropertyContent = false;
                    break;
                }
            } while (doingPropertyContent);


            if (_xamlScanner.NodeType != ScannerNodeType.ENDTAG)
            {
                throw new XamlUnexpectedParseException(_xamlScanner, _xamlScanner.NodeType,
                                                       SR.Get(SRID.NonemptyPropertyElementRuleException));
            }
            yield return(Logic_EndMember());

            _xamlScanner.Read();
            if (ProvideLineInfo)
            {
                yield return(Logic_LineInfo());
            }
        }
Пример #12
0
        ///////////////////////////
        //  ElementBody ::= ATTRIBUTE* ( PropertyElement | ElementContent+ )* ENDTAG
        //
        public IEnumerable <XamlNode> P_ElementBody()
        {
            while (_xamlScanner.NodeType == ScannerNodeType.ATTRIBUTE)
            {
                foreach (XamlNode node in LogicStream_Attribute())
                {
                    yield return(node);
                }
                _xamlScanner.Read();
                if (ProvideLineInfo)
                {
                    yield return(Logic_LineInfo());
                }
            }

            yield return(Logic_EndOfAttributes());

            bool doneWithElementContent = false;
            bool hasContent             = false;

            do
            {
                ScannerNodeType nodeType = _xamlScanner.NodeType;
                switch (nodeType)
                {
                case ScannerNodeType.PROPERTYELEMENT:
                case ScannerNodeType.EMPTYPROPERTYELEMENT:
                    hasContent = true;
                    foreach (XamlNode node in P_PropertyElement())
                    {
                        yield return(node);
                    }
                    break;

                case ScannerNodeType.PREFIXDEFINITION:
                case ScannerNodeType.ELEMENT:
                case ScannerNodeType.EMPTYELEMENT:
                case ScannerNodeType.TEXT:
                    hasContent = true;
                    do
                    {
                        foreach (XamlNode node in P_ElementContent())
                        {
                            yield return(node);
                        }
                        nodeType = _xamlScanner.NodeType;
                    } while (nodeType == ScannerNodeType.PREFIXDEFINITION ||
                             nodeType == ScannerNodeType.ELEMENT ||
                             nodeType == ScannerNodeType.EMPTYELEMENT ||
                             nodeType == ScannerNodeType.TEXT);

                    // If the above started a container directive or an unknown content property, then end the collection.
                    if (_context.CurrentInItemsProperty || _context.CurrentInInitProperty || _context.CurrentInUnknownContent)
                    {
                        yield return(Logic_EndMember()); // Container or unknown content property.

                        if (_context.CurrentInCollectionFromMember)
                        {
                            yield return(Logic_EndObject());   // Getter pseudo Object

                            yield return(Logic_EndMember());   // Content Property

                            _context.CurrentInCollectionFromMember = false;
                            if (_context.CurrentInImplicitArray)
                            {
                                _context.CurrentInImplicitArray = false;
                                yield return(Logic_EndObject());

                                yield return(Logic_EndMember());
                            }
                        }
                    }
                    break;

                case ScannerNodeType.ENDTAG:
                    // <Foo></Foo> if foo has no default constructor we need to output SM _Initialization V "" EM
                    XamlType currentType      = _context.CurrentType;
                    bool     hasTypeConverter = currentType.TypeConverter != null;
                    bool     isConstructable  = currentType.IsConstructible && !currentType.ConstructionRequiresArguments;
                    if (!hasContent && hasTypeConverter && !isConstructable)
                    {
                        yield return(Logic_StartInitProperty(currentType));

                        yield return(new XamlNode(XamlNodeType.Value, string.Empty));

                        yield return(Logic_EndMember());
                    }
                    doneWithElementContent = true;
                    break;

                default:
                    doneWithElementContent = true;
                    break;
                }
            } while (!doneWithElementContent);

            if (_xamlScanner.NodeType != ScannerNodeType.ENDTAG)
            {
                throw new XamlUnexpectedParseException(_xamlScanner, _xamlScanner.NodeType,
                                                       SR.Get(SRID.ElementBodyRuleException));
            }
            yield return(Logic_EndObject());

            _xamlScanner.Read();
            if (ProvideLineInfo)
            {
                yield return(Logic_LineInfo());
            }
        }
Пример #13
0
        // FxCop says this is never called
        //public XamlUnexpectedParseException(string message)
        //    : base(message) { }

        // FxCop says this is never called
        //public XamlUnexpectedParseException(string message, Exception innerException)
        //    : base(message, innerException) { }

        public XamlUnexpectedParseException(XamlScanner xamlScanner, ScannerNodeType nodetype, string parseRule)
            : base(xamlScanner, SR.Get(SRID.UnexpectedNodeType, nodetype.ToString(), parseRule))
        {
        }
        public IEnumerable <XamlNode> P_PropertyContent()
        {
            ScannerNodeType nodeType          = this._xamlScanner.NodeType;
            List <XamlNode> iteratorVariable1 = null;
            string          data      = string.Empty;
            bool            isTextXML = false;

            switch (nodeType)
            {
            default:
            {
                goto Label_04E6;
                if (nodeType != ScannerNodeType.TEXT)
                {
                    break;
                }
                XamlText textContent = this._xamlScanner.TextContent;
                if (this.Logic_IsDiscardableWhitespace(textContent))
                {
                    data = string.Empty;
                }
                else
                {
                    data = this.Logic_ApplyFinalTextTrimming(textContent);
                }
                isTextXML = this._xamlScanner.IsTextXML;
                this._xamlScanner.Read();
                if (this.ProvideLineInfo)
                {
                    yield return(this.Logic_LineInfo());
                }
                if (!(data == string.Empty))
                {
                    break;
                }
                goto Label_04E6;
            }
            }
            while (nodeType == ScannerNodeType.PREFIXDEFINITION)
            {
                if (iteratorVariable1 == null)
                {
                    iteratorVariable1 = new List <XamlNode>();
                }
                iteratorVariable1.Add(this.Logic_PrefixDefinition());
                if (this.ProvideLineInfo)
                {
                    iteratorVariable1.Add(this.Logic_LineInfo());
                }
                this._xamlScanner.Read();
                if (this.ProvideLineInfo)
                {
                    yield return(this.Logic_LineInfo());
                }
                nodeType = this._xamlScanner.NodeType;
            }
            if ((nodeType == ScannerNodeType.TEXT) && (this._context.CurrentMember.TypeConverter != null))
            {
                yield return(new XamlNode(XamlNodeType.Value, data));
            }
            else
            {
                if (!this._context.CurrentInCollectionFromMember)
                {
                    foreach (XamlNode iteratorVariable5 in this.LogicStream_CheckForStartGetCollectionFromMember())
                    {
                        yield return(iteratorVariable5);
                    }
                }
                if (nodeType == ScannerNodeType.TEXT)
                {
                    if (isTextXML)
                    {
                        yield return(this.Logic_StartObject(XamlLanguage.XData, null));

                        XamlMember member = XamlLanguage.XData.GetMember("Text");
                        yield return(this.Logic_EndOfAttributes());

                        yield return(this.Logic_StartMember(member));
                    }
                    yield return(new XamlNode(XamlNodeType.Value, data));

                    if (isTextXML)
                    {
                        yield return(this.Logic_EndMember());

                        yield return(this.Logic_EndObject());
                    }
                }
                else
                {
                    if (iteratorVariable1 != null)
                    {
                        for (int i = 0; i < iteratorVariable1.Count; i++)
                        {
                            yield return(iteratorVariable1[i]);
                        }
                    }
                    foreach (XamlNode iteratorVariable8 in this.P_Element())
                    {
                        yield return(iteratorVariable8);
                    }
                }
            }
Label_04E6:
            yield break;
        }
        public IEnumerable <XamlNode> P_ElementContent()
        {
            XamlType        currentType       = this._context.CurrentType;
            List <XamlNode> iteratorVariable1 = null;
            ScannerNodeType nodeType          = this._xamlScanner.NodeType;

            switch (nodeType)
            {
            default:
            {
                goto Label_0727;
                if (nodeType != ScannerNodeType.TEXT)
                {
                    break;
                }
                XamlText textContent = this._xamlScanner.TextContent;
                if (!this.Logic_IsDiscardableWhitespace(textContent))
                {
                    break;
                }
                this._xamlScanner.Read();
                if (this.ProvideLineInfo)
                {
                    yield return(this.Logic_LineInfo());
                }
                goto Label_0727;
            }
            }
            while (nodeType == ScannerNodeType.PREFIXDEFINITION)
            {
                if (iteratorVariable1 == null)
                {
                    iteratorVariable1 = new List <XamlNode>();
                }
                iteratorVariable1.Add(this.Logic_PrefixDefinition());
                if (this.ProvideLineInfo)
                {
                    iteratorVariable1.Add(this.Logic_LineInfo());
                }
                this._xamlScanner.Read();
                if (this.ProvideLineInfo)
                {
                    yield return(this.Logic_LineInfo());
                }
                nodeType = this._xamlScanner.NodeType;
            }
            bool iteratorVariable4 = false;

            if (!this._context.CurrentInItemsProperty)
            {
                bool iteratorVariable5 = false;
                if (nodeType == ScannerNodeType.TEXT)
                {
                    if ((currentType.ContentProperty != null) && CanAcceptString(currentType.ContentProperty))
                    {
                        iteratorVariable5 = true;
                    }
                    else if ((!this._context.CurrentForcedToUseConstructor && !this._xamlScanner.TextContent.IsEmpty) && (currentType.TypeConverter != null))
                    {
                        iteratorVariable4 = true;
                    }
                }
                if (!iteratorVariable4 && !iteratorVariable5)
                {
                    if (currentType.IsCollection || currentType.IsDictionary)
                    {
                        yield return(this.Logic_StartItemsProperty(currentType));
                    }
                    else
                    {
                        iteratorVariable5 = true;
                    }
                }
                if (iteratorVariable5 && !this._context.CurrentIsUnknownContent)
                {
                    XamlMember contentProperty = currentType.ContentProperty;
                    if ((contentProperty != null) && !this._context.IsVisible(contentProperty, this._context.CurrentTypeIsRoot ? this._context.CurrentType : null))
                    {
                        contentProperty = new XamlMember(contentProperty.Name, currentType, false);
                    }
                    yield return(this.Logic_StartContentProperty(contentProperty));

                    foreach (XamlNode iteratorVariable7 in this.LogicStream_CheckForStartGetCollectionFromMember())
                    {
                        yield return(iteratorVariable7);
                    }
                }
            }
            if (iteratorVariable1 != null)
            {
                for (int i = 0; i < iteratorVariable1.Count; i++)
                {
                    yield return(iteratorVariable1[i]);
                }
            }
            if (nodeType == ScannerNodeType.TEXT)
            {
                XamlText text      = this._xamlScanner.TextContent;
                string   data      = this.Logic_ApplyFinalTextTrimming(text);
                bool     isTextXML = this._xamlScanner.IsTextXML;
                this._xamlScanner.Read();
                if (this.ProvideLineInfo)
                {
                    yield return(this.Logic_LineInfo());
                }
                if (data == string.Empty)
                {
                    goto Label_0727;
                }
                if (iteratorVariable4)
                {
                    yield return(this.Logic_StartInitProperty(currentType));
                }
                if (isTextXML)
                {
                    yield return(this.Logic_StartObject(XamlLanguage.XData, null));

                    XamlMember member = XamlLanguage.XData.GetMember("Text");
                    yield return(this.Logic_EndOfAttributes());

                    yield return(this.Logic_StartMember(member));
                }
                yield return(new XamlNode(XamlNodeType.Value, data));

                if (isTextXML)
                {
                    yield return(this.Logic_EndMember());

                    yield return(this.Logic_EndObject());
                }
            }
            else
            {
                IEnumerator <XamlNode> enumerator = this.P_Element().GetEnumerator();
                while (enumerator.MoveNext())
                {
                    XamlNode current = enumerator.Current;
                    yield return(current);
                }
            }
            if (!this._context.CurrentInItemsProperty && !this._context.CurrentIsUnknownContent)
            {
                yield return(this.Logic_EndMember());
            }
Label_0727:
            yield break;
        }