Tree-sitter grammar to parse (open)SUSE changes files. Assisted with Claude Code.
Here is an example of the format used. You can find more examples in openSUSE build service.
-------------------------------------------------------------------
Wed Dec 2 07:06:28 UTC 2026 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>
- Initial implementation (gh#imobachgs/tree-sitter-obschanges#1).
This parser extracts the datetime, the author and the list of changes (items and their continuation lines). Plain text is not part of the tree, but each reference is. Hence the output would be something like:
(source_file [0, 0] - [4, 0]
(change [0, 0] - [4, 0]
(separator [0, 0] - [1, 0])
(header [1, 0] - [2, 0]
(datetime [1, 0] - [1, 28]
(dow [1, 0] - [1, 3])
(month [1, 4] - [1, 7])
(dom [1, 9] - [1, 10])
(time [1, 11] - [1, 19])
(tz [1, 20] - [1, 23])
(year [1, 24] - [1, 28]))
(author [1, 31] - [1, 77]
(name [1, 31] - [1, 52])
(email [1, 53] - [1, 77])))
(item [3, 0] - [4, 0]
(bullet [3, 0] - [3, 2])
(reference [3, 26] - [3, 64])))
The following references are recognized and exposed as reference nodes. The
parser does not distinguish between them. The prefix can be anything (a
letter followed by letters, digits or underscores), so private Open Build
Service instances can define their own trackers.
| Form | Example | Typical use |
|---|---|---|
prefix#N |
bsc#12948, abc#111 |
Bugzilla (bsc, boo, bnc), FATE (fate) |
prefix#KEY-N |
jsc#PED-17039 |
JIRA |
prefix#owner/repo#N |
gh#agama-project/agama#42 |
GitHub issues and pull requests |
CVE-YYYY-NNNN |
CVE-2024-12345 |
CVE identifiers |
A reference must start at a word boundary: (abc#1) is a reference, and
xbsc#1 is a reference with the prefix xbsc. Text that does not follow one
of the forms above, like C# or page#anchor, is not.
A highlight query is available in queries/highlights.scm. You can try it
with npx tree-sitter highlight FILE.
The behavior that editor plugins built on this grammar share (highlighting roles, reference links, updating the datetime of an entry and navigation) is described in docs/editor-behavior.md.
- Emacs: obschanges-ts-mode.
- Neovim: obschanges.nvim.
npm install # install dependencies and build the Node binding
npx tree-sitter generate # regenerate the parser from grammar.js
npx tree-sitter test # run the corpus tests (test/corpus)
npx tree-sitter parse FILE # print the syntax tree of a file
If you want to contribute to tree-sitter-obschanges, feel free to open an issue or a pull
request.