Interface SymbolScope


  • public interface SymbolScope
    The SymbolScope interface is to be implemented by symbol scopes.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void define​(Symbol symbol)
      Defines the specified symbol in the current scope.
      Symbol getAssociatedSymbol()
      Returns symbol associated with the scope (or containing the scope) or null it there is not such symbol.
      SymbolScope getOuterScope()
      Returns the outer scope for the current scope or null if there is no outer scope.
      Symbol resolve​(java.lang.String name)
      Searches for a symbol by its name in the current scope and its outer scopes.
      Symbol resolveMember​(java.lang.String name)
      Searches for a symbol by its name in the current scope only.
      Symbol resolveNested​(java.lang.String... names)
      Searches for a symbol described by an array containing its name preceded with names of the scopes the symbol is nested into.
    • Method Detail

      • define

        void define​(Symbol symbol)
        Defines the specified symbol in the current scope.
        Parameters:
        symbol - Symbol to be defined.
        Throws:
        java.lang.IllegalArgumentException - if symbol is null; if a symbol with such a name is already defined in the current scope.
      • resolve

        Symbol resolve​(java.lang.String name)
        Searches for a symbol by its name in the current scope and its outer scopes. If no symbol is found, null is returned.
        Parameters:
        name - Symbol name.
        Returns:
        Symbol or null if it is not defined.
      • resolveMember

        Symbol resolveMember​(java.lang.String name)
        Searches for a symbol by its name in the current scope only. Outer scopes are not searched. If no such symbol is found, null is returned.
        Parameters:
        name - Symbol name.
        Returns:
        Symbol or null if it is not defined.
      • resolveNested

        Symbol resolveNested​(java.lang.String... names)
        Searches for a symbol described by an array containing its name preceded with names of the scopes the symbol is nested into. Search starts in the current scope and goes to outer scopes until the first nesting scope is found. Then the search is continued in that scope. If no such symbol is found, null is returned.
        Parameters:
        names - Array of names.
        Returns:
        Symbol or null if it is not defined.
      • getOuterScope

        SymbolScope getOuterScope()
        Returns the outer scope for the current scope or null if there is no outer scope.
        Returns:
        Outer scope or null if there is no outer scope.
      • getAssociatedSymbol

        Symbol getAssociatedSymbol()
        Returns symbol associated with the scope (or containing the scope) or null it there is not such symbol.
        Returns:
        Associated symbol or null it there is not such symbol.