Commits

Anonymous committed 0659376

fixed asm lexers, fixed #pop / #push in multitarget

Comments (0)

Files changed (2)

pygments/lexer.py

                     new_state = (new_state,)
                 elif isinstance(tdef2, tuple):
                     # push more than one state
-                    new_state = []
                     for state in tdef2:
-                        if state == '#pop':
-                            new_state.append(-1)
-                        else:
-                            assert state in unprocessed, \
-                                   'unknown new state ' + state
-                            new_state.append(state)
-                    new_state = tuple(new_state)
+                        assert (state in unprocessed or
+                                state in ('#pop', '#push')), \
+                               'unknown new state ' + state
+                    new_state = tdef2
                 else:
                     assert False, 'unknown new state def %r' % tdef2
             tokens.append((rex, tdef[1], new_state))
                     if new_state is not None:
                         # state transition
                         if isinstance(new_state, tuple):
-                            statestack.extend(new_state)
+                            for state in new_state:
+                                if state == '#pop':
+                                    statestack.pop()
+                                elif state == '#push':
+                                    statestack.append(statestack[-1])
+                                else:
+                                    statestack.append(state)
                         elif isinstance(new_state, int):
                             # pop
                             del statestack[new_state:]

pygments/lexers/asm.py

     mimetypes = ['text/x-d-objdump']
 
     def __init__(self, **options):
-        super(D_ObjdumpLexer, self).__init__(DLexer, ObjdumpLexer, **options)
+        super(DObjdumpLexer, self).__init__(DLexer, ObjdumpLexer, **options)
 
 
 class CppObjdumpLexer(DelegatingLexer):
     mimetypes = ['text/x-cpp-objdump']
 
     def __init__(self, **options):
-        super(Cpp_ObjdumpLexer, self).__init__(CppLexer, ObjdumpLexer, **options)
+        super(CppObjdumpLexer, self).__init__(CppLexer, ObjdumpLexer, **options)
 
 
 class CObjdumpLexer(DelegatingLexer):
     mimetypes = ['text/x-c-objdump']
 
     def __init__(self, **options):
-        super(C_ObjdumpLexer, self).__init__(CLexer, ObjdumpLexer, **options)
+        super(CObjdumpLexer, self).__init__(CLexer, ObjdumpLexer, **options)
 
 
 class LlvmLexer(RegexLexer):