public static DefinitionToken FromNumber(double value) { if (CachedNumbers.TryGetValue(value, out var existing)) { return(existing); } var newNumber = new DefinitionToken(Number, value); CachedNumbers.Add(value, newNumber); return(newNumber); }
public static DefinitionToken FromText(string name) { if (CachedTexts.TryGetValue(name, out var existing)) { return(existing); } var newText = new DefinitionToken(Text, name); CachedTexts.Add(name, newText); return(newText); }
public static DefinitionToken FromIdentifier(string name) { if (CachedIdentifiers.TryGetValue(name, out var existing)) { return(existing); } var newIdentifier = new DefinitionToken(IsPublicIdentifier(name) ? nameof(Public) : nameof(Private), name); CachedIdentifiers.Add(name, newIdentifier); return(newIdentifier); }