Exemple #1
0
    public WList <T> Clone()
    {
        WList <T> clone = new WList <T>();

        clone.AddRange(this);

        return(clone);
    }
Exemple #2
0
        public LNode Vars(LNode type, params LNode[] namesWithValues)
        {
            type = type ?? Missing;
            var list = new WList <LNode>()
            {
                type
            };

            list.AddRange(namesWithValues);
            return(Call(S.Var, list.ToVList()));
        }
Exemple #3
0
 public static void SpliceAdd(this WList <LNode> list, LNode node, Symbol listName = null)
 {
     if (node.Calls(listName ?? CodeSymbols.Splice))
     {
         list.AddRange(node.Args);
     }
     else
     {
         list.Add(node);
     }
 }
Exemple #4
0
            private void AddUserAction(VList <LNode> actions)
            {
                int i = _target.Count;

                _target.AddRange(actions);

                if (actions.Any(stmt => stmt.Range.StartIndex > 0))
                {
                    if (LLPG.AddCsLineDirectives)
                    {
                        // Remove folder name. This only makes sense if the output
                        // file and input file are in the same folder; sadly we have
                        // no access to the output file name, but as of 2015-05 it's
                        // always true that the output file will be in the same folder.
                        string filename = System.IO.Path.GetFileName(_target[i].Range.Source.FileName);
                        var    newline  = F.Id(S.TriviaNewline);
                        int    line     = 0;
                        for (; i < _target.Count; i++, line++)
                        {
                            var r = _target[i].Range;
                            if (line != r.Start.Line)
                            {
                                line = r.Start.Line;
                                if (line <= 0)                                 // sometimes occurs for generated `return result` statement
                                {
                                    _target.Insert(i++, F.Trivia(S.CsPPRawText, "#line default"));
                                }
                                else
                                {
                                    _target.Insert(i++, F.Trivia(S.CsPPRawText, "#line " + line + " " + Ecs.EcsNodePrinter.PrintString(filename, '"')));
                                }
                            }
                        }
                        if (line > 1)
                        {
                            _target.Add(F.Trivia(S.CsPPRawText, "#line default"));
                        }
                    }
                    else
                    {
                        _target[i] = _target[i].PlusAttr(F.Trivia(S.TriviaSLComment,
                                                                  string.Format(" line {0}", _target[i].Range.Start.Line)));
                    }
                }
            }
Exemple #5
0
		public LNode Vars(LNode type, params LNode[] namesWithValues)
		{
			type = type ?? Missing;
			var list = new WList<LNode>() { type };
			list.AddRange(namesWithValues);
			return Call(S.Var, list.ToVList());
		}