예제 #1
0
파일: XamlPullParser.cs 프로젝트: wwl50/wpf
        private IEnumerable <XamlNode> LogicStream_Attribute()
        {
            XamlMember property = _xamlScanner.PropertyAttribute;
            XamlText   text     = _xamlScanner.PropertyAttributeText;

            if (_xamlScanner.IsCtorForcingMember)
            {
                _context.CurrentForcedToUseConstructor = true;
            }

            XamlNode startProperty = new XamlNode(XamlNodeType.StartMember, property);

            yield return(startProperty);

            if (text.LooksLikeAMarkupExtension)
            {
                MePullParser me = new MePullParser(_context);
                foreach (XamlNode node in me.Parse(text.Text, LineNumber, LinePosition))
                {
                    yield return(node);
                }
            }
            else
            {
                XamlNode textNode = new XamlNode(XamlNodeType.Value, text.AttributeText);
                yield return(textNode);
            }
            yield return(new XamlNode(XamlNodeType.EndMember));
        }
        private IEnumerable <XamlNode> LogicStream_Attribute()
        {
            XamlMember propertyAttribute     = this._xamlScanner.PropertyAttribute;
            XamlText   propertyAttributeText = this._xamlScanner.PropertyAttributeText;

            if (this._xamlScanner.IsCtorForcingMember)
            {
                this._context.CurrentForcedToUseConstructor = true;
            }
            XamlNode iteratorVariable2 = new XamlNode(XamlNodeType.StartMember, propertyAttribute);

            yield return(iteratorVariable2);

            if (propertyAttributeText.LooksLikeAMarkupExtension)
            {
                MePullParser iteratorVariable3 = new MePullParser(this._context);
                foreach (XamlNode iteratorVariable4 in iteratorVariable3.Parse(propertyAttributeText.Text, this.LineNumber, this.LinePosition))
                {
                    yield return(iteratorVariable4);
                }
            }
            else
            {
                XamlNode iteratorVariable5 = new XamlNode(XamlNodeType.Value, propertyAttributeText.AttributeText);
                yield return(iteratorVariable5);
            }
            yield return(new XamlNode(XamlNodeType.EndMember));
        }
        private IEnumerable <XamlNode> P_Value(Found f)
        {
            Found iteratorVariable0 = new Found();

            switch (this._tokenizer.Token)
            {
            case MeTokenType.QuotedMarkupExtension:
            {
                MePullParser iteratorVariable1 = new MePullParser(this._context);
                foreach (XamlNode iteratorVariable2 in iteratorVariable1.Parse(this._tokenizer.TokenText, this.LineNumber, this.LinePosition))
                {
                    yield return(iteratorVariable2);
                }
                f.found = true;
                this.NextToken();
                break;
            }

            case MeTokenType.Open:
            {
                IEnumerator <XamlNode> enumerator = this.P_MarkupExtension(iteratorVariable0).GetEnumerator();
                while (enumerator.MoveNext())
                {
                    XamlNode current = enumerator.Current;
                    yield return(current);
                }
                f.found = iteratorVariable0.found;
                break;
            }

            default:
                break;
                yield return(this.Logic_Text());

                f.found = true;
                this.NextToken();
                break;
            }
        }
예제 #4
0
        ////////////////////////////////
        //   Value   ::= (STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
        //
        private IEnumerable <XamlNode> P_Value(Found f)
        {
            Found f2 = new Found();

            //   Value   ::= @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
            switch (_tokenizer.Token)
            {
            //   Value   ::= (@STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
            case MeTokenType.String:
                yield return(Logic_Text());

                f.found = true;
                NextToken();
                break;

            //   Value   ::= (STRING | @QUOTEDMARKUPEXTENSION | MarkupExtension)
            case MeTokenType.QuotedMarkupExtension:
                MePullParser nestedParser = new MePullParser(_context);
                foreach (XamlNode node in nestedParser.Parse(_tokenizer.TokenText, LineNumber, LinePosition))
                {
                    yield return(node);
                }
                f.found = true;
                NextToken();
                break;

            //   Value   ::= (STRING | QUOTEDMARKUPEXTENSION | @MarkupExtension)
            case MeTokenType.Open:
                foreach (XamlNode node in P_MarkupExtension(f2))
                {
                    yield return(node);
                }
                f.found = f2.found;
                break;

            default:
                break;
            }
        }
 private IEnumerable<XamlNode> P_Value(Found f)
 {
     Found iteratorVariable0 = new Found();
     switch (this._tokenizer.Token)
     {
         case MeTokenType.QuotedMarkupExtension:
         {
             MePullParser iteratorVariable1 = new MePullParser(this._context);
             foreach (XamlNode iteratorVariable2 in iteratorVariable1.Parse(this._tokenizer.TokenText, this.LineNumber, this.LinePosition))
             {
                 yield return iteratorVariable2;
             }
             f.found = true;
             this.NextToken();
             break;
         }
         case MeTokenType.Open:
         {
             IEnumerator<XamlNode> enumerator = this.P_MarkupExtension(iteratorVariable0).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 XamlNode current = enumerator.Current;
                 yield return current;
             }
             f.found = iteratorVariable0.found;
             break;
         }
         default:
             break;
             yield return this.Logic_Text();
             f.found = true;
             this.NextToken();
             break;
     }
 }
        private IEnumerable<XamlNode> P_NamedArg(Found f)
        {
            Found iteratorVariable0 = new Found();
            if (this._tokenizer.Token == MeTokenType.PropertyName)
            {
                XamlMember tokenProperty = this._tokenizer.TokenProperty;
                yield return this.Logic_StartMember();
                this.NextToken();
                this.Expect(MeTokenType.EqualSign, "NamedArg ::= PROPERTYNAME @'=' Value");
                this.NextToken();
                switch (this._tokenizer.Token)
                {
                    case MeTokenType.PropertyName:
                        string str;
                        if (this._context.CurrentMember == null)
                        {
                            str = System.Xaml.SR.Get("MissingComma1", new object[] { this._tokenizer.TokenText });
                        }
                        else
                        {
                            str = System.Xaml.SR.Get("MissingComma2", new object[] { this._context.CurrentMember.Name, this._tokenizer.TokenText });
                        }
                        throw new XamlParseException(this._tokenizer, str);

                    case MeTokenType.QuotedMarkupExtension:
                    {
                        MePullParser iteratorVariable1 = new MePullParser(this._context);
                        foreach (XamlNode iteratorVariable2 in iteratorVariable1.Parse(this._tokenizer.TokenText, this.LineNumber, this.LinePosition))
                        {
                            yield return iteratorVariable2;
                        }
                        f.found = true;
                        this.NextToken();
                        break;
                    }
                    case MeTokenType.Open:
                    {
                        IEnumerator<XamlNode> enumerator = this.P_Value(iteratorVariable0).GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            XamlNode current = enumerator.Current;
                            yield return current;
                        }
                        f.found = iteratorVariable0.found;
                        break;
                    }
                    default:
                        this.SetBrokenRuleString("NamedArg ::= PROPERTYNAME '=' @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)");
                        break;
                        yield return this.Logic_Text();
                        f.found = true;
                        this.NextToken();
                        break;
                }
                yield return this.Logic_EndMember();
            }
        }
        private IEnumerable <XamlNode> P_NamedArg(Found f)
        {
            Found iteratorVariable0 = new Found();

            if (this._tokenizer.Token == MeTokenType.PropertyName)
            {
                XamlMember tokenProperty = this._tokenizer.TokenProperty;
                yield return(this.Logic_StartMember());

                this.NextToken();
                this.Expect(MeTokenType.EqualSign, "NamedArg ::= PROPERTYNAME @'=' Value");
                this.NextToken();
                switch (this._tokenizer.Token)
                {
                case MeTokenType.PropertyName:
                    string str;
                    if (this._context.CurrentMember == null)
                    {
                        str = System.Xaml.SR.Get("MissingComma1", new object[] { this._tokenizer.TokenText });
                    }
                    else
                    {
                        str = System.Xaml.SR.Get("MissingComma2", new object[] { this._context.CurrentMember.Name, this._tokenizer.TokenText });
                    }
                    throw new XamlParseException(this._tokenizer, str);

                case MeTokenType.QuotedMarkupExtension:
                {
                    MePullParser iteratorVariable1 = new MePullParser(this._context);
                    foreach (XamlNode iteratorVariable2 in iteratorVariable1.Parse(this._tokenizer.TokenText, this.LineNumber, this.LinePosition))
                    {
                        yield return(iteratorVariable2);
                    }
                    f.found = true;
                    this.NextToken();
                    break;
                }

                case MeTokenType.Open:
                {
                    IEnumerator <XamlNode> enumerator = this.P_Value(iteratorVariable0).GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        XamlNode current = enumerator.Current;
                        yield return(current);
                    }
                    f.found = iteratorVariable0.found;
                    break;
                }

                default:
                    this.SetBrokenRuleString("NamedArg ::= PROPERTYNAME '=' @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)");
                    break;
                    yield return(this.Logic_Text());

                    f.found = true;
                    this.NextToken();
                    break;
                }
                yield return(this.Logic_EndMember());
            }
        }
예제 #8
0
        ////////////////////////////////
        // NamedArg ::= PROPERTYNAME '=' (STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
        //
        private IEnumerable <XamlNode> P_NamedArg(Found f)
        {
            Found f2 = new Found();

            // NamedArg ::= @PROPERTYNAME '=' (STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
            if (_tokenizer.Token == MeTokenType.PropertyName)
            {
                XamlMember property = _tokenizer.TokenProperty;
                yield return(Logic_StartMember());

                NextToken();

                // NamedArg ::= PROPERTYNAME @'=' (STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
                Expect(MeTokenType.EqualSign, "NamedArg ::= PROPERTYNAME @'=' Value");
                NextToken();

                // NamedArg ::= PROPERTYNAME '=' @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
                switch (_tokenizer.Token)
                {
                // NamedArg ::= PROPERTYNAME '=' (@STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)
                case MeTokenType.String:
                    yield return(Logic_Text());

                    f.found = true;
                    NextToken();
                    break;

                // NamedArg ::= PROPERTYNAME '=' (STRING | @QUOTEDMARKUPEXTENSION | MarkupExtension)
                case MeTokenType.QuotedMarkupExtension:
                    MePullParser nestedParser = new MePullParser(_context);
                    foreach (XamlNode node in nestedParser.Parse(_tokenizer.TokenText, LineNumber, LinePosition))
                    {
                        yield return(node);
                    }
                    f.found = true;
                    NextToken();
                    break;

                // NamedArg ::= PROPERTYNAME '=' (STRING | QUOTEDMARKUPEXTENSION | @MarkupExtension)
                case MeTokenType.Open:
                    foreach (XamlNode node in P_Value(f2))
                    {
                        yield return(node);
                    }
                    f.found = f2.found;
                    break;

                case MeTokenType.PropertyName:
                {
                    string error;
                    if (_context.CurrentMember == null)
                    {
                        error = SR.Get(SRID.MissingComma1, _tokenizer.TokenText);
                    }
                    else
                    {
                        error = SR.Get(SRID.MissingComma2, _context.CurrentMember.Name, _tokenizer.TokenText);
                    }
                    throw new XamlParseException(_tokenizer, error);
                }

                default:
                    SetBrokenRuleString("NamedArg ::= PROPERTYNAME '=' @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)");
                    break;
                }
                yield return(Logic_EndMember());
            }
        }