Esempio n. 1
0
        public override bool TryCreate(List <string> lines, CalculationBuilder builder, out CalculationItem item)
        {
            bool isMatch = (lines.First() == "{");

            if (!isMatch)
            {
                item = null;
                return(false);
            }


            EquationBlock block = new EquationBlock();

            int level = 0;

            builder.RemoveLines(lines, 1);
            for ( ; ;)
            {
                CalculationItem eq = builder.Create(lines);
                block.Equations.Add(eq);

                string currentLine = lines.First();
                if (currentLine == "}")
                {
                    if (level == 0)
                    {
                        break;
                    }
                    else
                    {
                        level--;
                    }
                }
            }

            builder.RemoveLines(lines, 1);
            item = block;
            return(true);
        }
Esempio n. 2
0
 public abstract bool TryCreate(List <string> lines, CalculationBuilder builder, out CalculationItem item);