Skip to main content

object_macro_replacement_span

Function object_macro_replacement_span 

Source
pub fn object_macro_replacement_span(
    node: Node<'_>,
    source: &str,
) -> Option<Range<usize>>
Expand description

The complete replacement list of an object-like #define.

tree-sitter-cpp lexes a comment inside a replacement as an extra, which ends the preproc_arg token and the preproc_def node with it: libuv’s UV_HANDLE_FIELDS reports void* data; as its whole replacement and loses the eight members that follow the next comment. A replacement list is one preprocessing logical line (C17 5.1.1.2), so its extent is the directive’s own line-continuation run, which the grammar’s token boundaries do not describe. The AST supplies the start; the returned slice is then parsed by tree-sitter like any other replacement.