[cedet-semantic] Semantic ("Hierarchical") Syntax Highlighting
Brought to you by:
zappo
From: Jeff W. <je...@no...> - 2007-09-09 16:41:09
|
Hey, I'm rather new to Cedet, Lisp and Emacs, coming from the world of Textmate. I really like what I see, but there is one thing that I think Semantic has very nearly done, but from what I can tell has left undone. Let me explain a bit of context, first, though. Textmate has the concept of "scopes" which allows certain features, most importantly the syntax highlighting and tab triggers, to know their spot in the parse tree. Textmate is lame and does this via regexes (although recursively submatching elements to form the tree, as far as I know), although it still is a very powerful system. The highlighting in Textmate can therefore be somewhat similar to CSS, in how it cascades. A "scope selector" is very similar to a CSS selector but for TM themes; for example, one could have a background-style for "source.lisp", another style for "keyword" (e.g. bold), and then a style for "source.lisp keyword" which, like CSS, would inherit the properties from both the other elements (or could simply change the color, and not add any conflicting rules, so all would be applied). Now, the CSS-like syntax is a bit complicated, and I don't see how it could fit into Lisp easily. However, to me, it makes a lot of sense to have a syntax highlighter based on the Semantic parser, rather what I see in Font Lock (very simple highlighting that is rather unintelligent, relatively). Because the parse tree already exists, I assume doing something like this would require simply allowing styling different elements, and not overriding parent styles. That way, a parent could style one property (e.g. make the text italics) and the child could redefine a different property, without changing the parent's properties (and therefore, the child would also be italicized). >From my understanding, nothing like this exists, and I can't find any discussion of anything like this on this mailing list. I'd be willing to play with it, if I could get a few pointers in the right direction (as I said, I'm brand new to a lot of these things). Jeff Wheeler (p.s., I'm sending this message again because it does not appear to have gone through the first time. If I've double-posted, I sincerely apologize.) |