[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    Re: Reusing KHTMLs CSS parser for a KDevelop language plugin
From:       Olivier Goffart <ogoffart () kde ! org>
Date:       2009-10-22 18:13:38
Message-ID: 200910222013.39094.ogoffart () kde ! org
[Download RAW message or body]

Le Wednesday 21 October 2009, Milian Wolff a écrit :
> Hello!
> 
> Sooner or later I want to start on a language plugin to add CSS support to
> KDevelop (and eventually Quanta).
> 
> For that I need a tokenizer and a parser. So far, each language plugin in
> KDevelop uses an AST and the Visitor concept to build the DUChain. As I've
> never used Flex myself, and am by far no expert in parsers, does the CSS
> parser support the Visitor concept?
> 
> Nevertheless, I'd like to at least reuse the tokenizer from kdelibs and
>  would write a grammar for Kdevelop-pg-qt to get a parser with an AST.
> 
> I had a quick look at kdelibs/khtml/css and I see that neither the parser,
>  nor the tokenizer gets installed. Of course, this makes sense if noone
>  uses it outside of KHTML. Could this be changed? Or would those classes
>  then have to stay BC and this is not possible/wanted for such internal
>  classes?

Last time I checked, the webkit css implementation was very tight to webkit.

> Alternatively to the above, are there maybe KHTML APIs I can use that give
>  me a low-level analysis of a given CSS file? I'd need e.g. a list of rule
>  definitions, imports, charset statements, together with line numbers where
>  they occur. That should actually be enough to build a DUChain.

There is the Qt CSS implementation that provide all of this (maybe not the 
line number but that could be added)
This is in src/gui/text/qcss*
It is used both for the QStyleSheetStyle, Rich text parsing, and QtSVG

You may copy those files in your code.

I think it may be a good idea to get some public API for CSS parsing out of 
this.
 

--
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic