private static final Transition transition(final State from, final State to, final MdPattern pattern, final TransitionAction action) { return new Transition(from, to, pattern, action); }
/** * Step the state machine * * @param line * the text fragment on which the state machine decides the next * state and action */ public void step(final String line) { for (final Transition entry : this.transitions) { if ((this.state == entry.getFrom()) && matchToken(line, entry)) { LOG.finest(() -> entry + " : '" + line + "'"); entry.getTransition().transit(); this.state = entry.getTo(); break; } } }
private boolean matchToken(final String line, final Transition entry) { boolean matches = false; final Matcher matcher = entry.getMarkdownPattern().getPattern().matcher(line); if (matcher.matches()) { this.lastToken = (matcher.groupCount() == 0) ? "" : matcher.group(1); matches = true; } return matches; }
/** * Step the state machine * * @param line * the text fragment on which the state machine decides the next * state and action */ public void step(final String line) { for (final Transition entry : this.transitions) { if ((this.state == entry.getFrom()) && matchToken(line, entry)) { LOG.finest(() -> entry + " : '" + line + "'"); entry.getTransition().transit(); this.state = entry.getTo(); break; } } }
private boolean matchToken(final String line, final Transition entry) { boolean matches = false; final Matcher matcher = entry.getMarkdownPattern().getPattern().matcher(line); if (matcher.matches()) { this.lastToken = (matcher.groupCount() == 0) ? "" : matcher.group(1); matches = true; } return matches; }
private static final Transition transition(final State from, final State to, final MdPattern pattern, final TransitionAction action) { return new Transition(from, to, pattern, action); }