@Override public void writeHidden(EObject grammarElement, String value) throws IOException { String newValue = value; if (grammarElement instanceof TerminalRule) { if ("SL_COMMENT".equals(((TerminalRule) grammarElement).getName())) { if (previous instanceof Keyword) { if ("{".toString().equals(((Keyword) previous).getValue())) { newValue = getIndentString() + value; } } } if ("ML_COMMENT".equals(((TerminalRule) grammarElement).getName())) { StringBuilder sb = new StringBuilder(); sb.append(getLineSeparator()); sb.append(getLineSeparator()); for (int i = 0; i < indentationLevel; i++) { sb.append(getIndentString()); } if (previous instanceof Keyword) { if ("{".toString().equals(((Keyword) previous).getValue())) { sb.append(getIndentString()); } } sb.append(value).append(getLineSeparator()); newValue = sb.toString(); } } super.writeHidden(grammarElement, newValue); }
@Override public void flush() throws IOException { super.flush(); }
@Override public void writeSemantic(EObject grammarElement, String value) throws IOException { previous = grammarElement; super.writeSemantic(grammarElement, value); }