public bool TryParse(string sourceText, out MarkupExtension graph)
        {
            graph = null;

            try
            {
                ParseTree tree = this.parser.Parse(sourceText);
#if DEBUG
                // Save result tree for debugging purposes.
                this.LastParseTree = tree;
                this.LastException = null;
#endif
                if (tree.Status == ParseTreeStatus.Parsed)
                {
                    graph = MarkupExtension.Create(tree.Root);
                    return(true);
                }
            }
#if DEBUG
            catch (Exception ex)
            {
                this.LastParseTree = null;
                this.LastException = ex;
            }
#else
            catch
            {
                // ignored
            }
#endif
            return(false);
        }
예제 #2
0
 public static Value Create(ParseTreeNode node)
 {
     return(LiteralValue.Create(node) ?? (Value)MarkupExtension.Create(node));
 }