예제 #1
0
파일: Parameters.cs 프로젝트: lzcd/Crass
        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;
        }
예제 #2
0
파일: Parameters.cs 프로젝트: lzcd/Crass
 public override Node Clone(Node newParent)
 {
     var newParameters = new Parameters(newParent);
     foreach (var child in Children)
     {
         newParameters.Children.Add(child.Clone(newParameters));
     }
     return newParameters;
 }