Skip to content

Commit

Permalink
Document definiens_node
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikvanantwerpen committed Oct 9, 2023
1 parent 0d4f95a commit 31fbee7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tree-sitter-stack-graphs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@
//! }
//! ```
//!
//! ### Annotating definitions with definiens information
//!
//! You cannot annotate definitions with a definiens, which is the thing the definition covers. For example, for
//! a function definition, the definiens would be the function body. To do this, add a `definiens_node` attribute,
//! whose value is a syntax node that spans the definiens.
//!
//! ``` skip
//! (function_definition name: (identifier) @id body: (_) @body) @func {
//! node def
//! ; ...
//! attr (def) definiens_node = @body
//! }
//! ```
//!
//! ### Connecting stack graph nodes with edges
//!
//! To connect two stack graph nodes, use the `edge` statement to add an edge between them:
Expand Down

0 comments on commit 31fbee7

Please sign in to comment.