Register a custom macro.

@param object|callable $macro
@param int             $priority marco with higher priority is tried first

@return void
774994
public static function genericMacro($macro, $priority = 0)
    {
        if (!isset(static::$globalGenericMacros[$priority])) {
            static::$globalGenericMacros[$priority] = [];
            krsort(static::$globalGenericMacros, SORT_NUMERIC);
        }

        static::$globalGenericMacros[$priority][] = $macro;
    }
256642
public function addListener($eventName, $listener, $priority = 0)
    {
        $this->getDispatcher()->addListener($eventName, $listener, $priority);
    }
432014
public function addExtension(ExtensionInterface $extension, $priority = 0)
    {
        $this->extensions[$priority][] = $extension;
        $this->sorted                  = null;
        $this->typeExtensions          = [];
    }
73356
void insertMacros(TokenList tokens ) {
        TokenList.Token t = tokens.getFirst();
        while( t != null ) {
            if( t.getType() == Type.WORD ) {
                Macro v = lookupMacro(t.word);
                if (v != null) {
                    TokenList.Token before = t.previous;
                    List<TokenList.Token> inputs = new ArrayList<TokenList.Token>();
                    t = parseMacroInput(inputs,t.next);

                    TokenList sniplet = v.execute(inputs);
                    tokens.extractSubList(before.next,t);
                    tokens.insertAfter(before,sniplet);
                    t = sniplet.last;
                }
            }
            t = t.next;
        }
    }
1183576
protected function callMacro($name, $parameters)
    {
        $macro = static::$macros[$name];

        if ($macro instanceof Closure) {
            return call_user_func_array($macro->bindTo($this, static::class), $parameters);
        }

        return call_user_func_array($macro, $parameters);
    }
690350
public function addAction(string $tag, callable $callback, ?int $priority = null)
    {
        $args = [$tag, $callback];
        if (!is_null($priority)) $args[] = $priority;

        return $this->callGlobalFunction('add_action', $args);
    }
438320
public function register($name, $class, $requirement = '', $priority = false)
    {
        if (!class_exists($class)) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid class name.', $class));
        }

        $definition = [
            'class'       => $class,
            'requirement' => $requirement
        ];

        if ($priority) {
            $this->classes = array_merge_recursive([$name => $definition], $this->classes);
        } else {
            $this->classes[$name] = $definition;
        }
    }
1233132
public void addMacro(@Nonnull String name, @Nonnull String value)
            throws LexerException {
        cpp.addMacro(name, value);
    }
61465
public function insert($value, $priority)
    {
        if (is_int($priority)) {
            $priority = [$priority, $this->counter--];
        }
        parent::insert($value, $priority);
    }
673125
protected function register(Parameter $param)
    {
        $this->ifAlreadyRegistered($param);

        $name = $param->attributeName();
        if ($param instanceof Option) {
            $this->_options[$name] = $param;
        } else {
            $this->_arguments[$name] = $param;
        }

        $this->set($name, $param->default());
    }
1235689
public function register(BladeCompiler $blade): void
    {
        if ($this->namespace) {
            $blade->directive("namespace", function ($parameter) {
                return "<?php namespace {$parameter} ?>";
            });
        }

        if ($this->use) {
            $blade->directive("use", function ($parameter) {
                return "<?php use {$parameter} ?>";
            });
        }

        if ($this->css !== null) {
            $blade->directive("css", function ($parameter) {
                assert(is_string($this->css));
                $file = $this->assetify($parameter, "css", $this->css);
                return "<link rel='stylesheet' type='text/css' href='{$file}'>";
            });
        }

        if ($this->js !== null) {
            $blade->directive("js", function ($parameter) {
                assert(is_string($this->js));
                $file = $this->assetify($parameter, "js", $this->js);
                return "<script type='text/javascript' src='{$file}'></script>";
            });
        }
    }
1108918
def Macro(self, macro):
        """"""
        if macro.location is None:
            log.info('Ignoring %s with no location', macro.name)
            return
        if self.generate_locations:
            print("# %s:%s" % (macro.location), file=self.stream)
        if self.generate_comments:
            self.print_comment(macro)
        print("%s = %s # macro" % (macro.name, macro.body), file=self.stream)
        self.macros += 1
        self.names.add(macro.name)
        return
498400
protected function registerMacro()
    {
        DataTableAbstract::macro(
            'setTransformer', function ($transformer) {
                $this->transformer = [$transformer];

                return $this;
            }
        );

        DataTableAbstract::macro(
            'addTransformer', function ($transformer) {
                $this->transformer[] = $transformer;

                return $this;
            }
        );

        DataTableAbstract::macro(
            'setSerializer', function ($serializer) {
                $this->serializer = $serializer;

                return $this;
            }
        );
    }
1353564
public void registerProcessor(String processor, Priority prio) {
		this.processorNames.get(prio).add(processor);
	}
444963
protected function registerListener($event, $listener, $priority)
    {
        if (!is_callable($listener)) {
            throw new DispatcherException(sprintf('Invalid event listener. Only callables or ListenerInterface instances can be registered, got "%s"', gettype($listener)));
        }

        if (!isset($this->events[$event])) {
            $this->events[$event] = [];
        }

        if ($priority === null) {
            $this->events[$event][] = $listener;

            return;
        }

        array_splice($this->events[$event], (int) $priority, 0, [$listener]);
    }
817364
def do_usemacro(parser, token):
    
    tag_name, macro_name, args, kwargs = parse_macro_params(token)
    try:
        macro = parser._macros[macro_name]
    except (AttributeError, KeyError):
        raise template.TemplateSyntaxError(
            "Macro '{0}' is not defined previously to the {1} tag".format(
                macro_name, tag_name))
    macro.parser = parser
    return UseMacroNode(macro, args, kwargs)
717564
public function on($key,$func,$priority=10,$options=array()) {
		$call = $options ? array($func,$options) : $func;
		if ($e = &$this->f3->ref($this->ekey.$key))
			$e[$priority][] = $call;
		else
			$e = array($priority=>array($call));
		krsort($e);
	}