Sun, 10 Dec 2017 15:37:26 +0200
Initial commit with half-done parsing function
class EmptyLine: def __repr__(self): return 'linetypes.EmptyLine()' class Comment: def __init__(self, text, style = 'old'): if style == 'old' and text.startswith('//'): self.text = text[3:].strip() self.style = 'new' else: self.text = text self.style = style def __repr__(self): return str.format('linetypes.Comment({text!r}, {style!r})', text = self.text, style = self.style, ) class SubfileReference: def __init__(self, *, color, subfile_path, anchor, matrix): self.color, self.subfile_path, = color, subfile_path self.anchor, self.matrix = anchor, matrix def __repr__(self): return str.format('linetypes.SubfileReference(' \ 'color = {color!r}, ' \ 'subfile_path = {subfile_path!r}, ' \ 'anchor = {anchor!r}, ' \ 'matrix = {matrix!r})', **self.__dict__) class LineSegment: def __init__(self, *, color, geometry): self.color, self.geometry = color, geometry def __repr__(self): return str.format('linetypes.{typename}(' \ 'color = {color!r}, ' \ 'geometry = {geometry!r})', typename = type(self).__name__, color = self.color, geometry = self.geometry, ) class Triangle(LineSegment): pass class Quadrilateral(LineSegment): pass