The editor infrastructure should stop using the old lexical analyzer
(org.netbeans.editor.Syntax and related classes) in favor of the new Lexer API.
Using both APIs has several negative impacts:
1. The modules still need to provide both new Lexers and old Syntaxes, because
some features in the infrastructure are still using old Syntax. That means that
modules have to maintain two lexical analyzers, which is very inconvenient.
2. Since there are still places in the editor infrastructure that need old
Syntax while other places are already using new Lexer, the lexical analysis is
typically done twice, which presents an unnecessary performance penalty. All
current Netbeans main editors such as java, JSP, XML, etc. have already started
using new Lexer API and therefore suffer this problem.
We should provide a clear transition path for migrating module's Syntax-based
lexical analysers to the new Lexer API. It is unlikely that we will be able to
change all existing modules at once and whatever the transition path is it must
allow gradual migration in modul-by-modul fashion. Also, we need a backwards
compatible solution for third party modules may still be using old Syntax even
within nb6.0 platform/IDE.
Ideally, all the classes comprising the old analyser's API/SPI should be
separated from editor/lib to a deprecated autoload module, we should leverage
the autodependencies and inject this new autoload module to the classpath of any
other modules depending on editor/lib module older than the version where this
separation took place.
We should also implement a bridge between Lexer and Syntax that would provide a
Lexer implementation wrapped around an old Syntax to keep the editor
infrastructure backwards compatible. It may not be possible to provide an
efficient implementation of a Syntax-based Lexer, because of the differencies
inherent in both APIs. On the other hand we should be able to provide the Lexer
good enough as a temporary solution for modules that haven't had a chance to
write their own Lexer.
DrawEngine does not use Syntax anymore. Merged to trunk by:
cvs up -j syntax_102406_base_0 -j syntax_102406_delivery_0 editor
Checking in editor/libsrc/org/netbeans/editor/BaseDocument.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseDocument.java,v <-- BaseDocument.java
new revision: 1.141; previous revision: 1.140
Checking in editor/libsrc/org/netbeans/editor/BaseTextUI.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseTextUI.java,v <-- BaseTextUI.java
new revision: 1.86; previous revision: 1.85
Checking in editor/libsrc/org/netbeans/editor/DocumentUtilities.java;
new revision: 1.5; previous revision: 1.4
Checking in editor/libsrc/org/netbeans/editor/DrawEngine.java;
/cvs/editor/libsrc/org/netbeans/editor/DrawEngine.java,v <-- DrawEngine.java
new revision: 1.48; previous revision: 1.47
Checking in editor/libsrc/org/netbeans/editor/DrawEngineLineView.java;
new revision: 1.19; previous revision: 1.18
Checking in editor/libsrc/org/netbeans/editor/DrawLayerFactory.java;
new revision: 1.52; previous revision: 1.51
Checking in editor/libsrc/org/netbeans/editor/FixLineSyntaxState.java;
new revision: 1.7; previous revision: 1.6
Checking in editor/libsrc/org/netbeans/editor/SegmentCache.java;
/cvs/editor/libsrc/org/netbeans/editor/SegmentCache.java,v <-- SegmentCache.java
new revision: 1.7; previous revision: 1.6
Checking in editor/libsrc/org/netbeans/editor/SyntaxSupport.java;
/cvs/editor/libsrc/org/netbeans/editor/SyntaxSupport.java,v <-- SyntaxSupport.java
new revision: 1.41; previous revision: 1.40
There's still support for storing syntax states in line elements. I've attempted to remove it in NB 7.1 but there are still some languages without a lexer (IIRC .properties support). In NB 7.2 I would like to ensure all the languages have a Lexer and remove storage of Syntax.State in line-elements.
Closing old (and presumably obsolete) tasks assigned to me. If something is still needed please reopen...
I guess this is still opened. Also I have assigned it to Mila.
There are a few more old Syntax classes in web.core.syntax under org.netbeans.modules.web.core.syntax.deprecated, is this an issue? There are lexer classes for these languages as well, but the syntax classes are still used in parallel with the lexers.
They are not needed for colorings (already based on the lexer), but for the "plain syntax analyzer" (SyntaxElement class) used by completion and possibly others.