Ejemplo n.º 1
0
        /// <summary>
        /// Finds the known result types of all expressions in the <see cref="Grammar"/>.
        /// </summary>
        /// <param name="grammar">The <see cref="Grammar"/> to inspect.</param>
        /// <returns>A <see cref="Dictionary{TKey, TValue}"/> of expressions and their types.</returns>
        public static Dictionary <Expression, object> Find(Grammar grammar)
        {
            var types  = new Dictionary <Expression, object>();
            var walker = new ResultTypeTreeWalker(grammar, types);

            do
            {
                walker.WalkGrammar(grammar);
            }while (walker.Changed);

            return(types);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Finds the known result types of all expressions in the <see cref="Grammar"/>.
        /// </summary>
        /// <param name="grammar">The <see cref="Grammar"/> to inspect.</param>
        /// <returns>A <see cref="Dictionary{TKey, TValue}"/> of expressions and their types.</returns>
        public static Dictionary<Expression, object> Find(Grammar grammar)
        {
            var types = new Dictionary<Expression, object>();
            var walker = new ResultTypeTreeWalker(grammar, types);

            do
            {
                walker.WalkGrammar(grammar);
            }
            while (walker.Changed);

            return types;
        }