| 21 | self.codingType = None |
| 22 | self.parseCodingType(descriptor) |
| 23 | def parseCodingType(self, descriptor : str): |
| 24 | if (descriptor.startswith("f(")): |
| 25 | self.codingType = Coding.FIXED_CODE |
| 26 | self.length = int(descriptor[2:-1]) |
| 27 | elif (descriptor.startswith("u(v)")): |
| 28 | self.codingType = Coding.UNSIGNED_VARIABLE |
| 29 | elif (descriptor.startswith("u(")): |
| 30 | self.codingType = Coding.UNSIGNED_FIXED |
| 31 | self.length = int(descriptor[2:-1]) |
| 32 | elif (descriptor.startswith("ue(v)")): |
| 33 | self.codingType = Coding.UNSIGNED_EXP |
| 34 | elif (descriptor.startswith("se(v)")): |
| 35 | self.codingType = Coding.SIGNED_EXP |
| 36 | else: |
| 37 | raise SyntaxError("Unknown descriptor type " + descriptor) |
| 38 | def __str__(self): |
| 39 | if (self.codingType == Coding.FIXED_CODE): |
| 40 | return f"f({self.length})" |