Parse() public method

public Parse ( string text, int lineNumber, int linePosition ) : IEnumerable
text string
lineNumber int
linePosition int
return IEnumerable
Beispiel #1
0
 public void MePullParser_Parse ()
 {
     const string me = "{Binding 1, 2, Path=Name, Converter={StaticResource MyRes}, ConverterParameter={x:Static Window.LeftProperty}}";
     var xamlGenerator = new XamlGenerator(null, null, null);
     var xamlSchema = new XamlSchemaContext( /*new[] { PresentationCore, PresentationFramework }*/);
     var xamlContext = new XamlParserContext(xamlSchema, GetType().Assembly);
     xamlContext.AddNamespacePrefix("", xamlGenerator.Ns.NamespaceName);
     xamlContext.AddNamespacePrefix("x", xamlGenerator.NsX.NamespaceName);
     var meParser = new MePullParser(xamlContext);
     var sb = new StringBuilder();
     foreach (XamlNode xamlNode in meParser.Parse(me, 0, 0))
         sb.AppendFormat("{0}\n", xamlNode);
     //throw new Exception(SR.Get("MissingImplicitPropertyTypeCase"));
     throw new Exception(sb.ToString());
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
        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 = SR.Get("MissingComma1", new object[] { this._tokenizer.TokenText });
                        }
                        else {
                            str = 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();
            }
        }