This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 122713 [details] Path for lexer module - http://hg.netbeans.org/main at revision 227659 Hi, LexerInput.readText(start, end) returns always a CharSequence starting at position 0. The returned LexerInput.ReadText does not use start index as offset in its charAt(index) method. Regards Florian
It should work as described in the javadoc. Let's say that during a recogntion of a current token lexerInput.read() is invoked 6 times reading chars "abcdef". If you now call lexerInput.readText(2, 5) the returned CharSequence (let's name it txt) should contain text "cde" i.e. txt.length() == 3 and txt.charAt(0) == 'c' till txt.charAt(2) == 'e'. Once a token is returned by TokenFactory.createToken() the lexerInput.readText() is no longer able to reference characters "abcdef" (if they all were part of just returned token). If it does not work in this way please reopen the issue.
Hi, did you check my attachment (fix + unit test)? The following code did not work. @Override public Token<TokenIdImpl> nextToken() { ... String text = String.valueOf(input.readText()); // text="abcdefg" String subText = text.substring(2, 4); // subText ="cd" CharSequence readText = input.readText(2, 4); // readText="ab" (length=2, ok) subText.contentEquals(readText); // -> false !!! Should be true? ... } The var readText should be "cd" (but was "ab")? Take a look at LexerInput.ReadText class. There is an unused var containing the start index. If I am wrong please close again. Regards Florian
I see, I'm sorry. Thank you for the patch. http://hg.netbeans.org/jet-main/rev/69dc8e287dbf
Integrated into 'main-golden', will be available in build *201209200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/69dc8e287dbf User: Miloslav Metelka <mmetelka@netbeans.org> Log: #216362 - LexerInput.readText(start, end) does not respect start index.