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

Difference between revisions of "JSDT/JSDT-DOM-and-bindings"

 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
<div style="float:right">
 +
__TOC__
 +
</div>
 +
 
This page explains the ClosureCompiler AST, the JSDT core DOM AST and its Bindings to the Eclipse IDE, including
 
This page explains the ClosureCompiler AST, the JSDT core DOM AST and its Bindings to the Eclipse IDE, including
  
* History of JSDT parsing from 1.0 to 2.0
+
* ''History of JSDT parsing'' from 1.0 to 2.0
* Parsing with Closure Compiler and generation of its AST: the ParseTree
+
* ''Parsing with Closure Compiler'' and generation of its AST: the ParseTree
* Conversion of the CC ParseTree to the jsdt.core.dom.AST (aka DOM Model) .  
+
* ''Conversion of the AST'' from the CC ParseTree to the jsdt.core.dom.AST (aka DOM Model) .  
* Binding of the jsdt.dom.AST model, to provide outline, content assist, indexing, etc.  
+
* ''Binding of the DOM model'', to provide outline, content assist, indexing, etc.  
 +
 
  
Other JSDT Architectural information is reported in the parent page [https://wiki.eclipse.org/JSDT/Architecture JSDT/Architecture].
+
See also: [https://wiki.eclipse.org/JSDT/Architecture JSDT/Architecture].
  
 
== JSDT parsing from 1.0 to 2.0==
 
== JSDT parsing from 1.0 to 2.0==
Line 31: Line 36:
 
[https://github.com/google/closure-compiler/wiki/Using-the-Compiler's-Java-API how to use the Java API], and  
 
[https://github.com/google/closure-compiler/wiki/Using-the-Compiler's-Java-API how to use the Java API], and  
 
[https://github.com/google/closure-compiler/wiki/Writing-Compiler-Pass how to write compiler passes].  
 
[https://github.com/google/closure-compiler/wiki/Writing-Compiler-Pass how to write compiler passes].  
 +
 
Anyway, most of the documentation is in the code, and we suggest you take a look at the followings:  
 
Anyway, most of the documentation is in the code, and we suggest you take a look at the followings:  
 
* Closure Compiler source on GitHub: https://github.com/google/closure-compiler
 
* Closure Compiler source on GitHub: https://github.com/google/closure-compiler
Line 37: Line 43:
 
== DOM AST ==  
 
== DOM AST ==  
  
The [http://help.eclipse.org/neon/topic/org.eclipse.wst.jsdt.doc/reference/api/org/eclipse/wst/jsdt/core/dom/AST.html AST] class
+
The class [http://help.eclipse.org/neon/topic/org.eclipse.wst.jsdt.doc/reference/api/org/eclipse/wst/jsdt/core/dom/AST.html AST] (in package [http://help.eclipse.org/neon/topic/org.eclipse.wst.jsdt.doc/reference/api/org/eclipse/wst/jsdt/core/dom/package-summary.html org.eclipse.wst.jsdt.core.dom]),
The package [http://help.eclipse.org/neon/topic/org.eclipse.wst.jsdt.doc/reference/api/org/eclipse/wst/jsdt/core/dom/package-summary.html org.eclipse.wst.jsdt.core.dom] contains the class
+
is the AST used in JSDT core. It contains all the information needed to create outline, content assist etc..
 
+
This is the AST used in JSDT core. It contains all the information needed to create outline, for content assist etc..
+
  
 
== Bindings ==
 
== Bindings ==
  
 
This part is about the bindings needed to show the model in the outline, to provide content assist, indexing etc.
 
This part is about the bindings needed to show the model in the outline, to provide content assist, indexing etc.
 +
 +
'''COMPLETE:'''
 +
* to create outline, look at this class/references
 +
* to provide content assist, look at these class/references:
 +
* to understand how indexing works, look at these references.
  
 
== Other Notes ==
 
== Other Notes ==

Latest revision as of 08:34, 19 April 2017

This page explains the ClosureCompiler AST, the JSDT core DOM AST and its Bindings to the Eclipse IDE, including

  • History of JSDT parsing from 1.0 to 2.0
  • Parsing with Closure Compiler and generation of its AST: the ParseTree
  • Conversion of the AST from the CC ParseTree to the jsdt.core.dom.AST (aka DOM Model) .
  • Binding of the DOM model, to provide outline, content assist, indexing, etc.


See also: JSDT/Architecture.

JSDT parsing from 1.0 to 2.0

Starting from Eclipse Oxygen, JSDT 2.0 uses Closure Compiler for parsing. After parsing, a converter transforms the CC's ParseTree into the jsdt.core.dom.AST. Then, bindings are used to consume the DOM model to provide content assist, code completion, etc.

In the past, we changed parser/compiler toolchain twice:

  • JSDT 1.0, until Mars.2: supports ES3 using Rhino (Mozilla Foundation), a Java-based parser/compiler for JavaScript.
  • JSDT 2.0, initial release: supports ES6 using Esprima (jQuery Foundation). As Esprima is written in JavaScript, this version of JSDT 2.0 needs to hook Nashorn, the Java8’s JS interpreter.
  • JSDT 2.0, from Neon.2 release: supports ES6 using ClosureCompiler (Google), a java-based parsing infrastructure for JavaScript.


ClosureCompiler AST

The google/closure-compiler project, has a wiki with tutorials, FAQs and design documents, which explain how to use the Java API, and how to write compiler passes.

Anyway, most of the documentation is in the code, and we suggest you take a look at the followings:

DOM AST

The class AST (in package org.eclipse.wst.jsdt.core.dom), is the AST used in JSDT core. It contains all the information needed to create outline, content assist etc..

Bindings

This part is about the bindings needed to show the model in the outline, to provide content assist, indexing etc.

COMPLETE:

  • to create outline, look at this class/references
  • to provide content assist, look at these class/references:
  • to understand how indexing works, look at these references.

Other Notes

See commit https://git.eclipse.org/r/#/c/57504/ (M.Istria) to see the new outline

Back to the top