예제 #1
0
        public override ParserElementBase CloneForParse(TextBuffer buffer)
        {
            var element = new Optional(ChildNodes.Select(r => ((ParserElementBase)r).CloneForParse(buffer)).ToArray());// { Parser = Parser };

            element.TextBuffer = buffer;
            return(element);
        }
예제 #2
0
파일: Stmts.cs 프로젝트: baban/lp
        protected override object DoEvaluate(ScriptThread thread)
        {
            thread.CurrentNode = this;
            var result = ChildNodes.Select((node) => node.Evaluate(thread).ToString()).Aggregate((a, b) => a + "; " + b).ToString();

            thread.CurrentNode = Parent;
            return(result);
        }
예제 #3
0
파일: Assoc.cs 프로젝트: baban/lp
        protected override object DoEvaluate(ScriptThread thread)
        {
            thread.CurrentNode = this;
            var result = ChildNodes.Select((node) => (Object.LpObject[])node.Evaluate(thread)).ToDictionary(pairs => pairs[0], pairs => pairs[1]);

            thread.CurrentNode = Parent;
            return(result);
        }
예제 #4
0
파일: Args.cs 프로젝트: baban/lp
        protected override object DoEvaluate(ScriptThread thread)
        {
            thread.CurrentNode = this;
            Object.LpObject[] result = ChildNodes.Select((node) => (Object.LpObject)node.Evaluate(thread)).ToArray();
            thread.CurrentNode = Parent;

            return(result);
        }
예제 #5
0
파일: WhenStmts.cs 프로젝트: baban/lp
        protected override object DoEvaluate(ScriptThread thread)
        {
            thread.CurrentNode = this;

            var result = ChildNodes.Select((node) => { return((AstNode[])node.Evaluate(thread)); }).ToArray();

            thread.CurrentNode = Parent;

            return(result);
        }
예제 #6
0
        private void RootNode_SizeChanged(object sender, EventArgs e)
        {
            if (flowLayoutPanel.Controls.Count == 0)
            {
                return;
            }

            _childrenSize.Height = ChildNodes.Select(node => node.Size).Sum(size => size.Height);
            ApplyExpandedCollapsed();
        }
예제 #7
0
        public Size LayoutNode()
        {
            List <Size> childSizes = ChildNodes.Select(node => node.LayoutNode()).ToList();

            _childrenSize.Height = childSizes.Sum(size => size.Height);
            _childrenSize.Width  = childSizes.Max(size => size.Width);
            labelNodeName.Text   = NodeName;
            ApplyExpandedCollapsed();
            ChildNodes.ForEach(node => flowLayoutPanel.Controls.Add((UserControl)node));
            return(Size);
        }
예제 #8
0
        public override string ToString()
        {
            var attributeString = Attributes.Count == 0
                ? ""
                : string.Join("", Attributes
                              .Select(tuple => $" {tuple.Key}=\"{tuple.Value}\""));

            var contentString = ChildNodes.Count == 0
                ? ""
                : string.Join("", ChildNodes.Select(child => child.ToString()));

            return($"<{Tag}{attributeString}>{contentString}</{Tag}>");
        }
예제 #9
0
 public override string GenerateScript(LanguageOption options, int indentationlevel = 0)
 {
     if (token != null)
     {
         return(token.Text);
     }
     if (UoToken != null)
     {
         return(UoToken.Value);
     }
     return(string.Join(",", ChildNodes.Select(
                            expression => string.Format(((ExpressionNode)expression).ChildNodes.Count == 0 ? "{0}" : "{1}{0}{2}", ((ExpressionNode)expression).GenerateScript(options), Punct.LPara, Punct.RPara)
                            )));
 }
예제 #10
0
 /// <summary>
 /// Copies an existing sitemap node and all properties
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public SiteMapNode Copy()
 {
     return(new SiteMapNode
     {
         Action = Action,
         Area = Area,
         Attributes = new Dictionary <string, object>(Attributes),
         ChildNodes = ChildNodes.Select(n => n.Copy()).ToList(),
         Clickable = Clickable,
         Controller = Controller,
         Description = Description,
         DynamicNodeProvider = DynamicNodeProvider,
         HttpMethod = HttpMethod,
         ImageUrl = ImageUrl,
         Key = Key,
         Order = Order,
         TargetFrame = TargetFrame,
         Title = Title,
         Url = Url,
         UnresolvedUrl = UnresolvedUrl
     });
 }
예제 #11
0
파일: Node.cs 프로젝트: mdsharpe/aoc2018
 public int GetMetadataSum()
 {
     return(Metadata.DefaultIfEmpty().Sum()
            + ChildNodes.Select(o => o.GetMetadataSum()).DefaultIfEmpty().Sum());
 }
예제 #12
0
 public void ExpandAll(bool expanded)
 {
     Expanded = expanded;
     ChildNodes.Select(node => node as IRootNode).Where(node => node != null).ToList().ForEach(node => node.ExpandAll(expanded));
 }
예제 #13
0
 protected ParserElementBase[] CloneSubElementsForParse(TextBuffer buffer)
 {
     return(ChildNodes.Select(r => r.CloneForParse(buffer)).ToArray());
 }
예제 #14
0
        public override string GetGrammar()
        {
            string Grammar = string.Join(" ", ChildNodes.Select(s => s.GetGrammar()).ToArray());

            return(Grammar);
        }
예제 #15
0
 public override string GenerateScript(LanguageOption options, int indentationlevel = 0)
 {
     return(GenerateBlock(ChildNodes.Select(node => node as IStatement).ToArray(), options, indentationlevel));
 }