From my - admittedly somewhat limited - experience with bundle grammars I got the feeling that it’s often very hard to improve or fix a grammar without accidentally breaking some other parts of it.
Has anyone already experimented with regression tests for bundle grammars?
I think to make this possible it would be necessary to somehow access the “scope structure” of a parsed file, maybe yielding a data structure like this:
[ { start: 0, end: 123, scope: "source.sass" }, { start: 7, end: 12, scope: "string.quoted.double.sass" }, … ]
Then a grammar could include both a “test source file” and its known-good “scope structure”. After changing the grammar one could (semi-)automatically regenerate the scope structure data and compare it to the original to (hopefully) catch any regressions.
Any thoughts?
Stefan