- maybe the syntax highlighting could be done dynamically with informations from an external source. this would allow to define keywords and comment rules for other languages without having to write a new parser.
Ya, that would be cool. I don't know how to do that with Spirit, though. (It would be pretty straightforward if we were using xpressive, since xpressive let's you parse strings into rules, but I don't think Spirit lets you do that. Joel?)
Oops, almost missed this...
The syntax highlighter rules (e.g. comment, identifier... etc) can
certainly use regex (boost/spirit/utility/regex.hpp), or xpressive.
That way, we can have different syntax files for different languages which can be loaded at runtime, say from a specified directory in the
quickbook path. The syntax files can be something as simple as:
c++
{
preprocessor = ...some regex...;
comment = ...some regex...;
keyword = ...some regex...;
special = ...some regex...;
string = ...some regex...;
char = ...some regex...;
number = ...some regex...;
identifier = ...some regex...;
}boost::file_system is used to iterate over the contents of the quickbook_syntax directory. A simple spirit parser is the used to parse the contents and instantiate different syntax highlighters for each language (c++, python, etc).
I welcome anyone who wish to hack on this. Thomas? :)
<<< Oh my... quickbook is growing! :-) >>
Cheers, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Boost-docs mailing list [email protected] Unsubscribe and other administrative requests: https://lists.sourceforge.net/lists/listinfo/boost-docs
