One or more physical lines that together form one logical unit.
| 273 | |
| 274 | @dataclass |
| 275 | class LogicalLine: |
| 276 | """One or more physical lines that together form one logical unit.""" |
| 277 | |
| 278 | raws: list[str] = field(default_factory=list) # raw source lines (no newlines) |
| 279 | kind: str = ( |
| 280 | "other" # "id" | "prop" | "blank" | "comment" | "open" | "close" | "handler" | "other" |
| 281 | ) |
| 282 | start_idx: int = 0 # index of first physical line in the source |
| 283 | |
| 284 | @property |
| 285 | def length(self) -> int: |
| 286 | """Total rendered length = first physical line's length (for sorting).""" |
| 287 | return len(self.raws[0]) if self.raws else 0 |
| 288 | |
| 289 | @property |
| 290 | def text(self) -> str: |
| 291 | """Concatenated stripped first-line text, mainly for classification.""" |
| 292 | return self.raws[0].strip() if self.raws else "" |
| 293 | |
| 294 | |
| 295 | def physical_kind(raw: str) -> str: |