Bug 102406 - Stop using and deprecate Syntax
Stop using and deprecate Syntax
Product: editor
Classification: Unclassified
Component: -- Other --
All All
: P2 (vote)
: 7.2
Assigned To: Miloslav Metelka
Depends on: 124590
  Show dependency treegraph
Reported: 2007-04-24 23:12 UTC by Vitezslav Stejskal
Modified: 2012-05-28 14:15 UTC (History)
2 users (show)

See Also:
Issue Type: TASK


Note You need to log in before you can comment on or make changes to this bug.
Description Vitezslav Stejskal 2007-04-24 23:12:39 UTC
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.
Comment 1 Vitezslav Stejskal 2007-04-27 03:27:58 UTC
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;
/cvs/editor/libsrc/org/netbeans/editor/DocumentUtilities.java,v  <-- 
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;
/cvs/editor/libsrc/org/netbeans/editor/DrawEngineLineView.java,v  <-- 
new revision: 1.19; previous revision: 1.18
Checking in editor/libsrc/org/netbeans/editor/DrawLayerFactory.java;
/cvs/editor/libsrc/org/netbeans/editor/DrawLayerFactory.java,v  <-- 
new revision: 1.52; previous revision: 1.51
Checking in editor/libsrc/org/netbeans/editor/FixLineSyntaxState.java;
/cvs/editor/libsrc/org/netbeans/editor/FixLineSyntaxState.java,v  <-- 
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
Comment 2 Miloslav Metelka 2011-10-31 12:25:24 UTC
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.
Comment 3 David Strupl 2011-11-25 09:45:39 UTC
Closing old (and presumably obsolete) tasks assigned to me. If something is still needed please reopen...
Comment 4 David Strupl 2012-01-27 08:40:12 UTC
I guess this is still opened. Also I have assigned it to Mila.
Comment 5 Petr Jiricka 2012-05-15 15:42:46 UTC
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.
Comment 6 Marek Fukala 2012-05-15 18:37:20 UTC
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.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo