[CMake] List of 'Reserved Words'
Michael Jackson
mike.jackson at bluequartz.net
Tue Nov 18 20:36:33 EST 2008
On Nov 18, 2008, at 6:48 PM, Matthew Woehlke wrote:
> Michael Jackson wrote:
>> Thanks. But how exactly are you "adding" those? By Hand or do you
>> have some sort of script that parses CMake or .. ? It would be
>> great if we could "sync up" the kate and some of the other editors
>> to "standardize" on how the syntax coloring is broken down.
>
> Obviously I am behind on reading this list :-) (see the message I
> just posted about unset not listed).
>
> I have had, for some time, a script to generate keyword lists from
> cmake's built-in help.
>
> The "meat" (arg extraction) looks like this:
>
> extract_args() {
> sed -e '/'"$1"'(/ba' \
> -e 'd' \
> -e ':a' \
> -e '/)/{s/^.*(\(.*\)).*$/\1/p;d}' \
> -e 'N;s/\n/ /;ba' | \
> sed -e 's/[][]//g' -e 's/|\| \+/\n/g' | \
> sed -n '/^[[:upper:][:digit:]_]\+$/p' >> $t.args
> }
> while read COMMAND ; do
> "$CMAKE" --help-command $COMMAND | extract_args $COMMAND
> done < $t.commands
> sort $t.args | uniq > $t.argsu
>
>> I just don't want to reinvent the wheel unless I really need to. I
>> would be happy to update my XML parser to add a kate syntax xml
>> file generation...
>
> Well, I'm already doing that... :-) What XML, though? Are you
> parsing 'cmake --help-html'? Or is there something that clearly
> delineates cmake keywords that I don't know about?
>
> --
> Matthew
> Please do not quote my e-mail address unobfuscated in message bodies.
I am parsing the $CMAKE_BUILD/Docs/cmake.docbook file. There is just
enough information with the tags to parse out all the commands,
variables and properties. What _is not_ in that file are the "reserved
words" or "special arguments" in any _easy_ tags. I can parse the
usage tags and do something like you are doing with the sed scripts
and pull those special words out. (I have to admit that I have only a
passing clue what is going on in those sed statements).
The XML parser that I wrote is a SAX type (based on Expat) and
some boost stuff for the string processing. If we can convert it to
something that does not depend on the whole of KDE that would probably
help us both, which is what I am interested in.
As I said before, if my code proves useful I would be happy to give
it to the KDE project for their use. The Boost project will also want
to use it as I am brining the CMake build system up to date for that
project also.
I also am updating the Eclipse and TextMate language definitions,
so that is at least 2 editors that can directly use the code. I was
looking at the latest BBEdit SDK and you can define a language
extension in XML so that would be a third editor. Kate makes a fourth.
I think it would be beneficial to work together on this. My only
comment on a shell script is that it wouldn't work directly on windows
without MSys or Cygwin installed.
I also gave XSLT a try but couldn't quite come up to speed quick
enough on the language to really figure out if I could do what I
needed to do. I had the XML processing code laying around from another
project so writing the code to parse the docbook was generally
straight forward.
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
www.bluequartz.net
More information about the CMake
mailing list