def make_range(self, node, rel): text = node.text if rel == "<": n = syntax.RangeNode(None, text, False, True) elif rel == ">": n = syntax.RangeNode(text, None, True, False) elif rel == "<=" or rel == "=<": n = syntax.RangeNode(None, text, False, False) elif rel == ">=" or rel == "=>": n = syntax.RangeNode(text, None, False, False) return n.set_range(node.startchar, node.endchar)
def create(self, parser, match): start = match.group("start") end = match.group("end") if start: # Strip the space before the "to" start = start.rstrip() # Strip single quotes if start.startswith("'") and start.endswith("'"): start = start[1:-1] if end: # Strip the space before the "to" end = end.lstrip() # Strip single quotes if end.startswith("'") and end.endswith("'"): end = end[1:-1] # What kind of open and close brackets were used? startexcl = match.group("open") == self.excl_start endexcl = match.group("close") == self.excl_end rn = syntax.RangeNode(start, end, startexcl, endexcl) return rn