| 35 | return type, name, value |
| 36 | |
| 37 | class Face: |
| 38 | |
| 39 | def __init__(self): |
| 40 | self.order = [] |
| 41 | self.features = {} |
| 42 | self.values = {} |
| 43 | self.events = {} |
| 44 | |
| 45 | def ReadFromFile(self, name): |
| 46 | currentCategory = "" |
| 47 | currentComment = [] |
| 48 | currentCommentFinished = 0 |
| 49 | file = open(name) |
| 50 | for line in file.readlines(): |
| 51 | line = sanitiseLine(line) |
| 52 | if line: |
| 53 | if line[0] == "#": |
| 54 | if line[1] == " ": |
| 55 | if currentCommentFinished: |
| 56 | currentComment = [] |
| 57 | currentCommentFinished = 0 |
| 58 | currentComment.append(line[2:]) |
| 59 | else: |
| 60 | currentCommentFinished = 1 |
| 61 | featureType, featureVal = line.split(" ", 1) |
| 62 | if featureType in ["fun", "get", "set"]: |
| 63 | try: |
| 64 | retType, name, value, param1, param2 = decodeFunction(featureVal) |
| 65 | except ValueError: |
| 66 | print("Failed to decode %s" % line) |
| 67 | raise |
| 68 | p1 = decodeParam(param1) |
| 69 | p2 = decodeParam(param2) |
| 70 | self.features[name] = { |
| 71 | "FeatureType": featureType, |
| 72 | "ReturnType": retType, |
| 73 | "Value": value, |
| 74 | "Param1Type": p1[0], "Param1Name": p1[1], "Param1Value": p1[2], |
| 75 | "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2], |
| 76 | "Category": currentCategory, "Comment": currentComment |
| 77 | } |
| 78 | if value in self.values: |
| 79 | raise Exception("Duplicate value " + value + " " + name) |
| 80 | self.values[value] = 1 |
| 81 | self.order.append(name) |
| 82 | elif featureType == "evt": |
| 83 | retType, name, value = decodeEvent(featureVal) |
| 84 | self.features[name] = { |
| 85 | "FeatureType": featureType, |
| 86 | "ReturnType": retType, |
| 87 | "Value": value, |
| 88 | "Category": currentCategory, "Comment": currentComment |
| 89 | } |
| 90 | if value in self.events: |
| 91 | raise Exception("Duplicate event " + value + " " + name) |
| 92 | self.events[value] = 1 |
| 93 | self.order.append(name) |
| 94 | elif featureType == "cat": |
nothing calls this directly
no outgoing calls
no test coverage detected