Interface Scope

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BUILT_IN  
      static java.lang.String GLOBAL  
      static java.lang.String LOCAL  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addChildScope​(Scope scope)
      Adds an enclosed (child) scope
      boolean define​(Symbol symbol)
      Defines a new symbol in this scope
      boolean followUp​(java.lang.String token, boolean isPredict)
      This method is used during context-aware parsing to find multi-token symbols iteratively.
      java.util.Map<java.lang.String,​Scope> getChildScopes()
      Gets a map of all children scopes.
      java.lang.String getName()
      Returns the scope name
      Scope getParentScope()
      Returns the enclosing (parent) scope
      java.util.Map<java.lang.String,​Symbol> getSymbols()  
      Type getType()
      maybe null.
      Symbol resolve​(java.lang.String id)
      Searches and returns a symbol with the given id if it exists.
      Symbol resolve​(java.lang.String[] qualifiedName)
      Searches and returns a symbol with the given qualified name if it exists.
      void start​(java.lang.String token)
      This method is used during context-aware parsing to find multi-token symbols iteratively.
    • Method Detail

      • getName

        java.lang.String getName()
        Returns the scope name
        Returns:
      • getParentScope

        Scope getParentScope()
        Returns the enclosing (parent) scope
        Returns:
      • addChildScope

        void addChildScope​(Scope scope)
        Adds an enclosed (child) scope
        Parameters:
        scope -
      • getChildScopes

        java.util.Map<java.lang.String,​Scope> getChildScopes()
        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.
        Returns:
      • define

        boolean define​(Symbol symbol)
        Defines a new symbol in this scope
        Parameters:
        symbol -
        Returns:
      • resolve

        Symbol resolve​(java.lang.String id)
        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.
        Parameters:
        id -
        Returns:
      • resolve

        Symbol resolve​(java.lang.String[] qualifiedName)
        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.
        Parameters:
        qualifiedName -
        Returns:
      • start

        void start​(java.lang.String token)
        This method is used during context-aware parsing to find multi-token symbols iteratively. It is used in conjunction with the #followUp method below.
        Parameters:
        token -
      • followUp

        boolean followUp​(java.lang.String token,
                         boolean isPredict)
        This method is used during context-aware parsing to find multi-token symbols iteratively. It is used in conjunction with the #start method above.
        Parameters:
        token -
      • getSymbols

        java.util.Map<java.lang.String,​Symbol> getSymbols()
      • getType

        Type getType()
        maybe null.