(s: str, i: int)
| 19 | return i+1, (RegexType.OR, regexes) |
| 20 | |
| 21 | def parse_regex(s: str, i: int) -> tuple[int,Regex]: |
| 22 | r = [] |
| 23 | while i < len(s) and s[i] not in "|)": |
| 24 | if s[i] == '(': |
| 25 | i,r1 = parse_regexor(s,i+1) |
| 26 | else: |
| 27 | iprev = i |
| 28 | while i < len(s) and s[i] in "NSEW": |
| 29 | i += 1 |
| 30 | r1 = (RegexType.SIMPLE, s[iprev:i]) |
| 31 | r.append(r1) |
| 32 | return i, (RegexType.LIST, r) |
| 33 | |
| 34 | def apply_regex(m: Graph, regex: Regex, coords: set[tuple[int,int]]) -> set[tuple[int,int]]: |
| 35 | match regex[0]: |
no test coverage detected