public bool TryParse(string sourceText, out MarkupExtension graph) { graph = null; try { ParseTree tree = _parser.Parse(sourceText); #if DEBUG // Save result tree for debugging purposes LastParseTree = tree; LastException = null; #endif if (tree.Status == ParseTreeStatus.Parsed) { graph = MarkupExtension.Create(tree.Root); return(true); } } #if DEBUG catch (Exception ex) { LastParseTree = null; LastException = ex; } #else catch { // ignored } #endif return(false); }
public static Value Create(ParseTreeNode node) { return(LiteralValue.Create(node) ?? (Value)MarkupExtension.Create(node)); }