Fetch right-hand value of assignment.
(self)
| 198 | self.comment: str | None = None |
| 199 | |
| 200 | def fetch_rvalue(self) -> list[Token]: |
| 201 | """Fetch right-hand value of assignment.""" |
| 202 | tokens = [] |
| 203 | while current := self.fetch_token(): |
| 204 | tokens.append(current) |
| 205 | if current == [OP, '(']: |
| 206 | tokens += self.fetch_until([OP, ')']) |
| 207 | elif current == [OP, '{']: |
| 208 | tokens += self.fetch_until([OP, '}']) |
| 209 | elif current == [OP, '[']: |
| 210 | tokens += self.fetch_until([OP, ']']) |
| 211 | elif current == INDENT: |
| 212 | tokens += self.fetch_until(DEDENT) |
| 213 | elif current == [OP, ';']: # NoQA: SIM114 |
| 214 | break |
| 215 | elif current and current.kind not in {OP, NAME, NUMBER, STRING}: |
| 216 | break |
| 217 | |
| 218 | return tokens |
| 219 | |
| 220 | def parse(self) -> None: |
| 221 | """Parse the code and obtain comment after assignment.""" |
no test coverage detected