public final class CodeReaderListener
extends com.github.fge.grappa.run.ParseRunnerListener<com.sonar.sslr.api.Token.Builder>
CodeReader and Lexer
This listener will handle both the consumption of characters from the code reader, and adding tokens to the lexer.
For this, it captures the root matcher obtained from the initial context
(see beforeParse(PreParseEvent)) and waits for this matcher to
reappear at level 0. When it reappears, it means the parsing is done, whether
successful or not.
After the parsing is done, the consumed characters are popped from the reader and the recorded tokens are added
to the lexer.
Channel.consume(CodeReader, Object),
ListeningParseRunner,
SonarParserBase| Constructor and Description |
|---|
CodeReaderListener(org.sonar.sslr.channel.CodeReader reader,
com.sonar.sslr.impl.Lexer lexer) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterParse(com.github.fge.grappa.run.events.PostParseEvent<com.sonar.sslr.api.Token.Builder> event) |
void |
beforeParse(com.github.fge.grappa.run.events.PreParseEvent<com.sonar.sslr.api.Token.Builder> event) |
void |
matchFailure(com.github.fge.grappa.run.events.MatchFailureEvent<com.sonar.sslr.api.Token.Builder> event) |
void |
matchSuccess(com.github.fge.grappa.run.events.MatchSuccessEvent<com.sonar.sslr.api.Token.Builder> event) |
public CodeReaderListener(org.sonar.sslr.channel.CodeReader reader,
com.sonar.sslr.impl.Lexer lexer)
public void beforeParse(com.github.fge.grappa.run.events.PreParseEvent<com.sonar.sslr.api.Token.Builder> event)
beforeParse in class com.github.fge.grappa.run.ParseRunnerListener<com.sonar.sslr.api.Token.Builder>public void matchSuccess(com.github.fge.grappa.run.events.MatchSuccessEvent<com.sonar.sslr.api.Token.Builder> event)
matchSuccess in class com.github.fge.grappa.run.ParseRunnerListener<com.sonar.sslr.api.Token.Builder>public void matchFailure(com.github.fge.grappa.run.events.MatchFailureEvent<com.sonar.sslr.api.Token.Builder> event)
matchFailure in class com.github.fge.grappa.run.ParseRunnerListener<com.sonar.sslr.api.Token.Builder>public void afterParse(com.github.fge.grappa.run.events.PostParseEvent<com.sonar.sslr.api.Token.Builder> event)
afterParse in class com.github.fge.grappa.run.ParseRunnerListener<com.sonar.sslr.api.Token.Builder>