dwcoates / pygn-mode

An Emacs major-mode for chess PGN files, powered by Python
BSD 2-Clause "Simplified" License
10 stars 3 forks source link

Support recursive variations, which were recently added to the grammar #199

Closed rolandwalker closed 2 years ago

rolandwalker commented 2 years ago

~This is branched off of #193 and will look like a mess until rebased.~ rebased

Since the upstream packaged grammar now supports a distinction between recursive variations and top-level variations, we add support for that distinction here, allowing recursive variations to have different faces.

We also add tests, but note that the "closest" node names for any given position are not special recursive forms, but ordinary forms such as move_number. The new recursive_variation node is a sort of container that spans the whole variation; the elements within it are not changed. This might be a little hard to remember, because the faces do change for every element within a recursive variation.

Also worth noting is that there is no attempt to count the degree of nesting, and no "rainbow" style syntax highlighting is possible. All variations below the toplevel are treated identically as recursive_variation.