Ejemplo n.º 1
0
        public ISymbolForestNode AddOrGetExistingSymbolNode(ISymbol symbol, int origin, int location)
        {
            var hash = ComputeHashCode(symbol, origin, location);

            ISymbolForestNode symbolNode = null;
            if (_symbolNodes.TryGetValue(hash, out symbolNode))
                return symbolNode;

            symbolNode = new SymbolForestNode(symbol, origin, location);
            _symbolNodes.Add(hash, symbolNode);
            return symbolNode;
        }
Ejemplo n.º 2
0
        public ISymbolForestNode AddOrGetExistingSymbolNode(ISymbol symbol, int origin, int location)
        {
            var hash = ComputeHashCode(symbol, origin, location);

            if (_symbolNodes.TryGetValue(hash, out ISymbolForestNode symbolNode))
            {
                return(symbolNode);
            }

            symbolNode = new SymbolForestNode(symbol, origin, location);
            _symbolNodes.Add(hash, symbolNode);
            return(symbolNode);
        }
Ejemplo n.º 3
0
        public ISymbolForestNode AddOrGetExistingSymbolNode(NonTerminal symbol, int origin, int location)
        {
            var key = (symbol, origin, location);

            if (this._symbolNodes.TryGetValue(key, out var symbolNode))
            {
                return(symbolNode);
            }

            symbolNode = new SymbolForestNode(symbol, origin, location);
            this._symbolNodes.Add(key, symbolNode);
            return(symbolNode);
        }