コード例 #1
0
    @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);
    }
コード例 #2
0
 @Override
 public void flush() throws IOException {
   super.flush();
 }
コード例 #3
0
 @Override
 public void writeSemantic(EObject grammarElement, String value) throws IOException {
   previous = grammarElement;
   super.writeSemantic(grammarElement, value);
 }