Package org.sonar.sslr.channel
Class RegexChannel<O>
java.lang.Object
org.sonar.sslr.channel.Channel<O>
org.sonar.sslr.channel.RegexChannel<O>
The RegexChannel can be used to be called each time the next characters in the character stream match a regular expression
-
Constructor Summary
ConstructorsConstructorDescriptionRegexChannel(String regex) Create a RegexChannel object with the required regular expression -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidconsume(CharSequence token, O output) The consume method is called each time the regular expression used to create the RegexChannel object matches the next characters in the character streams.final booleanconsume(CodeReader code, O output) Tries to consume the character stream at the current reading cursor position (provided by theCodeReader).
-
Constructor Details
-
RegexChannel
Create a RegexChannel object with the required regular expression- Parameters:
regex- regular expression to be used to try matching the next characters in the stream
-
-
Method Details
-
consume
Description copied from class:ChannelTries 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. -
consume
The consume method is called each time the regular expression used to create the RegexChannel object matches the next characters in the character streams.- Parameters:
token- the token consumed in the character stream and matching the regular expressionoutput- the OUTPUT object which can be optionally fed
-