def directive(directname=None):
global _directives<EOL>class_dir_list = _directives<EOL>def wrapper(f):<EOL><INDENT>nonlocal directname<EOL>if directname is None:<EOL><INDENT>directname = f.__name__<EOL><DEDENT>f.ns_name = directname<EOL>set_one(class_dir_list, directname, f)<EOL>return f<EOL><DEDENT>return wrapper<EOL>
Attach a class to a parsing class and register it as a parser directive.

        The class is registered with its name unless directname is provided.