Re: [SrcML] XHTML-ViewPlugin
Status: Beta
Brought to you by:
crashchaos
From: Icaro <ic...@gm...> - 2005-11-18 13:14:20
|
Frank Raiser ha scritto: >Ok and of course for everyone to fully understand the problem we have to >add that the XHTML generation should be as language independent as >possible. > > You could have a language independnt generator but a language specific color property file for each language. the property file could be a simple set of couple "keyword"<->"color" e.g. for java : class = #BBFFFF,italic (a color code) public = #66FFAA,bold,Courier ... e.g. for python class = #66FFAA,bold def = #FFFFFF,bold,arial self = #3345AA,,Courier ... moreover you could assign a color to word that are not reserved but have special convention (like 'self' in python or String in java etc.) >Therefore you cannot compare the String to "class" and color it >accordingly, as a new language might use "cls" instead. You also have to >be able to deal with a language which can legally have a class called >"class" (and the coloration needs to reflect that it's the name of the >class and not a keyword). > > the property file may be loaded depending on the kind of source and then for all the token in the source file we search it in the small list of significant word. (If 'cls' or 'class' is in the list you color it with the specified color. ) >What about the name of the class being highlighted differently >(identifier color or something)? Well we have the DOM node for the >class, so we can get the name of this class and compare the output >string to that in order to find out. > > This is not so simple to accomplish with property files (perhaps storing regular expression in the property file...) but they can make simple the customization of the result for different purposes: i.e. you could also allow the specification of different combination of color-font for a same language that could be specified as command line paramiters. for example: dark_java_color.property light_java_color.property etc. Another solution could be the use of CSS in combination with the generated HTML. these are only extemporaneous ideas, I don't know in deep the architecture of srcML and probably they would be not applicable at all. So, excuseme for the stupidities that I have written :-) PS: is srcML in some way related to this: http://www.sdml.info/projects/srcml/ (SDML: srcML) -- Domenico http://icaro.blogspot.com |