Exemplo n.º 1
0
        private IExpression BuildConcatanationExpression(ParseTreeNode node)
        {
            int count = node.ChildNodes.Count;

            if (count <= 0)
            {
                throw new Exception(@"Invalid concatanation rule, no child nodes");
            }
            else if (count == 1)
            {
                return(BuildRepeationExpression(node.ChildNodes[0]));
            }
            else
            {
                var concatanation = new ConcatanationExpression();

                foreach (var child in node.ChildNodes)
                {
                    concatanation.Add(BuildRepeationExpression(child));
                }

                return(concatanation);
            }
        }
Exemplo n.º 2
0
        private IExpression BuildConcatanationExpression(ParseTreeNode node)
        {
            int count = node.ChildNodes.Count;

            if (count <= 0)
            {
                throw new BuilderException(node, @"Invalid concatanation rule, no child nodes");
            }
            else if (count == 1)
            {
                return BuildRepeationExpression(node.ChildNodes[0]);
            }
            else
            {
                var concatanation = new ConcatanationExpression();

                foreach (var child in node.ChildNodes)
                    concatanation.Add(BuildRepeationExpression(child));

                return concatanation;
            }
        }