예제 #1
0
파일: MainForm.cs 프로젝트: krooken/jKalc
 /// <summary>
 /// Tries to parse the input expression contained in the given evaluator.
 /// </summary>
 /// <param name="evaluator">The row evaluator with the given expression.</param>
 /// <returns>True if the parse was successfull.</returns>
 private bool ParseExpression(RowEvaluator evaluator)
 {
     try
     {
         evaluator.ParseExpression();
         return(true);
     }
     catch (Exception ex)
     {
         lstResultList.Items.Add(String.Format("  error: {0}", ex.Message));
         return(false);
     }
 }
예제 #2
0
        internal void Evaluate(out List <ExpressionItem> list)
        {
            Scanner      scanner = new Scanner(scriptFileContents, Environment.NewLine);
            RowEvaluator rowEvaluator;

            list = new List <ExpressionItem>();

            while (scanner.HasNext())
            {
                rowEvaluator = new RowEvaluator(scanner.Next());
                rowEvaluator.ParseExpression();
                rowEvaluator.InterpretExpression();
                list.Add(rowEvaluator.InterpretedExpression);
            }
        }