The dom package
This module defines a DOM (Document Object Model) for LilyPond source files.
This LilyPond DOM is a simple tree structure where a command or environment is represented by a node with possible child nodes.
Some LilyPond commands have their own node type, and the arguments are represented by child nodes, while other commands use a generic Command node.
This DOM is used in two ways:
Building a LilyPond source document from scratch. This helps to create a LilyPond document, although it in no way forces the output to be a valid LilyPond file.
Transforming a parce tree of an existing LilyPond source document to a DOM document. All tokens are stored in the nodes (in the
originattributes), so it is possible to write back modifications to the original document without touching other parts of the document.
All nodes in this DOM inherit from the
Modules in the