예제 #1
0
            public Impl(string unnamedParameterRenamePrefix)
            {
                _unnamedParameterRenamePrefix = unnamedParameterRenamePrefix;

                _trie = new SyntaxTrie();
                _trie.Add(unnamedParameterRenamePrefix);

                _environment = new Stack <Dictionary <ParameterExpression, ParameterExpression> >();
            }
예제 #2
0
        /// <summary>
        /// Adds an identifier to the syntax trie.
        /// </summary>
        /// <param name="identifier">Identifier to add.</param>
        public void Add(string identifier)
        {
            if (identifier == null)
            {
                throw new ArgumentNullException(nameof(identifier));
            }

            var next = this;

            for (int i = 0; i < identifier.Length; i++)
            {
                var c = identifier[i];

                if (!next._trie.TryGetValue(c, out SyntaxTrie t))
                {
                    t             = new SyntaxTrie(next, i == identifier.Length - 1);
                    next._trie[c] = t;
                }

                next = t;
            }
        }
예제 #3
0
 private SyntaxTrie(SyntaxTrie parent, bool isTerminal)
 {
     _trie       = new Dictionary <char, SyntaxTrie>();
     _parent     = parent;
     _isTerminal = isTerminal;
 }