Dsl Editor is a language editor development framework for project indifferent domain specific languages (DSLs). Dsl Editors – that is, editors built using the Dsl Editor framework – are specialized, full function Eclipse-style editors. Dsl Editors can be developed for essentially any textual content having a structure defined by a DSL, provided the DSL can be expressed in an ANTLR grammar.
Eclipse projects often rely on specification driven code generators to produce project supplemental files. Other projects may utilize resource files structured according to a custom, DSL-defined format.
Full-featured, DSL-specific Dsl Editors can be used to create and edit code generator input specification files and resource files. For code generators, the Dsl Editors can automatically run the code generator on incremental and full project builds.
Specific applications include Dsl Editors for:
Editors built using Dsl Editor are completely project indifferent – they have and require no “own” project type and transparently co-exist with one another and with the project primary editors in essentially any Eclipse project. This allows Dsl Editors to be freely used to edit code generator and other resource specifications wherever sited in Eclipse projects. Further, Dsl Editors are entirely self-contained – they are not tied to resources contained in any “home” project.
While very light-weight, Dsl Editors are essentially complete IDE editors. They fully support
Further, Dsl Editor behavior is controlled by a standard set of preference pages quite similar in appearance and functional content to the JDT editor.
The development process is minimal: write a main DSL grammar and four purpose-specific tree grammars, extend a few classes to glue the parts together, and you have an essentially complete editor for the Eclipse platform
The AST defined by the developer contributed ANTLR grammar is used directly as the Dsl Editor internal language model. All editor model dependent operations are driven from a few developer contributed ANTLR tree grammars operating over the AST. The tree grammars are purpose specialized for outline view construction, source formatting, and content assist.
Dsl Editor places no significant constraints on the form or content of the DSL defining grammar. All ANTLR features, including predicates and tree-rewrites, are freely available for developer use in defining the DSL specific lexer, parser, and tree grammars. The tree grammars use the ANTLR standard tree pattern matcher form.
Dsl Editor supports implementation of a standard Eclipse Outline View using a developer provided tree grammar. Dsl Editor provides a small, efficient set of tree grammar actions that are used to drive construction and decoration of the outline content tree. Essentially, all aspects of the outline content tree can be customized. The resulting outline content tree updates in real-time and synchronized to the active Dsl Editor.
Full source formatting is supported by Dsl Editor through a developer provided tree grammar with all formatting behaviors controlled from preference pages. Multiple user defined formatting profiles and formatting previews are supported in the preference pages. The tree grammar is used to locate formattable source features, such as key words, block defining braces and terminal semicolons. A flexible set formatting functions, as provided by Dsl Editor, tie these source features to preference references. The formatting functions are called from the tree grammar actions to provide preference value defined indentation, spacing, and wrapping control.
A developer provided tree grammar is used to identify related source elements. Dsl Editor uses these identified relations to provide full Mark Occurrences highlighting and hypertext linking between elements in the source viewer.
Standard Eclipse template support is provided by Dsl Editor. Both developer provided and user built templates are supported. Standard Eclipse template preference page is provided for defining and editing templates.
A developer provided tree grammar is used to identify source contexts. Dsl Editor uses these identified contexts in combination with preamble text at the point of content assist invocation to select and present completion suggestions. The standard Eclipse content assist/templates swivel popup is used.