Bug 87118 - Create LexerRestartInfo final class
Create LexerRestartInfo final class
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Lexer
6.x
All All
: P2 (vote)
: 6.x
Assigned To: issues@editor
issues@editor
: API, API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-13 16:02 UTC by Miloslav Metelka
Modified: 2006-10-24 10:16 UTC (History)
1 user (show)

See Also:
Issue Type: TASK
:


Attachments
Patch for lexer (existing lexers will be patched before commit) (36.79 KB, patch)
2006-10-18 17:42 UTC, Miloslav Metelka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miloslav Metelka 2006-10-13 16:02:14 UTC
I would like to do $subj in the lexer SPI that would encapsulate the present
parameters passed to LanguageHierarchy.createLexer():

    protected abstract Lexer<T> createLexer(LexerInput input,
    TokenFactory<T> tokenFactory, Object state,
    LanguagePath languagePath, InputAttributes inputAttributes);

would become

    protected abstract Lexer<T> createLexer(LexerRestartInfo info);

and the class would encapsulate the arguments passed currently.

Justification: with additional requirements there may be additional information
needed for lexer restarting. For example the issue #87014 will require an extra
parameter. By encapsulating the parameters into a final class we can evolve the
API in a compatible way in the future.

We could also consider adding of LexerRestartState.getAttributeValue(Object
attributeKey) that would

return (inputAttributes != null) ? inputAttributes.getValue(languagePath,
attributeKey) : null;

It's slightly annoying to write that for each possible attribute (see e.g.
StateLexer in the lexer tests).
Comment 1 Miloslav Metelka 2006-10-18 10:00:28 UTC
Adding apireviews to cc since this change will affect the lexer API.
Comment 2 Jesse Glick 2006-10-18 15:21:48 UTC
I guess this would be

  protected abstract Lexer<T> createLexer(LexerRestartInfo<T> info);
                                                          ^^^


Do you have a proposed patch yet?
Comment 3 Miloslav Metelka 2006-10-18 17:41:44 UTC
Yes, I forgot to mention the generification. Attaching the patch.
Comment 4 Miloslav Metelka 2006-10-18 17:42:45 UTC
Created attachment 35340 [details]
Patch for lexer (existing lexers will be patched before commit)
Comment 5 Miloslav Metelka 2006-10-23 20:27:29 UTC
Fixed in trunk:
Checking in java/lexer/src/org/netbeans/api/java/lexer/JavadocTokenId.java;
/cvs/java/lexer/src/org/netbeans/api/java/lexer/JavadocTokenId.java,v  <-- 
JavadocTokenId.java
new revision: 1.4; previous revision: 1.3
done
Checking in java/lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java;
/cvs/java/lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java,v  <-- 
JavaTokenId.java
new revision: 1.4; previous revision: 1.3
done
Checking in java/lexer/src/org/netbeans/api/java/lexer/JavaStringTokenId.java;
/cvs/java/lexer/src/org/netbeans/api/java/lexer/JavaStringTokenId.java,v  <-- 
JavaStringTokenId.java
new revision: 1.4; previous revision: 1.3
done
Checking in
lexer/nbbridge/test/unit/src/org/netbeans/modules/lexer/nbbridge/test/simple/SimpleCharLexer.java;
/cvs/lexer/nbbridge/test/unit/src/org/netbeans/modules/lexer/nbbridge/test/simple/SimpleCharLexer.java,v
 <--  SimpleCharLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in
lexer/nbbridge/test/unit/src/org/netbeans/modules/lexer/nbbridge/test/simple/SimpleCharTokenId.java;
/cvs/lexer/nbbridge/test/unit/src/org/netbeans/modules/lexer/nbbridge/test/simple/SimpleCharTokenId.java,v
 <--  SimpleCharTokenId.java
new revision: 1.4; previous revision: 1.3
done
Checking in
lexer/nbbridge/test/unit/src/org/netbeans/modules/lexer/nbbridge/test/simple/SimplePlainLexer.java;
/cvs/lexer/nbbridge/test/unit/src/org/netbeans/modules/lexer/nbbridge/test/simple/SimplePlainLexer.java,v
 <--  SimplePlainLexer.java
new revision: 1.3; previous revision: 1.2
done
RCS file: /cvs/lexer/src/org/netbeans/spi/lexer/LexerRestartInfo.java,v
done
Checking in lexer/src/org/netbeans/spi/lexer/LexerRestartInfo.java;
/cvs/lexer/src/org/netbeans/spi/lexer/LexerRestartInfo.java,v  <-- 
LexerRestartInfo.java
initial revision: 1.1
done
Checking in lexer/src/org/netbeans/spi/lexer/LanguageHierarchy.java;
/cvs/lexer/src/org/netbeans/spi/lexer/LanguageHierarchy.java,v  <-- 
LanguageHierarchy.java
new revision: 1.5; previous revision: 1.4
done
Checking in
lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleJavadocLexer.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleJavadocLexer.java,v
 <--  SimpleJavadocLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/GenLanguage.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/GenLanguage.java,v 
<--  GenLanguage.java
new revision: 1.3; previous revision: 1.2
done
Checking in
lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleCharLexer.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleCharLexer.java,v
 <--  SimpleCharLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in
lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleLanguageProvider.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleLanguageProvider.java,v
 <--  SimpleLanguageProvider.java
new revision: 1.6; previous revision: 1.5
done
Checking in
lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimplePlainLexer.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimplePlainLexer.java,v
 <--  SimplePlainLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleLexer.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleLexer.java,v 
<--  SimpleLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in
lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleJavadocTokenId.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleJavadocTokenId.java,v
 <--  SimpleJavadocTokenId.java
new revision: 1.4; previous revision: 1.3
done
Checking in
lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleStringLexer.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/simple/SimpleStringLexer.java,v
 <--  SimpleStringLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in html/lexer/src/org/netbeans/api/html/lexer/HTMLTokenId.java;
/cvs/html/lexer/src/org/netbeans/api/html/lexer/HTMLTokenId.java,v  <-- 
HTMLTokenId.java
new revision: 1.4; previous revision: 1.3
done
Checking in lexer/src/org/netbeans/lib/lexer/LexerSpiPackageAccessor.java;
/cvs/lexer/src/org/netbeans/lib/lexer/LexerSpiPackageAccessor.java,v  <-- 
LexerSpiPackageAccessor.java
new revision: 1.4; previous revision: 1.3
done
Checking in lexer/src/org/netbeans/lib/lexer/LexerInputOperation.java;
/cvs/lexer/src/org/netbeans/lib/lexer/LexerInputOperation.java,v  <-- 
LexerInputOperation.java
new revision: 1.3; previous revision: 1.2
done
Checking in web/jspsyntax/lexer/src/org/netbeans/api/jsp/lexer/JspTokenId.java;
/cvs/web/jspsyntax/lexer/src/org/netbeans/api/jsp/lexer/JspTokenId.java,v  <-- 
JspTokenId.java
new revision: 1.3; previous revision: 1.2
done
Checking in lexer/test/unit/src/org/netbeans/api/lexer/LanguagePathTest.java;
/cvs/lexer/test/unit/src/org/netbeans/api/lexer/LanguagePathTest.java,v  <-- 
LanguagePathTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in xml/lexer/src/org/netbeans/api/xml/lexer/XMLTokenId.java;
/cvs/xml/lexer/src/org/netbeans/api/xml/lexer/XMLTokenId.java,v  <-- 
XMLTokenId.java
new revision: 1.3; previous revision: 1.2
done
Checking in html/lexer/src/org/netbeans/lib/html/lexer/HTMLLexer.java;
/cvs/html/lexer/src/org/netbeans/lib/html/lexer/HTMLLexer.java,v  <-- 
HTMLLexer.java
new revision: 1.2; previous revision: 1.1
done
Checking in java/lexer/src/org/netbeans/lib/java/lexer/JavadocLexer.java;
/cvs/java/lexer/src/org/netbeans/lib/java/lexer/JavadocLexer.java,v  <-- 
JavadocLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in java/lexer/src/org/netbeans/lib/java/lexer/JavaStringLexer.java;
/cvs/java/lexer/src/org/netbeans/lib/java/lexer/JavaStringLexer.java,v  <-- 
JavaStringLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in java/lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java;
/cvs/java/lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java,v  <-- 
JavaLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in lexer/test/unit/src/org/netbeans/lib/lexer/test/state/StateLexer.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/state/StateLexer.java,v 
<--  StateLexer.java
new revision: 1.3; previous revision: 1.2
done
Checking in lexer/test/unit/src/org/netbeans/lib/lexer/test/state/StateTokenId.java;
/cvs/lexer/test/unit/src/org/netbeans/lib/lexer/test/state/StateTokenId.java,v 
<--  StateTokenId.java
new revision: 1.2; previous revision: 1.1
done
Checking in web/jspsyntax/lexer/src/org/netbeans/lib/jsp/lexer/JspLexer.java;
/cvs/web/jspsyntax/lexer/src/org/netbeans/lib/jsp/lexer/JspLexer.java,v  <-- 
JspLexer.java
new revision: 1.2; previous revision: 1.1
done
Checking in xml/lexer/src/org/netbeans/lib/xml/lexer/XMLLexer.java;
/cvs/xml/lexer/src/org/netbeans/lib/xml/lexer/XMLLexer.java,v  <--  XMLLexer.java
new revision: 1.2; previous revision: 1.1


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