Beispiel #1
0
        internal static bool TryParse(Node parent, Queue<Word> remainingWords, out Parameters parameters)
        {
            if (remainingWords.Count == 0 ||
                remainingWords.Peek().Text != "(")
            {
                parameters = null;
                return false;
            }
            remainingWords.Dequeue();

            parameters = new Parameters(parent);
            while (remainingWords.Peek().Text != ")")
            {
                if (remainingWords.Peek().Text == ",")
                {
                    remainingWords.Dequeue();
                    continue;
                }

                Expression expression;
                if (Expression.TryParse(parent, remainingWords, out expression))
                {
                    parameters.Children.Add(expression);
                    continue;
                }
            }
            remainingWords.Dequeue();

            return true;
        }
Beispiel #2
0
 public override Node Clone(Node newParent)
 {
     var newParameters = new Parameters(newParent);
     foreach (var child in Children)
     {
         newParameters.Children.Add(child.Clone(newParameters));
     }
     return newParameters;
 }