Monthly Archives: July 2008

Eclipse XQuery – a breakthrough at last…

Last 2 weeks were very productive for the new xquery editor and finally able to get a breakthrough in the project.

I was trying to work out xquery syntax colouring as I thought it is what someone would be expecting first from an editor. So finally it was completed by this weekend and you can see how it is working in the screenshot below.

When first I was thinking how to tokenize the text it was looking pretty gloomy because it would have taken a good amount of time to write ANTLR grammar file, generate tokeninzing scripts and finally fine tune them. But thanks to xqpretty tokenizer it was pretty easy for me to skip first 2 steps and directly go to 3rd step and fine tune it to my needs.

So I tested a good amount with the tokenizer to see whether it meets my requirements for the plugin and also Eclipse standards like license issues (As usual David was a huge help in these matters). Then I had to generalize token types to something around 10 because it was not manageable with more than 100s of token types.  After this was done I added required classes to provide text colouring such as PreferenceInitializer and LineStyleProvider. Then with some more bug fixing and mucking around finally got the required result.

But mind you, this is not completely tested nor bug free. I already have a list of bugs to fix regarding text parsing and some more runtime errors. So if you have a thing for xquery and some spare time, grab a copy please and list any error you see in text parsing (For now you will have to grab a copy from SF  using the address stated below but I’m now working on an update site for the project so it won’t be that hard then)


Eclipse-XQuery Syntax Colouring

Tagged , ,

XQuery plugin – Journey continues…

Last few weeks had been good for the new plugin. Nothing too fnacy yet, but now I think it has a firm basic structure and other necessary classes to name it as an “Eclispe SSE based editor”.

Regarding how it’s processing is done (since that’s what really matters), we have thought of following a somewhat same structure as in HTML+CSS plugins. This is due to the syntax of XQuery which is like a combination of XML and SQL, as you can see from these user cases. So as David suggested, the easiest way is to first understand how HTML plugin handles embedded CSS and then use the same technique to add syntax colouring in the new XQUERY_XPATH context after going through the XQuery Parser.  So now I’m currently going through adding required classes for line styling  and parsing.

So my immediate targets are,

1) Add line colouring and parsing XQuery partition

2) Add content assistance through re-parsing

It’s not easy to materialize a parser out of nowhere. But it has to begin from somewhere, is it not ?

Other than that the plugin now has basic support for Preference pages & Outline so they will also be improved as the project goes on.

Here is a peek at the new editor.

A peek at new XQuery Editor

As I may have mentioned previously, without the help of David and other guys at Eclipse IRC I would have been totally lost. There are gaping holes in Eclipse main documentation and most clsss references on SSE aren’t complete. So as that is what any newcomer will look in to when faced with a tricky situation, I truly think more attention must be put into improving Eclipse documentation and who knows, that alone could attract new energy into Eclipse community.

Tagged , ,