Copy the grammar.
(self: _P)
| 129 | self._update(pickle.loads(pkl)) |
| 130 | |
| 131 | def copy(self: _P) -> _P: |
| 132 | """ |
| 133 | Copy the grammar. |
| 134 | """ |
| 135 | new = self.__class__() |
| 136 | for dict_attr in ( |
| 137 | "symbol2number", |
| 138 | "number2symbol", |
| 139 | "dfas", |
| 140 | "keywords", |
| 141 | "soft_keywords", |
| 142 | "tokens", |
| 143 | "symbol2label", |
| 144 | ): |
| 145 | setattr(new, dict_attr, getattr(self, dict_attr).copy()) |
| 146 | new.labels = self.labels[:] |
| 147 | new.states = self.states[:] |
| 148 | new.start = self.start |
| 149 | new.version = self.version |
| 150 | new.async_keywords = self.async_keywords |
| 151 | return new |
| 152 | |
| 153 | def report(self) -> None: |
| 154 | """Dump the grammar tables to standard output, for debugging.""" |
no outgoing calls
no test coverage detected