Collect all lines from the program into a structured list.
(state: &ExtractionState, root: TsNode<'a>)
| 155 | |
| 156 | /// Collect all lines from the program into a structured list. |
| 157 | fn collect_lines<'a>(state: &ExtractionState, root: TsNode<'a>) -> Vec<BasicLine<'a>> { |
| 158 | let mut lines = Vec::new(); |
| 159 | let mut cursor = root.walk(); |
| 160 | if cursor.goto_first_child() { |
| 161 | loop { |
| 162 | let node = cursor.node(); |
| 163 | if node.kind() == "line" { |
| 164 | if let Some(basic_line) = Self::parse_line(state, node) { |
| 165 | lines.push(basic_line); |
| 166 | } |
| 167 | } |
| 168 | if !cursor.goto_next_sibling() { |
| 169 | break; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | lines |
| 174 | } |
| 175 | |
| 176 | /// Parse a single `line` node into a `BasicLine` struct. |
| 177 | fn parse_line<'a>(state: &ExtractionState, node: TsNode<'a>) -> Option<BasicLine<'a>> { |
nothing calls this directly
no test coverage detected