public class BlackHoleChannel extends Channel<Lexer>
Mostly this channel is used with regular expression "\s++" to remove all whitespace characters. And in such case this channel should be the first one in a sequence of channels for performance reasons, because generally whitespace characters are encountered more often than all other and especially between others.
Constructor and Description |
---|
BlackHoleChannel(String regexp) |
Modifier and Type | Method and Description |
---|---|
boolean |
consume(CodeReader code,
Lexer lexer)
Tries to consume the character stream at the current reading cursor position (provided by the
CodeReader ). |
public BlackHoleChannel(String regexp)
PatternSyntaxException
- if the expression's syntax is invalidpublic boolean consume(CodeReader code, Lexer lexer)
Channel
CodeReader
). If
the character stream is consumed the method must return true and the OUTPUT object can be fed.Copyright © 2009–2017 SonarSource. All rights reserved.