Package com.sonar.sslr.impl.channel
Class BlackHoleChannel
- java.lang.Object
-
- org.sonar.sslr.channel.Channel<Lexer>
-
- com.sonar.sslr.impl.channel.BlackHoleChannel
-
public class BlackHoleChannel extends Channel<Lexer>
Allows to skip characters, which match given regular expression.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 Summary
Constructors Constructor Description BlackHoleChannel(String regexp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
consume(CodeReader code, Lexer lexer)
Tries to consume the character stream at the current reading cursor position (provided by theCodeReader
).
-
-
-
Constructor Detail
-
BlackHoleChannel
public BlackHoleChannel(String regexp)
- Throws:
PatternSyntaxException
- if the expression's syntax is invalid
-
-
Method Detail
-
consume
public boolean consume(CodeReader code, Lexer lexer)
Description copied from class:Channel
Tries to consume the character stream at the current reading cursor position (provided by theCodeReader
). If the character stream is consumed the method must return true and the OUTPUT object can be fed.
-
-