Dedents a line by the currently defined margin.
(self, line: str)
| 232 | return len(self.indents) |
| 233 | |
| 234 | def dedent(self, line: str) -> str: |
| 235 | """ |
| 236 | Dedents a line by the currently defined margin. |
| 237 | """ |
| 238 | assert self.margin is not None, "Cannot call .dedent() before calling .infer()" |
| 239 | margin = self.margin |
| 240 | indent = self.indents[-1] |
| 241 | if not line.startswith(margin): |
| 242 | fail('Cannot dedent; line does not start with the previous margin.') |
| 243 | return line[indent:] |
| 244 | |
| 245 | |
| 246 | class DSLParser: |