4 ms·
That code sounds pretty interesting, especially if it's adaptable to arbitrary open/close sequences if (.*?) { vs #ifdef .* ... #else ... #endif I'
by shabble 15y ago
That code sounds pretty interesting, especially if it's adaptable to arbitrary open/close sequences
if (.*?) {
vs
#ifdef .* ... #else ... #endif
I'd be interested in seeing it, even if it's a pastebin/gist dump that needs some cleanup.
- rcfox 15y agoUnfortunately, it's only for #if .* ... #el.* ... #endif. I didn't want to write that much of a parser, so I just push the line number onto a stack if I see a line like /^\s*#if/. I guess Emacs is using some kind of parser to do syntax highlighting, right? I wonder if it's possible to tap into that...
- shabble 15y agoYeah, I'm pretty sure it does, although I've never poked deeply enough / understood elisp well enough to know exactly how it does it. Swapping out those regexen you have wouldn't be too much of a challenge, I don't think, at least for a first shot at it. I'm more interested in the general structure of managing the counter, applying the various faces to lines, etc. My email is in profile if you want someone to attempt to clean it up a bit (insofar as I'm capable of doing so) :)