Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 197a7ae

Browse files
author
Hendrik van Antwerpen
authored
Merge pull request #135 from github/parse-tree-positions
Use one-based positions in user facing output
2 parents 19d315b + 3066903 commit 197a7ae

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

tree-sitter-stack-graphs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
- Builtins can be explicitly supplied using the `--builtins` flag. If the given path does not have a file extension, the file extension of the language is implicitly added.
1515
- A new `init` command can be used to generate new tree-sitter-stack-graphs projects for NPM distributed Tree-sitter grammars.
16+
- The syntax tree printed by `parse` shows one-based node positions.
1617

1718
#### Changed
1819

tree-sitter-stack-graphs/src/bin/tree-sitter-stack-graphs/parse.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ impl Command {
9494
print!("{}: ", field_name);
9595
}
9696
print!(
97-
"({} [{}, {}] - [{}, {}]",
97+
"({} [{}:{} - {}:{}]",
9898
node.kind(),
99-
start.row,
100-
start.column,
101-
end.row,
102-
end.column
99+
start.row + 1,
100+
start.column + 1,
101+
end.row + 1,
102+
end.column + 1
103103
);
104104
needs_newline = true;
105105
}

0 commit comments

Comments
 (0)