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.
The method would be useful when checking for presence of certain pattern text on the input. For example checking for "abcde" currently needs to be written as int c; if ((c = input.read()) == 'a' && (c = input.read()) == 'b' && (c = input.read()) == 'c' && (c = input.read()) == 'd' && (c = input.read()) == 'e') { // Possibly check the next character whether it's delimiter etc. } else { // Check what was the c character that did not match // Whether it was delimiter or e.g. alphanumeric letter } With the match() method and a special constant MATCH this could be rewritten as int c; if ((c = input.match("abcde")) == LexerInput.MATCH) { // Possibly check the next character whether it's delimiter etc. } else { // Check what was the c character that did not match // Whether it was delimiter or e.g. alphanumeric letter }
Created attachment 35772 [details] Proposed methods (tests and apichanges not included)
Shouldn't these types of methods be in the Lexer, and not in the LexerInput? A table-based lexer would never use these methods. Maybe there should be another (abstract?) class that contains methods that are useful only for hand-written lexers?