Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

XQuery Editor

Project Description

The current XQuery Development Tools using an Antlr xpath parser does not integrate well with the editor. A javacc implementation that expands the current XML javacc parser would be ideal. I am going to design and implement such a XQuery Development tool. It expands the current XML javacc parser and utilizes the Structured Source Editor.

My Goal

XQuery 1.0 and XPath 2.0 will be supported. Features to be implemented includes Highlighting, Content Assist, Parameter/Attribute Hints, Formatter, Structured Selection, Hover Info, Smart Insert, Open Selection, Find Element, Validating as-you-type, Delimiter Matching, Search Participation, Quick Fix & Quick Assist, Property Sheet, Outline View, Text Folding, Task Tags, block comment and uncomment.

My Solution

The project is intent to develop a grammar-sensitive tool that can edit XQuery/XPath. It helps popularize the using of XQuery Language. The subject is design and implementation of the grammar analyzer for the editor. Grammar analyzer accepts the characters flow from this editor’s UI, then does lexing, parsing and establishs the corresponding grammar analysis tree. Using this tree, most of the above features can be easily implemented. And finally the result (such as the pretty print, the lexical and syntax error report) is passed to the UI.

D2.gif

My Experience

In fact, my bachelor project was to develop an XQuery editor implemented as Eclipse plugin. I provided a wonderful solution could eliminate the ambiguity of XQuery Language Grammar, and generated the Lexer, Parser and build the grammar analysis tree using ANTLR. My plugin has several basic features: Highlighting, Pretty-Printer, Hover Info, Outline View, Text Folding and Hover Info, and all these features had been validated successfully by hundreds of use-cases published by W3C Organization.

Without further optimization, the following query intent to build a huge analysis tree, which will actually significantly decrease performance of the editor. And there are some approaches commonly used to simplify the tree.

    for $b in doc("http://bstore1.example.com/bib.xml")/bib/book
    where $b/publisher = "Addison-Wesley" and $b/@year > 1991
    return
      <book year="{ $b/@year }">
        { $b/title }
      </book>

AnalysisTree.JPG

Back to the top