The capability to create dynamic syntax highlighters could/would augment (not necessarily replace) the existing Spirit-grammar-based source modes, right? Or is this referring to some other problem?This is my main problem with the proposed extension: when I wanted to extend QuickBook to cope with a new source mode, I chose to add a Spirit parser and recompile. If I wanted to add yet another source mode, I'd probably find it easier to create a new Spirit grammar for that mode than to get the regexes going. Why at startup? Why not actually load (include) dynamic syntax definitions explicitly, something like "[sourcemode foo]" pulling in "foo.highlight_def_extension"? This could look first in the local directory, then search relative to a some standard lookup path (perhaps $BOOST/tools/QuickBook/highlighters ?). It might allow for more intelligent feedback on errors (i.e., dependency on a definition file that isn't found). I think it could even be leveraged to allow BBv2 to treat referenced definitions as dependencies, triggering a QuickBook "rebuild" if the definition is updated (which might be much harder to do otherwise, short of any change to any definition file triggering every .qbk to get reprocessed whether or not it used that definition). As a means of extending QuickBook to deal with new grammars, it looks like a great idea to me. I'm not sure I would rush to replace the existing Spirit C++ and Python grammars, but this would be great for adding in other oddball stuff. When I was updating quickbook.qbk, it occurred to me how nice it would be to have syntax highlighting for showing 'literal' xml/html and even Quickbook syntax. This seems to be a great way to get that in there. The Spirit parser and the dynamic grammar Thomas created appear to be using consistent names so far, which is great. If we keep it consistent (and maybe even document the intentions for the various atomic bits more formally) it should make things easier over time. One issue to consider is how to create "highlighted output" from a dynamic scheme. If the syntax definition file only deals with classifying the source code ("here's an identifier, there's a keyword"), leaving the mechanics of formatting the output (i.e., "void" becomes "<phrase role="keyword">void</phrase>") to the QuickBook internals, the overall system should be more robust and the dynamic definitions easier to create. The consistent use of named regular expressions would be very helpful there, as QuickBook could determine the output format for a given span by simply using the name of the _expression_ which it matched. Is that supposed to be a problem? ; ) I had never looked at python until I started working with Boost, so I just kind of consider it the Boost scripting language... hmm... which macros would those be?I'll keep working on this, then. I already have a standalone dynamically configurable syntax highlighter based on Spirit, Boost Regex and the scheme I posted. I just need to integrate it into QuickBook -- I think those QuickBook macros might give me trouble again! - james -- __________________________________________________________ James Fowler, Open Sea Consulting http://www.OpenSeaConsulting.com, Marietta, Georgia, USA Do C++ Right. http://www.OpenCpp.org, opening soon! |
- [Boost-docs] [ANN] QuickBook 1.0 now in boost/tools Eric Niebler
- [Boost-docs] Re: [ANN] QuickBook 1.0 now in boost/tool... Stefan Slapeta
- [Boost-docs] Re: [ANN] QuickBook 1.0 now in boost/... Eric Niebler
- [Boost-docs] Re: [ANN] QuickBook 1.0 now in bo... Joel de Guzman
- [Boost-docs] Re: [ANN] QuickBook 1.0 now i... Thomas Guest
- [Boost-docs] Re: [ANN] QuickBook 1.0 ... Thomas Guest
- [Boost-docs] Dynamically Loadable... Joel de Guzman
- [Boost-docs] Re: Dynamically ... Thomas Guest
- [Boost-docs] Re: Dynamically ... James Fowler
- [Boost-docs] Re: Dynamically ... Thomas Guest
- [Boost-docs] Re: Dynamically ... Joel de Guzman
- Re: [Boost-docs] Re: Dynamica... James Fowler
- [Boost-docs] Re: Dynamically ... Joel de Guzman
- RE: [Boost-docs] Re: Dynamica... Reece Dunn
- [Boost-docs] Re: Dynamically ... Joel de Guzman
- Re: [Boost-docs] Re: Dynamica... James Fowler
- Re: [Boost-docs] Re: Dynamica... James Fowler
- Re: [Boost-docs] Re: Dynamica... Reece Dunn
- Re: [Boost-docs] Re: Dynamica... James Fowler
