public ITokenForestNode AddOrGetExistingTokenNode(IToken token) { ITokenForestNode tokenNode = null; if (_tokenNodes.TryGetValue(token, out tokenNode)) return tokenNode; tokenNode = new TokenForestNode(token, token.Origin, token.Value.Length); _tokenNodes.Add(token, tokenNode); return tokenNode; }
public ITokenForestNode AddOrGetExistingTokenNode(IToken token) { if (_tokenNodes.TryGetValue(token, out ITokenForestNode tokenNode)) { return(tokenNode); } tokenNode = new TokenForestNode(token, token.Position, token.Capture.Count); _tokenNodes.Add(token, tokenNode); return(tokenNode); }
public ITokenForestNode AddOrGetExistingTokenNode(IToken token) { if (this._tokenNodes.TryGetValue(token, out var tokenNode)) { return(tokenNode); } tokenNode = new TokenForestNode(token); this._tokenNodes.Add(token, tokenNode); return(tokenNode); }
public ITokenForestNode AddOrGetExistingTokenNode(IToken token) { ITokenForestNode tokenNode = null; if (_tokenNodes.TryGetValue(token, out tokenNode)) { return(tokenNode); } tokenNode = new TokenForestNode(token, token.Position, token.Value.Length); _tokenNodes.Add(token, tokenNode); return(tokenNode); }
private IForestNode CreateNullParseNode(ISymbol symbol, int location) { var symbolNode = _nodeSet.AddOrGetExistingSymbolNode(symbol, location, location); var token = new Token(string.Empty, location, new TokenType(string.Empty)); var nullNode = new TokenForestNode(token, location, location); symbolNode.AddUniqueFamily(nullNode); return symbolNode; }