/// <summary>
        /// Evaluates a derivation of the form:
        /// Expression= Expression add Expression | Expression sub Expression | integer
        /// </summary>
        /// <remarks>
        /// The production rules are:
        /// Expression -> Expression add Expression
        /// Expression -> Expression sub Expression
        /// Expression -> integer
        /// </remarks>
        /// <param name="node">The <see cref="ParseNode"/> to evaluate</param>
        /// <param name="state">A user supplied state object. What it should be depends on the production's associated code block</param>
        /// <returns>The result of the evaluation</returns>
        internal static int EvaluateExpression(ParseNode node, object state)
        {
            if ((GloryDemo.Test2Parser.integer == node.SymbolId))
            {
                return((int)(Test2Parser._ChangeType(node.Value, typeof(int))));
            }
            if ((false == node.IsNonTerminal))
            {
                return((int)(Test2Parser._ChangeType(0, typeof(int))));
            }
            int result = Test2Parser.EvaluateExpression(node.Children[0], state);
            int i      = 2;

            for (
                ; (i < node.Children.Length);
                )
            {
                if ((node.Children[(i - 1)].SymbolId == GloryDemo.Test2Parser.add))
                {
                    result = (result + Test2Parser.EvaluateExpression(node.Children[i], state));
                }
                else
                {
                    result = (result - Test2Parser.EvaluateExpression(node.Children[i], state));
                }
                i = (i + 2);
            }
            return((int)(Test2Parser._ChangeType(result, typeof(int))));
        }
 /// <summary>
 /// Evaluates a derivation of the form:
 /// Expression= Expression add Expression | Expression sub Expression | integer
 /// </summary>
 /// <remarks>
 /// The production rules are:
 /// Expression -> Expression add Expression
 /// Expression -> Expression sub Expression
 /// Expression -> integer
 /// </remarks>
 /// <param name="node">The <see cref="ParseNode"/> to evaluate</param>
 /// <param name="state">A user supplied state object. What it should be depends on the production's associated code block</param>
 /// <returns>The result of the evaluation</returns>
 public static int Evaluate(ParseNode node, object state)
 {
     return(Test2Parser.EvaluateExpression(node, state));
 }
 /// <summary>
 /// Evaluates a derivation of the form:
 /// Expression= Expression add Expression | Expression sub Expression | integer
 /// </summary>
 /// <remarks>
 /// The production rules are:
 /// Expression -> Expression add Expression
 /// Expression -> Expression sub Expression
 /// Expression -> integer
 /// </remarks>
 /// <param name="node">The <see cref="ParseNode"/> to evaluate</param>
 /// <returns>The result of the evaluation</returns>
 public static int Evaluate(ParseNode node)
 {
     return(Test2Parser.EvaluateExpression(node, null));
 }