@SuppressWarnings("deprecation") protected FormattingConfig createFormattingConfig() { FormattingConfig cfg = new FormattingConfig2(grammarAccess, hiddenTokenHelper, getIndentInfo(), getLineSeparatorInfo()); cfg.setWhitespaceRule(getWSRule()); return cfg; }
@Override public ITokenStream createFormatterStream(String indent, ITokenStream out, boolean preserveWhitespaces) { return new FormattingConfigBasedStream(out, indent, getConfig(), createMatcher(), hiddenTokenHelper, preserveWhitespaces); }
private void setIndentationInclusive(FormattingConfig c, EObject element) { c.setIndentationIncrement().before(element); c.setIndentationDecrement().after(element); }
public void configureXCasePart(FormattingConfig c, XCasePartElements ele) { c.setNoSpace().before(ele.getColonKeyword_3_0_0()); c.setNoSpace().before(ele.getFallThroughCommaKeyword_3_1_0()); c.setIndentationIncrement().before(ele.getThenAssignment_3_0_1()); c.setLinewrap().around(ele.getThenAssignment_3_0_1()); c.setIndentationDecrement().after(ele.getThenAssignment_3_0_1()); }
public void configureXSwitchExpression(FormattingConfig c, XSwitchExpressionElements ele) { c.setNoSpace().around(ele.getColonKeyword_2_1_0_0_1()); c.setNoSpace().around(ele.getColonKeyword_2_0_0_0_2()); c.setNoLinewrap().before(ele.getLeftCurlyBracketKeyword_3()); c.setLinewrap().after(ele.getLeftCurlyBracketKeyword_3()); c.setIndentationIncrement().after(ele.getLeftCurlyBracketKeyword_3()); c.setNoSpace().before(ele.getColonKeyword_5_1()); c.setIndentationIncrement().before(ele.getDefaultAssignment_5_2()); c.setLinewrap().around(ele.getDefaultAssignment_5_2()); c.setIndentationDecrement().after(ele.getDefaultAssignment_5_2()); c.setLinewrap().before(ele.getRightCurlyBracketKeyword_6()); c.setIndentationDecrement().before(ele.getRightCurlyBracketKeyword_6()); }
public void configureXBlockExpression(FormattingConfig c, XBlockExpressionElements ele) { c.setLinewrap().after(ele.getLeftCurlyBracketKeyword_1()); c.setIndentationIncrement().after(ele.getLeftCurlyBracketKeyword_1()); c.setLinewrap().after(ele.getExpressionsAssignment_2_0()); c.setNoSpace().before(ele.getSemicolonKeyword_2_1()); c.setLinewrap().after(ele.getSemicolonKeyword_2_1()); c.setLinewrap().before(ele.getRightCurlyBracketKeyword_3()); c.setIndentationDecrement().before(ele.getRightCurlyBracketKeyword_3()); }
@Override public void accept(final Pair<Keyword, Keyword> it) { FormattingConfig.SpaceLocator _setSpace = c.setSpace(" "); Keyword _first = it.getFirst(); _setSpace.before(_first); FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace(); Keyword _first_1 = it.getFirst(); _setNoSpace.after(_first_1); FormattingConfig.NoSpaceLocator _setNoSpace_1 = c.setNoSpace(); Keyword _second = it.getSecond(); _setNoSpace_1.before(_second); } };
public void configureXTryCatchFinallyExpression(FormattingConfig c, XTryCatchFinallyExpressionElements ele) { c.setIndentationIncrement().before(ele.getExpressionAssignment_2()); c.setLinewrap().around(ele.getExpressionAssignment_2()); c.setIndentationDecrement().after(ele.getExpressionAssignment_2()); c.setIndentationIncrement().before(ele.getFinallyExpressionAssignment_3_0_1_1()); c.setLinewrap().around(ele.getFinallyExpressionAssignment_3_0_1_1()); c.setIndentationDecrement().after(ele.getFinallyExpressionAssignment_3_0_1_1()); c.setIndentationIncrement().before(ele.getFinallyExpressionAssignment_3_1_1()); c.setLinewrap().around(ele.getFinallyExpressionAssignment_3_1_1()); c.setIndentationDecrement().after(ele.getFinallyExpressionAssignment_3_1_1()); }
protected void installBetween(IBetweenElements pattern, AbstractElement loopCenter) { Set<MatcherState> states = getAllStates(loopCenter); for (MatcherState state : states) { state.getBeforeBetweenElements().add(pattern); state.getAfterBetweenElements().add(pattern); for (MatcherTransition transition : state.getAllOutgoing()) if (transition.getLoopCenter() == loopCenter && states.contains(transition.getTarget())) transition.addPattern(pattern); } }
protected boolean isBreak() { if (!isBreakable()) return false; for (ElementLocator e : leadingLocators) { if (e instanceof LinewrapLocator) { if (((LinewrapLocator) e).getMinWrap() > 0) return true; if (countExistingLeadingNewlines() > 0) return true; } } return false; }
public void setIndentation(AbstractElement beginElement, AbstractElement endElement) { new IndentationLocatorStart(beginElement); new IndentationLocatorEnd(endElement); }
/** * @since 2.3 */ public ITokenStream createFormatterStream(EObject context, String initalIndentation, ITokenStream outputStream, boolean preserveWhitespaces) { return createFormatterStream(initalIndentation, outputStream, preserveWhitespaces); } }
@Override public void writeSemantic(EObject grammarElement, String value) throws IOException { addLineEntry(grammarElement, value, false); } }
public void configureXForLoopExpression(FormattingConfig c, XForLoopExpressionElements ele) { c.setNoSpace().around(ele.getLeftParenthesisKeyword_0_0_2()); c.setNoSpace().around(ele.getColonKeyword_0_0_4()); c.setNoSpace().around(ele.getRightParenthesisKeyword_2()); c.setIndentationIncrement().before(ele.getEachExpressionAssignment_3()); c.setLinewrap().around(ele.getEachExpressionAssignment_3()); c.setIndentationDecrement().after(ele.getEachExpressionAssignment_3()); }
public void configureXDoWhileExpression(FormattingConfig c, XDoWhileExpressionElements ele) { c.setLinewrap().after(ele.getDoKeyword_1()); c.setIndentationIncrement().after(ele.getDoKeyword_1()); c.setLinewrap().before(ele.getDoKeyword_1()); c.setIndentationDecrement().before(ele.getWhileKeyword_3()); c.setNoSpace().around(ele.getLeftParenthesisKeyword_4()); c.setNoSpace().before(ele.getRightParenthesisKeyword_6()); }
public void configureXSynchronizedExpression(FormattingConfig c, XSynchronizedExpressionElements ele) { c.setNoSpace().around(ele.getLeftParenthesisKeyword_0_0_2()); c.setNoSpace().before(ele.getRightParenthesisKeyword_2()); c.setLinewrap().around(ele.getExpressionAssignment_3()); c.setIndentationIncrement().before(ele.getExpressionAssignment_3()); c.setIndentationDecrement().after(ele.getExpressionAssignment_3()); }
public void configureXBasicForLoopExpression(FormattingConfig c, XBasicForLoopExpressionElements ele) { c.setNoSpace().around(ele.getLeftParenthesisKeyword_2()); c.setNoSpace().before(ele.getCommaKeyword_3_1_0()); c.setNoSpace().before(ele.getSemicolonKeyword_4()); c.setNoSpace().before(ele.getCommaKeyword_7_1_0()); c.setNoSpace().before(ele.getSemicolonKeyword_6()); c.setNoSpace().around(ele.getRightParenthesisKeyword_8()); c.setIndentationIncrement().before(ele.getEachExpressionAssignment_9()); c.setLinewrap().around(ele.getEachExpressionAssignment_9()); c.setIndentationDecrement().after(ele.getEachExpressionAssignment_9()); }
public void configureXWhileExpression(FormattingConfig c, XWhileExpressionElements ele) { c.setNoSpace().around(ele.getLeftParenthesisKeyword_2()); c.setNoSpace().before(ele.getRightParenthesisKeyword_4()); c.setIndentationIncrement().before(ele.getBodyAssignment_5()); c.setLinewrap().around(ele.getBodyAssignment_5()); c.setIndentationDecrement().after(ele.getBodyAssignment_5()); }
public void configureXCatchClause(FormattingConfig c, XCatchClauseElements ele) { c.setNoSpace().around(ele.getLeftParenthesisKeyword_1()); c.setNoSpace().before(ele.getRightParenthesisKeyword_3()); c.setIndentationIncrement().before(ele.getExpressionAssignment_4()); c.setLinewrap().around(ele.getExpressionAssignment_4()); c.setIndentationDecrement().after(ele.getExpressionAssignment_4()); }
public void configureXIfExpression(FormattingConfig c, XIfExpressionElements ele) { c.setNoSpace().around(ele.getLeftParenthesisKeyword_2()); c.setNoSpace().before(ele.getRightParenthesisKeyword_4()); c.setLinewrap().around(ele.getThenAssignment_5()); c.setIndentationIncrement().before(ele.getThenAssignment_5()); c.setIndentationDecrement().after(ele.getThenAssignment_5()); c.setLinewrap().around(ele.getElseAssignment_6_1()); c.setIndentationIncrement().before(ele.getElseAssignment_6_1()); c.setIndentationDecrement().after(ele.getElseAssignment_6_1()); }