ll-sparql-parser 0.11.1

A resilient LL parser for SPARQL
Documentation
1
2
3
4
5
6
7
8
9
use crate::SyntaxNode;

pub(super) fn nth_ancestor(syntax: SyntaxNode, n: usize) -> Option<SyntaxNode> {
    let mut node = syntax;
    for _x in 0..n {
        node = node.parent()?;
    }
    return Some(node);
}