internal Symbol intern(String name) { Symbol result = (Symbol)table[name]; if (result == null) { if (name.StartsWith(":")) { table[name] = result = new Keyword(name); } else { int firstdot = name.IndexOf('.'); int lastdot = name.LastIndexOf('.'); int lastcolon = name.LastIndexOf(':'); int nameLength = name.Length; // .instance // .[namespace.]type:explicitinstance // [namespace.]type. // [namespace.]type:static // obj.member - transformed by reader if ((firstdot != -1 || lastcolon != -1) && nameLength > 1) { if (firstdot == 0) //instance { if (lastcolon > 0) //explicitly qualified { String memberName = name.Substring(lastcolon + 1, nameLength - (lastcolon + 1)); Type type = findType(name.Substring(1, lastcolon - 1)); table[name] = result = new CLSInstanceSymbol(name, memberName, type); } else { String memberName = name.Substring(1, nameLength - 1); table[name] = result = new CLSInstanceSymbol(name, memberName, null); } } else if (lastcolon > 0) //static { String memberName = name.Substring(lastcolon + 1, nameLength - (lastcolon + 1)); Type type = findType(name.Substring(0, lastcolon)); table[name] = result = new CLSStaticSymbol(name, memberName, type); } else if (lastdot == nameLength - 1) //type { Type type = findType(name.Substring(0, lastdot)); table[name] = result = new CLSTypeSymbol(name, type); } } else { table[name] = result = new Symbol(name); result.isDynamic = (name[0] == '*'); } } } return(result); }
internal Symbol intern(String name) { Symbol result = (Symbol)table[name]; if(result == null) { if(name.StartsWith(":")) { table[name] = result = new Keyword(name); } else { int firstdot = name.IndexOf('.'); int lastdot = name.LastIndexOf('.'); int lastcolon = name.LastIndexOf(':'); int nameLength=name.Length; // .instance // .[namespace.]type:explicitinstance // [namespace.]type. // [namespace.]type:static // obj.member - transformed by reader if((firstdot != -1 || lastcolon != -1) && nameLength > 1) { if(firstdot == 0) //instance { if(lastcolon > 0) //explicitly qualified { String memberName = name.Substring(lastcolon+1,nameLength-(lastcolon+1)); Type type = findType(name.Substring(1,lastcolon-1)); table[name] = result = new CLSInstanceSymbol(name,memberName,type); } else { String memberName = name.Substring(1,nameLength-1); table[name] = result = new CLSInstanceSymbol(name,memberName,null); } } else if(lastcolon > 0) //static { String memberName = name.Substring(lastcolon+1,nameLength-(lastcolon+1)); Type type = findType(name.Substring(0,lastcolon)); table[name] = result = new CLSStaticSymbol(name,memberName,type); } else if(lastdot==nameLength-1) //type { Type type = findType(name.Substring(0,lastdot)); table[name] = result = new CLSTypeSymbol(name,type); } } else { table[name] = result = new Symbol(name); result.isDynamic = (name[0] == '*'); } } } return result; }