Class SymbolTable<TagT extends java.lang.Enum<TagT>>


  • public final class SymbolTable<TagT extends java.lang.Enum<TagT>>
    extends java.lang.Object
    SymbolTable implements a simple symbol table based on Java hash tables.
    • Constructor Detail

      • SymbolTable

        public SymbolTable()
    • Method Detail

      • getParent

        protected SymbolTable<TagT> getParent()
        Returns the parent symbol table.
        Returns:
        the parent symbol table or null if the table is a top-level one.
      • setParent

        protected void setParent​(SymbolTable<TagT> parent)
        Sets the parent symbol table.
        Parameters:
        parent - the symbol table to be set.
      • items

        public java.util.Collection<SyntaxNode<TagT>> items()
        Returns the collection of items.
        Returns:
        the items.
      • items

        public java.util.Collection<SyntaxNode<TagT>> items​(TagT tag)
        Returns the collection of items with the given statement tag.
        Parameters:
        tag - the statement tag.
        Returns:
        the items.
      • items

        public java.util.Collection<SyntaxNode<TagT>> items​(java.util.EnumSet<TagT> tags)
        Returns the collection of items whose statement tags belong to the given set.
        Parameters:
        tags - the set of statement tags.
        Returns:
        the items.
      • find

        public SyntaxNode<TagT> find​(java.lang.String name)
        Returns an item of the symbol table with the given name.
        Parameters:
        name - the item name.
        Returns:
        an item with the given name or null if the symbol table does not contain such an item.
      • findRecursively

        public final SyntaxNode<TagT> findRecursively​(java.lang.String name)
        Returns an item of the symbol table (or the parent tables) with the given name
        Parameters:
        name - the item name.
        Returns:
        an item with the given name or null if the symbol table and the parent tables do not contain such an item.
      • add

        public void add​(SyntaxNode<TagT> item)
        Adds an item into the symbol table.
        Parameters:
        item - the item to be added.
      • addAll

        public final void addAll​(java.util.Collection<SyntaxNode<TagT>> items)
        Adds items into the symbol table.
        Parameters:
        items - the items to be added.
      • setRedefinitionHandler

        public void setRedefinitionHandler​(ErrorHandler<TagT> handler)
        Sets the redefinition handler.
        Parameters:
        handler - the handler to be set.