finds the symbol for the top-level class containing the given symbol

@param symbol the given symbol
@return symbol for the non-nested enclosing class
426574
public static Symbol.ClassSymbol getOutermostClassSymbol(Symbol symbol) {
    // get the symbol for the outermost enclosing class.  this handles
    // the case of anonymous classes
    Symbol.ClassSymbol outermostClassSymbol = ASTHelpers.enclosingClass(symbol);
    while (outermostClassSymbol.getNestingKind().isNested()) {
      Symbol.ClassSymbol enclosingSymbol = ASTHelpers.enclosingClass(outermostClassSymbol.owner);
      if (enclosingSymbol != null) {
        outermostClassSymbol = enclosingSymbol;
      } else {
        // enclosingSymbol can be null in weird cases like for array methods
        break;
      }
    }
    return outermostClassSymbol;
  }
440864
def read_metadata(self, symbol):
        '''
        
        '''
        sym = self._get_symbol_info(symbol)
        if not sym:
            raise NoDataFoundException("Symbol does not exist.")
        x = self._symbols.find_one({SYMBOL: symbol})
        return x[USERMETA] if USERMETA in x else None
238835
public static Symbol findIdent(String name, VisitorState state) {
    return findIdent(name, state, KindSelector.VAR);
  }
873335
Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
        Symbol bestSoFar = typeNotFound;
        Symbol sym;

        if (kind.contains(KindSelector.VAL)) {
            sym = findVar(env, name);
            if (sym.exists()) return sym;
            else bestSoFar = bestOf(bestSoFar, sym);
        }

        if (kind.contains(KindSelector.TYP)) {
            sym = findType(env, name);

            if (sym.exists()) return sym;
            else bestSoFar = bestOf(bestSoFar, sym);
        }

        if (kind.contains(KindSelector.PCK))
            return lookupPackage(env, name);
        else return bestSoFar;
    }
902111
Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name, RecoveryLoadClass recoveryLoadClass) {
        Symbol bestSoFar = typeNotFound;
        for (Symbol s : scope.getSymbolsByName(name)) {
            Symbol sym = loadClass(env, s.flatName(), recoveryLoadClass);
            if (bestSoFar.kind == TYP && sym.kind == TYP &&
                bestSoFar != sym)
                return new AmbiguityError(bestSoFar, sym);
            else
                bestSoFar = bestOf(bestSoFar, sym);
        }
        return bestSoFar;
    }
217713
private double getElementRank(String symbol) {
        for (int f = 0; f < rankedSymbols.length; f++) {
            if (rankedSymbols[f].equals(symbol)) {
                return symbolRankings[f];
            }
        }
        IIsotope isotope = isotopeFac.getMajorIsotope(symbol);
        if (isotope.getMassNumber() != null) {
            return ((double) 800000 - isotope.getMassNumber());
        }
        return 800000;
    }
547544
public IIsotope getIsotope(String symbol, int massNumber) {
        int elem = Elements.ofString(symbol).number();
        List<IIsotope> isotopes = this.isotopes[elem];
        if (isotopes == null)
            return null;
        for (IIsotope isotope : isotopes) {
            if (isotope.getSymbol().equals(symbol) && isotope.getMassNumber() == massNumber) {
                return clone(isotope);
            }
        }
        return null;
    }
1003133
@Nullable
  public static Symbol getDeclaredSymbol(Tree tree) {
    if (tree instanceof AnnotationTree) {
      return getSymbol(((AnnotationTree) tree).getAnnotationType());
    }
    if (tree instanceof PackageTree) {
      return getSymbol((PackageTree) tree);
    }
    if (tree instanceof TypeParameterTree) {
      Type type = ((JCTypeParameter) tree).type;
      return type == null ? null : type.tsym;
    }
    if (tree instanceof ClassTree) {
      return getSymbol((ClassTree) tree);
    }
    if (tree instanceof MethodTree) {
      return getSymbol((MethodTree) tree);
    }
    if (tree instanceof VariableTree) {
      return getSymbol((VariableTree) tree);
    }
    return null;
  }
1006773
public function findReferencesToSymbol($symbol)
    {
        if (!$this->collect_locations) {
            throw new \UnexpectedValueException('Should not be checking references');
        }

        if (strpos($symbol, '::$') !== false) {
            return $this->findReferencesToProperty($symbol);
        }

        if (strpos($symbol, '::') !== false) {
            return $this->findReferencesToMethod($symbol);
        }

        return $this->findReferencesToClassLike($symbol);
    }
1190961
protected static String getPayload(SAXSymbol symbol) {
    if (symbol.isGuard()) {
      return "guard of the rule " + ((SAXGuard) symbol).r.ruleIndex;
    }
    else if (symbol.isNonTerminal()) {
      return "nonterminal " + ((SAXNonTerminal) symbol).value;
    }
    return "symbol " + symbol.value;
  }
924750
public Symbol getSymbol(String name) {
        return symbolTable == null ? null : symbolTable.get(name);
    }
663781
def full_symbol(self):
        """"""
        if self._full_symbol is None:
            self._full_symbol = self._symbol_extract(cache.RE_FULL_CURSOR, brackets=True)

        return self._full_symbol
681268
public Symbol resolveIdent(String name) {
        if (name.equals(""))
            return syms.errSymbol;
        JavaFileObject prev = log.useSource(null);
        try {
            JCExpression tree = null;
            for (String s : name.split("\\.", -1)) {
                if (!SourceVersion.isIdentifier(s)) // TODO: check for keywords
                    return syms.errSymbol;
                tree = (tree == null) ? make.Ident(names.fromString(s))
                                      : make.Select(tree, names.fromString(s));
            }
            JCCompilationUnit toplevel =
                make.TopLevel(List.<JCTree.JCAnnotation>nil(), null, List.<JCTree>nil());
            toplevel.packge = syms.unnamedPackage;
            return attr.attribIdent(tree, toplevel);
        } finally {
            log.useSource(prev);
        }
    }
271736
def get_by_symbol(self, symbol: str) -> Commodity:
        
        # handle namespace. Accept GnuCash and Yahoo-style symbols.
        full_symbol = self.__parse_gc_symbol(symbol)

        query = (
            self.query
            .filter(Commodity.mnemonic == full_symbol["mnemonic"])
        )
        if full_symbol["namespace"]:
            query = query.filter(Commodity.namespace == full_symbol["namespace"])

        return query.first()
340587
def from_symbol(cls, symbol: str) -> "Piece":
        
        return cls(PIECE_SYMBOLS.index(symbol.lower()), symbol.isupper())
824108
public ClassDoc findClass(String className) {
        ClassDoc searchResult = searchClass(className);
        if (searchResult == null) {
            ClassDocImpl enclosingClass = (ClassDocImpl)containingClass();
            //Expand search space to include enclosing class.
            while (enclosingClass != null && enclosingClass.containingClass() != null) {
                enclosingClass = (ClassDocImpl)enclosingClass.containingClass();
            }
            searchResult = enclosingClass == null ?
                null : enclosingClass.searchClass(className);
        }
        return searchResult;
    }
584519
public static String getChemicalSeries(String symbol) {
        Elements e = Elements.ofString(symbol);
        for (Series s : Series.values())
            if (s.contains(e)) return s.name();
        return null;
    }