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.

Bug 196967 - A small fix in JsLexer.getTokenId
Summary: A small fix in JsLexer.getTokenId
Status: RESOLVED WONTFIX
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: PC All
: P4 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-22 15:09 UTC by emi
Modified: 2012-09-07 22:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch which fixes the issue (1.35 KB, patch)
2011-03-22 15:09 UTC, emi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2011-03-22 15:09:38 UTC
Created attachment 107183 [details]
Patch which fixes the issue

There is a special case in getTokenId() that looks like this:

case 65535: // SIGN ERRORS! Why does this happen?

The way I see it the problem seems to be this line in nextToken():

token = tokenStream.getToken() & Parser.CLEAR_TI_MASK;

where if tokenStream.getToken() returns org.mozilla.nb.javascript.Token.ERROR which is actually -1 (the only negative token id), in two-s complement it has all the bits on 1. So -1 & Parser.CLEAR_TI_MASK (which is 0xFFFF) gives unsurprisingly the 65535 value.

PS: The good thing is that the 'case 65535' is treated as JsTokenId.ERROR anyhow, as it should.
Comment 1 Petr Hejl 2012-09-07 22:19:22 UTC
For 7.3 we have completely different lexer and parser.