Class Handler<S,​T,​L extends LanguageFrontend>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected L lang  
      protected static org.slf4j.Logger log  
      protected java.util.HashMap<java.lang.Class<? extends T>,​HandlerInterface<S,​T>> map  
    • Constructor Summary

      Constructors 
      Constructor Description
      Handler​(java.util.function.Supplier<S> configConstructor, L lang)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      S handle​(T ctx)
      Searches for a handler matching the most specific superclass of Handler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        protected static final org.slf4j.Logger log
      • map

        protected final java.util.HashMap<java.lang.Class<? extends T>,​HandlerInterface<S,​T>> map
    • Constructor Detail

      • Handler

        public Handler​(java.util.function.Supplier<S> configConstructor,
                       L lang)
    • Method Detail

      • handle

        public S handle​(T ctx)
        Searches for a handler matching the most specific superclass of Handler. The created map should thus contain a handler for every semantically different AST node and can reuse handler code as long as the handled AST nodes have a common ancestor.
        Parameters:
        ctx - The AST node, whose handler is matched with respect to the AST node class.
        Returns:
        most specific handler.