@Override public void finish(Optional<Combinator> prev, VizOutput out) throws IOException { boolean prevIsInString = prev.isPresent() && caseSensitivityOf(prev.get()).isPresent(); if (prevIsInString) { out.text("\u201D"); } }
@Override public void visualizeOperator(Optional<Combinator> prev, Combinator next, VizOutput out) throws IOException { boolean prevIsInString = prev.isPresent() && caseSensitivityOf(prev.get()).isPresent(); boolean nextIsInString = caseSensitivityOf(next).isPresent(); if (prevIsInString) { if (nextIsInString) { // Do nothing } else { out.text("\u201D "); // Close a string } } else if (nextIsInString) { out.text(prev.isPresent() ? " \u201C" : "\u201C"); // Open a string. } else if (prev.isPresent()) { out.text(" "); } }