Returns the text of the first `sym_lit` child.
(state: &ExtractionState, node: TsNode<'_>)
| 393 | |
| 394 | /// Returns the text of the first `sym_lit` child. |
| 395 | fn first_sym(state: &ExtractionState, node: TsNode<'_>) -> Option<String> { |
| 396 | let mut cursor = node.walk(); |
| 397 | if cursor.goto_first_child() { |
| 398 | loop { |
| 399 | let child = cursor.node(); |
| 400 | if child.kind() == "sym_lit" { |
| 401 | return Some(state.node_text(child)); |
| 402 | } |
| 403 | if !cursor.goto_next_sibling() { |
| 404 | break; |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | None |
| 409 | } |
| 410 | |
| 411 | /// Returns the text of the Nth `sym_lit` child (0-indexed among named children). |
| 412 | fn nth_sym(state: &ExtractionState, node: TsNode<'_>, n: usize) -> Option<String> { |