|
@@ -2,10 +2,10 @@ import abc
|
|
|
import re
|
|
|
import xml.etree.ElementTree as ET
|
|
|
import os.path
|
|
|
-from utils import Logger
|
|
|
-from visitor import Visitable
|
|
|
-from compiler_exceptions import CompilerException, TransitionException, UnprocessedException
|
|
|
-from lexer import Lexer, Token, TokenType
|
|
|
+from kernel.mvk_server.python_sccd_compiler.utils import Logger
|
|
|
+from kernel.mvk_server.python_sccd_compiler.visitor import Visitable
|
|
|
+from kernel.mvk_server.python_sccd_compiler.compiler_exceptions import CompilerException, TransitionException, UnprocessedException
|
|
|
+from kernel.mvk_server.python_sccd_compiler.lexer import Lexer, Token, TokenType
|
|
|
|
|
|
# http://docs.python.org/2/library/xml.etree.elementtree.html
|
|
|
|
|
@@ -847,7 +847,11 @@ class Class(Visitable):
|
|
|
for i in inheritances :
|
|
|
self.super_classes.append((i.get("class",""),i.get("priority",1)))
|
|
|
|
|
|
- self.super_classes.sort(lambda a, b: cmp(b[1], a[1])) # sort from high priority to low priority
|
|
|
+ try:
|
|
|
+ self.super_classes.sort(lambda a, b: cmp(b[1], a[1])) # sort from high priority to low priority
|
|
|
+ except TypeError:
|
|
|
+ self.super_classes = sorted(self.super_classes, key = lambda x: x[1], reverse = True)
|
|
|
+
|
|
|
priorityChecker = {}
|
|
|
for super_class, priority in self.super_classes:
|
|
|
if priority in priorityChecker:
|
|
@@ -857,7 +861,7 @@ class Class(Visitable):
|
|
|
if super_class not in checkIt:
|
|
|
checkIt.append(super_class)
|
|
|
priorityChecker[priority] = checkIt
|
|
|
- for priority, checkIt in priorityChecker.iteritems():
|
|
|
+ for priority, checkIt in priorityChecker.items():
|
|
|
if len(checkIt) > 1:
|
|
|
Logger.showWarning("Class <" + self.name + "> inherits from classes <" + ", ".join(checkIt) + "> with same priority <" + str(priority) + ">. Document inheritance order is used.")
|
|
|
|