@@ -0,0 +1,2364 @@
+from string import ascii_letters%0A%0Aimport pytest%0A%0Afrom nex.codes import CatCode%0Afrom nex.instructions import Instructions%0Afrom nex.instructioner import (Instructioner,%0A                               make_unexpanded_control_sequence_instruction,%0A                               char_cat_instr_tok)%0Afrom nex.utils import ascii_characters%0Afrom nex.banisher import Banisher%0Afrom nex.parsing.command_parser import command_parser%0A%0A%0Afrom common import ITok%0A%0A%0Atest_char_to_cat = %7B%7D%0Afor c in ascii_characters:%0A    test_char_to_cat%5Bc%5D = CatCode.other%0Afor c in ascii_letters:%0A    test_char_to_cat%5Bc%5D = CatCode.letter%0Atest_char_to_cat.update(%7B%0A    '$': CatCode.escape,%0A    ' ': CatCode.space,%0A    '%5B': CatCode.begin_group,%0A    '%5D': CatCode.end_group,%0A    '%5Cn': CatCode.end_of_line,%0A%7D)%0A%0A%0Aclass DummyCodes:%0A    def __init__(self, char_to_cat):%0A        if char_to_cat is None:%0A            self.char_to_cat = test_char_to_cat.copy()%0A        else:%0A            self.char_to_cat = char_to_cat%0A%0A    def get_cat_code(self, char):%0A        return self.char_to_cat%5Bchar%5D%0A%0A    def get_lower_case_code(self, c):%0A        return c.lower()%0A%0A    def get_upper_case_code(self, c):%0A        return c.upper()%0A%0A%0Aclass DummyRouter:%0A%0A    def __init__(self, cs_map):%0A        self.cs_map = cs_map%0A%0A    def lookup_control_sequence(self, name, *args, **kwargs):%0A        canon_token = self.cs_map%5Bname%5D%0A        return canon_token.copy(*args, **kwargs)%0A%0A%0Aclass DummyParameters:%0A%0A    def __init__(self, param_map):%0A        self.param_map = param_map%0A%0A    def get(self, name, *args, **kwargs):%0A        return self.param_map%5Bname%5D%0A%0A%0Aclass DummyState:%0A%0A    def __init__(self, char_to_cat, cs_map, param_map=None):%0A        self.router = DummyRouter(cs_map)%0A        self.parameters = DummyParameters(param_map)%0A        self.codes = DummyCodes(char_to_cat)%0A%0A%0Adef string_to_banisher(s, cs_map, char_to_cat=None, param_map=None):%0A    state = DummyState(cs_map=cs_map,%0A                       param_map=param_map, char_to_cat=char_to_cat)%0A    instrs = Instructioner.from_string(s, get_cat_code_func=state.codes.get_cat_code)%0A    return Banisher(instrs, state, instrs.lexer.reader)%0A%0A%0Adef test_h_rule():%0A    cs_map = %7B%0A        'hRule': ITok(Instructions.h_rule),%0A    %7D%0A    b = string_to_banisher('$hRule height 20pt width 10pt depth 30pt', cs_map)%0A    command = command_parser.parse(b.advance_to_end())%0A    print(command)%0A

Add test for command parsing, without executing