This has been on my to-do list for quite some time. Part of the problem is that there are various approaches, and none of them are well documented. But I think the "most correct" approach is to write a proper Scintilla lexer for ASB. (Scintilla is the actual editor underlying APN.) Here's an example of the kind of short description you can find online:
How to Write a Scintilla Lexer .
The strong implication is that it has to be written in C++ and linked directly to the exe. On the other hand, according to
this article on the Scintilla web site you can also write one in the script language Lua. But, the linking mechanism described doesn't seem quite compatible with PN2, which although it wraps around Scintilla, has a different packaging mechanism than Scite (which is the code editor created as a working example of Scintilla by the Scintilla people. It, however, is just an editor and lacks much of the project management and other IDE aspects of APN, which is why we chose PN2 rather than Scite as the basis for APN. The downside is that the Scintilla-related extension techniques used by Scite are not always applicable).
Currently we are using the generic lexer mechanism, customized with the asb.schemedef and additionalLanguages.conf files. But that scheme configuration doesn't contain enough information to support folding.
There are a couple of dozen lexers already linked in, for a variety of languages. So in theory the plan would be to find one that is most like ASB and use it as a starting point. But it's not obvious which one to use, as none of the languages seem quite like ASB, and most of the examples have been written by different people, to varying levels of completeness, with different approaches, etc.
Aside from coding the lexer, the other challenge is figuring out how to add it to the set of available languages so that it not only compiles and links into the overall exe but that it gets called appropriately when ASB is selected. I'm sure it's doable, but it may be a bit of an adventure.
So, unfortunately, although I would welcome the idea of someone else writing an ASB lexer so that we can take advantage of code folding, I'm not sure how practical it would be, as there is no easy way to work on it without being able to recompile and relink the entire package. (And I fear your boss and/or your customers may find that to be too much of a distraction from your real job.)