Class ScopeImpl

  • All Implemented Interfaces:
    Scope

    public class ScopeImpl
    extends Object
    implements Scope
    • Field Detail

      • LOG

        public static final org.slf4j.Logger LOG
    • Constructor Detail

      • ScopeImpl

        public ScopeImpl()
      • ScopeImpl

        public ScopeImpl​(String name,
                         Scope parentScope)
      • ScopeImpl

        public ScopeImpl​(String name,
                         Scope parentScope,
                         Type type)
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Scope
        Returns the scope name
        Specified by:
        getName in interface Scope
        Returns:
      • getParentScope

        public Scope getParentScope()
        Description copied from interface: Scope
        Returns the enclosing (parent) scope
        Specified by:
        getParentScope in interface Scope
        Returns:
      • define

        public boolean define​(Symbol symbol)
        Description copied from interface: Scope
        Defines a new symbol in this scope
        Specified by:
        define in interface Scope
        Returns:
      • resolve

        public Symbol resolve​(String id)
        Description copied from interface: Scope
        Searches and returns a symbol with the given id if it exists. The search is recursive up, so if a symbol is not found in the current scope, the algorithm searches the parent scopes all the way to the root built-in scope.
        Specified by:
        resolve in interface Scope
        Returns:
      • resolve

        public Symbol resolve​(String[] qualifiedName)
        Description copied from interface: Scope
        Searches and returns a symbol with the given qualified name if it exists. The search is recursive up, so if a symbol is not found in the current scope, the algorith searches the parend scopes all the way to the root built-in scope.
        Specified by:
        resolve in interface Scope
        Returns:
      • setName

        public void setName​(String name)
      • setParentScope

        public void setParentScope​(Scope parentScope)
      • addChildScope

        public void addChildScope​(Scope scope)
        Description copied from interface: Scope
        Adds an enclosed (child) scope
        Specified by:
        addChildScope in interface Scope
      • getChildScopes

        public Map<String,​Scope> getChildScopes()
        Description copied from interface: Scope
        Gets a map of all children scopes. The key of the map is the string name of the children scope and the value is the scope itself.
        Specified by:
        getChildScopes in interface Scope
        Returns:
      • setChildScopes

        public void setChildScopes​(Map<String,​Scope> childScopes)
      • start

        public void start​(String token)
        Description copied from interface: Scope
        This method is used during context-aware parsing to find multi-token symbols iteratively. It is used in conjunction with the #followUp method below.
        Specified by:
        start in interface Scope
      • followUp

        public boolean followUp​(String token,
                                boolean isPredict)
        Description copied from interface: Scope
        This method is used during context-aware parsing to find multi-token symbols iteratively. It is used in conjunction with the #start method above.
        Specified by:
        followUp in interface Scope
      • getType

        public Type getType()
        Description copied from interface: Scope
        maybe null.
        Specified by:
        getType in interface Scope