Java Examples for org.eclipse.xtext.formatting.impl.FormattingConfig
The following java examples will help you to understand the usage of org.eclipse.xtext.formatting.impl.FormattingConfig. These source code samples are taken from different open source projects.
Example 1
| Project: amalgamation-examples-master File: DroidFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 2
| Project: applause-master File: ApplauseDslFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 3
| Project: ArchStudio5-master File: PrologFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 4
| Project: bpel-master File: MyDslFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 5
| Project: CertWare-master File: SacmDslFormatter.java View source code |
@Override protected void configureFormatting(final FormattingConfig c) { List<Pair<Keyword, Keyword>> _findKeywordPairs = this._sacmDslGrammarAccess.findKeywordPairs("{", "}"); for (final Pair<Keyword, Keyword> pair : _findKeywordPairs) { { Keyword _first = pair.getFirst(); Keyword _second = pair.getSecond(); c.setIndentation(_first, _second); FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(1); Keyword _first_1 = pair.getFirst(); _setLinewrap.after(_first_1); FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(1); Keyword _second_1 = pair.getSecond(); _setLinewrap_1.before(_second_1); FormattingConfig.LinewrapLocator _setLinewrap_2 = c.setLinewrap(1); Keyword _second_2 = pair.getSecond(); _setLinewrap_2.after(_second_2); } } List<Keyword> _findKeywords = this._sacmDslGrammarAccess.findKeywords(","); for (final Keyword comma : _findKeywords) { { FormattingConfig.NoLinewrapLocator _setNoLinewrap = c.setNoLinewrap(); _setNoLinewrap.before(comma); FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace(); _setNoSpace.before(comma); FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(); _setLinewrap.after(comma); } } FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(0, 1, 2); TerminalRule _sL_COMMENTRule = this._sacmDslGrammarAccess.getSL_COMMENTRule(); _setLinewrap.before(_sL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(0, 1, 2); TerminalRule _mL_COMMENTRule = this._sacmDslGrammarAccess.getML_COMMENTRule(); _setLinewrap_1.before(_mL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_2 = c.setLinewrap(0, 1, 1); TerminalRule _mL_COMMENTRule_1 = this._sacmDslGrammarAccess.getML_COMMENTRule(); _setLinewrap_2.after(_mL_COMMENTRule_1); }
Example 6
| Project: devicemodel-master File: DeviceModelingLanguageFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 7
| Project: e-fx-clipse-master File: FXGraphFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
FXGraphGrammarAccess f = (FXGraphGrammarAccess) getGrammarAccess();
for (Keyword comma : f.findKeywords("(")) {
c.setNoSpace().around(comma);
}
for (Keyword comma : f.findKeywords(")")) {
c.setNoSpace().before(comma);
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoSpace().before(comma);
}
for (Keyword hash : f.findKeywords("#")) {
c.setNoSpace().around(hash);
}
c.setAutoLinewrap(120);
c.setLinewrap(1, 2, 3).around(f.getImportRule());
c.setLinewrap(1, 2, 3).before(f.getPropertyRule());
c.setLinewrap(1, 2, 3).before(f.getStaticCallValuePropertyRule());
c.setLinewrap(1, 2, 3).after(f.getElementAccess().getLeftCurlyBracketKeyword_1_1_1());
c.setLinewrap(1, 2, 3).after(f.getElementAccess().getLeftCurlyBracketKeyword_1_2_3());
c.setLinewrap(1, 2, 3).before(f.getElementAccess().getRightCurlyBracketKeyword_1_1_3());
c.setLinewrap(1, 2, 3).before(f.getElementAccess().getRightCurlyBracketKeyword_1_2_6());
c.setLinewrap(1, 2, 3).after(f.getElementAccess().getCommaKeyword_1_2_5_0());
c.setLinewrap(1, 2, 3).after(f.getListValuePropertyAccess().getLeftSquareBracketKeyword_0());
c.setLinewrap(1, 2, 3).after(f.getListValuePropertyAccess().getCommaKeyword_2_0());
c.setLinewrap(1, 2, 3).before(f.getListValuePropertyAccess().getRightSquareBracketKeyword_3());
c.setLinewrap(1, 2, 3).after(f.getComponentDefinitionAccess().getLeftCurlyBracketKeyword_3());
c.setLinewrap(1, 2, 3).before(f.getComponentDefinitionAccess().getRightCurlyBracketKeyword_7());
c.setLinewrap(1, 2, 3).after(f.getMapValuePropertyAccess().getLeftCurlyBracketKeyword_0());
c.setLinewrap(1, 2, 3).before(f.getMapValuePropertyAccess().getRightCurlyBracketKeyword_3());
{
List<Pair<Keyword, Keyword>> pairs = f.findKeywordPairs("{", "}");
for (Pair<Keyword, Keyword> pair : pairs) {
c.setIndentation(pair.getFirst(), pair.getSecond());
}
}
{
List<Pair<Keyword, Keyword>> pairs = f.findKeywordPairs("[", "]");
for (Pair<Keyword, Keyword> pair : pairs) {
c.setIndentation(pair.getFirst(), pair.getSecond());
}
}
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 8
| Project: eclipse-redline-plugin-master File: SmalltalkFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 9
| Project: emfdatabinding-tutorial-master File: JFXCssFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 10
| Project: fstoolkit-master File: OfficeDLFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
org.panlab.officedl.services.OfficeDLGrammarAccess f = (org.panlab.officedl.services.OfficeDLGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
}Example 11
| Project: mecha-master File: NetModelFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
NetModelGrammarAccess g = (NetModelGrammarAccess) getGrammarAccess();
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
c.setLinewrap(0, 1, 2).before(g.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(g.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(g.getML_COMMENTRule());
c.setLinewrap(2).after(g.getModelAccess().getPackageNameAssignment_1());
//
// Complex type literals
//
c.setLinewrap().after(g.getComplexTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setLinewrap().after(g.getComplexTypeLiteralAccess().getCommaKeyword_2_0());
c.setLinewrap().before(g.getComplexTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setLinewrap(2).after(g.getComplexTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setIndentationIncrement().after(g.getComplexTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setIndentationDecrement().before(g.getComplexTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setNoSpace().before(g.getComplexTypeLiteralAccess().getCommaKeyword_2_0());
//
// Enums
//
c.setLinewrap().after(g.getEnumTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setLinewrap().after(g.getEnumTypeLiteralAccess().getCommaKeyword_2_0());
c.setLinewrap().before(g.getEnumTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setLinewrap(2).after(g.getEnumTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setIndentationIncrement().after(g.getEnumTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setIndentationDecrement().before(g.getEnumTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setNoSpace().before(g.getEnumTypeLiteralAccess().getCommaKeyword_2_0());
//
// Clients
//
c.setLinewrap().after(g.getClientAccess().getLeftCurlyBracketKeyword_3());
c.setLinewrap().before(g.getClientAccess().getRightCurlyBracketKeyword_5());
c.setLinewrap(2).after(g.getClientAccess().getRightCurlyBracketKeyword_5());
c.setIndentationIncrement().after(g.getClientAccess().getLeftCurlyBracketKeyword_3());
c.setIndentationDecrement().before(g.getClientAccess().getRightCurlyBracketKeyword_5());
// Methods
c.setLinewrap().around(g.getHttpMethodRule());
c.setLinewrap().around(g.getHttpMethodBlockRule());
c.setIndentationIncrement().after(g.getHttpMethodAccess().getLeftCurlyBracketKeyword_3());
c.setIndentationDecrement().before(g.getHttpMethodAccess().getRightCurlyBracketKeyword_5());
c.setLinewrap(1).after(g.getHttpMethodAccess().getRightCurlyBracketKeyword_5());
c.setNoLinewrap().after(g.getHttpMethodAccess().getTypeHttpMethodTypeEnumRuleCall_0_0());
//
// Paths
//
c.setNoSpace().after(g.getPathAccess().getSolidusKeyword_1());
c.setNoSpace().before(g.getPathAccess().getSolidusKeyword_3_0());
c.setNoSpace().after(g.getPathAccess().getSolidusKeyword_3_0());
c.setNoLinewrap().around(g.getPathRule());
//
// Headers
//
c.setLinewrap().after(g.getHeaderBlockAccess().getHeadersKeyword_0());
c.setIndentationIncrement().after(g.getHeaderBlockAccess().getHeadersKeyword_0());
c.setNoSpace().before(g.getHeaderBlockAccess().getCommaKeyword_2_0());
c.setNoSpace().before(g.getHeaderAccess().getColonKeyword_1());
c.setNoSpace().after(g.getHeaderAccess().getColonKeyword_1());
c.setIndentationDecrement().after(g.getHeaderBlockRule());
c.setLinewrap().after(g.getHeaderBlockRule());
//
// Members
//
c.setNoSpace().after(g.getSimpleMemberAccess().getColonKeyword_1());
c.setNoSpace().before(g.getSimpleMemberAccess().getColonKeyword_1());
c.setNoSpace().after(g.getTypedMemberAccess().getColonKeyword_1());
c.setNoSpace().before(g.getTypedMemberAccess().getColonKeyword_1());
c.setNoSpace().before(g.getGenericListTypeAccess().getIdLeftSquareBracketRightSquareBracketKeyword_1_0());
}Example 12
| Project: mechanoid-master File: NetModelFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
NetModelGrammarAccess g = (NetModelGrammarAccess) getGrammarAccess();
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
c.setLinewrap(0, 1, 2).before(g.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(g.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(g.getML_COMMENTRule());
c.setLinewrap(2).after(g.getModelAccess().getPackageNameAssignment_1());
//
// Complex type literals
//
c.setLinewrap().after(g.getComplexTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setLinewrap().after(g.getComplexTypeLiteralAccess().getCommaKeyword_2_0());
c.setLinewrap().before(g.getComplexTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setLinewrap(2).after(g.getComplexTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setIndentationIncrement().after(g.getComplexTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setIndentationDecrement().before(g.getComplexTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setNoSpace().before(g.getComplexTypeLiteralAccess().getCommaKeyword_2_0());
//
// Enums
//
c.setLinewrap().after(g.getEnumTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setLinewrap().after(g.getEnumTypeLiteralAccess().getCommaKeyword_2_0());
c.setLinewrap().before(g.getEnumTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setLinewrap(2).after(g.getEnumTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setIndentationIncrement().after(g.getEnumTypeLiteralAccess().getLeftCurlyBracketKeyword_0());
c.setIndentationDecrement().before(g.getEnumTypeLiteralAccess().getRightCurlyBracketKeyword_3());
c.setNoSpace().before(g.getEnumTypeLiteralAccess().getCommaKeyword_2_0());
//
// Clients
//
c.setLinewrap().after(g.getClientAccess().getLeftCurlyBracketKeyword_3());
c.setLinewrap().before(g.getClientAccess().getRightCurlyBracketKeyword_5());
c.setLinewrap(2).after(g.getClientAccess().getRightCurlyBracketKeyword_5());
c.setIndentationIncrement().after(g.getClientAccess().getLeftCurlyBracketKeyword_3());
c.setIndentationDecrement().before(g.getClientAccess().getRightCurlyBracketKeyword_5());
// Methods
c.setLinewrap().around(g.getHttpMethodRule());
c.setLinewrap().around(g.getHttpMethodBlockRule());
c.setIndentationIncrement().after(g.getHttpMethodAccess().getLeftCurlyBracketKeyword_3());
c.setIndentationDecrement().before(g.getHttpMethodAccess().getRightCurlyBracketKeyword_5());
c.setLinewrap(1).after(g.getHttpMethodAccess().getRightCurlyBracketKeyword_5());
c.setNoLinewrap().after(g.getHttpMethodAccess().getTypeHttpMethodTypeEnumRuleCall_0_0());
//
// Paths
//
c.setNoSpace().after(g.getPathAccess().getSolidusKeyword_1());
c.setNoSpace().before(g.getPathAccess().getSolidusKeyword_3_0());
c.setNoSpace().after(g.getPathAccess().getSolidusKeyword_3_0());
c.setNoLinewrap().around(g.getPathRule());
//
// Headers
//
c.setLinewrap().after(g.getHeaderBlockAccess().getHeadersKeyword_0());
c.setIndentationIncrement().after(g.getHeaderBlockAccess().getHeadersKeyword_0());
c.setNoSpace().before(g.getHeaderBlockAccess().getCommaKeyword_2_0());
c.setNoSpace().before(g.getHeaderAccess().getColonKeyword_1());
c.setNoSpace().after(g.getHeaderAccess().getColonKeyword_1());
c.setIndentationDecrement().after(g.getHeaderBlockRule());
c.setLinewrap().after(g.getHeaderBlockRule());
//
// Members
//
c.setNoSpace().after(g.getSimpleMemberAccess().getColonKeyword_1());
c.setNoSpace().before(g.getSimpleMemberAccess().getColonKeyword_1());
c.setNoSpace().after(g.getTypedMemberAccess().getColonKeyword_1());
c.setNoSpace().before(g.getTypedMemberAccess().getColonKeyword_1());
c.setNoSpace().before(g.getGenericListTypeAccess().getIdLeftSquareBracketRightSquareBracketKeyword_1_0());
}Example 13
| Project: metafacture-ide-master File: FluxFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 14
| Project: modellipse-master File: AppliedStereotypePropertyFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 15
| Project: org.fornax.soa.xtextservicerepository-master File: ServiceDslFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
org.xkonnex.repo.dsl.servicedsl.services.ServiceDslGrammarAccess f = (org.xkonnex.repo.dsl.servicedsl.services.ServiceDslGrammarAccess) getGrammarAccess();
c.setAutoLinewrap(120);
c.setLinewrap(1, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(1, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(1, 1, 1).after(f.getML_COMMENTRule());
c.setLinewrap(1, 2, 2).after(f.getBusinessObjectRule());
c.setLinewrap(1, 2, 2).after(f.getServiceRule());
c.setLinewrap(1, 2, 2).after(f.getExceptionRule());
c.setLinewrap(1, 1, 1).after(f.getPropertyRule());
c.setLinewrap(1, 2, 1).after(f.getServiceRule());
c.setLinewrap(2).after(f.getServiceModelAccess().getImportsAssignment_0());
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentationIncrement().after(pair.getFirst());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).after(pair.getSecond());
c.setIndentationDecrement().before(pair.getSecond());
}
for (Keyword kw : f.findKeywords(";")) {
c.setLinewrap(1).after(kw);
}
for (Keyword throwsKw : f.findKeywords("throws")) {
c.setLinewrap(1).before(throwsKw);
}
for (Keyword returnsKw : f.findKeywords("returns")) {
c.setLinewrap(1).before(returnsKw);
}
}Example 16
| Project: Protocol-Definition-Language-master File: ProtocolFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 17
| Project: scape-simulator-master File: SimulatorFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 18
| Project: spray-master File: SprayFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
SprayGrammarAccess f = (SprayGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 19
| Project: xsemantics-master File: FJFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
it.xsemantics.example.fj.services.FJGrammarAccess f = (it.xsemantics.example.fj.services.FJGrammarAccess) getGrammarAccess();
c.setAutoLinewrap(80);
c.setSpace(" ");
// Fields
// add line breaks after a field declaration
FieldElements fieldAccess = f.getFieldAccess();
c.setLinewrap(1).after(fieldAccess.getSemicolonKeyword_2());
// remove possible spaces before the ; ending a field declaration
c.setNoSpace().before(fieldAccess.getSemicolonKeyword_2());
// Methods
MethodElements methodAccess = f.getMethodAccess();
c.setLinewrap(1).after(methodAccess.getRightCurlyBracketKeyword_7());
c.setNoSpace().around(methodAccess.getLeftParenthesisKeyword_2());
c.setNoSpace().before(methodAccess.getRightParenthesisKeyword_4());
c.setNoSpace().before(methodAccess.getCommaKeyword_3_1_0());
c.setNoSpace().around(f.getExpressionAccess().getFullStopKeyword_1_0_1());
c.setNoSpace().before(f.getMethodBodyAccess().getSemicolonKeyword_2());
// Method and constructor invocations
NewElements newAccess = f.getNewAccess();
c.setNoSpace().before(newAccess.getCommaKeyword_3_1_0());
c.setNoSpace().around(newAccess.getLeftParenthesisKeyword_2());
c.setNoSpace().before(newAccess.getRightParenthesisKeyword_4());
// indentations for { } of classes
ClassElements classAccess = f.getClassAccess();
c.setIndentation(classAccess.getLeftCurlyBracketKeyword_3(), classAccess.getRightCurlyBracketKeyword_5());
c.setLinewrap().after(classAccess.getLeftCurlyBracketKeyword_3());
c.setLinewrap(2).after(classAccess.getRightCurlyBracketKeyword_5());
}Example 20
| Project: Xtest-master File: XTestFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1,
// 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1,
// 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 21
| Project: xtext-sandbox-master File: MyDslFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 22
| Project: janglipse-master File: GenericFormatter.java View source code |
/**
* In your implementation of
* {@link org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter#configureFormatting(org.eclipse.xtext.formatting.impl.FormattingConfig)}
* you may call this generic formatting method first. It indents blocks
* between curly braces and sets a linewrap before each keyword. Add your
* own behavior afterwards, e.g.
*
* keywords = grammar.findKeywords(...); for (final Keyword keyword :
* keywords) { config.setNoLinewrap().before(keyword); }
*
*/
public static void genericFormatting(final FormattingConfig config, final IGrammarAccess grammar) {
for (final Pair<Keyword, Keyword> pair : grammar.findKeywordPairs("{", //$NON-NLS-1$ //$NON-NLS-2$
"}")) {
// a space before '{'
//$NON-NLS-1$
config.setSpace(" ").before(pair.getFirst());
// indentation between { }
config.setIndentation(pair.getFirst(), pair.getSecond());
// newline after {
config.setLinewrap().after(pair.getFirst());
// newline before }
config.setLinewrap().before(pair.getSecond());
// newline after }
config.setLinewrap().after(pair.getSecond());
}
// linewrap before all keywords
// final Set<String> allKeywords = GrammarUtil.getAllKeywords(grammar
// .getGrammar());
// final List<Keyword> keywords = grammar.findKeywords(allKeywords
// .toArray(new String[allKeywords.size()]));
// for (final Keyword keyword : keywords) {
// config.setLinewrap().before(keyword);
// }
}Example 23
| Project: eclipse-task-editor-master File: TaskFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 24
| Project: EMF-IncQuery-master File: EMFPatternLanguageFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
EMFPatternLanguageGrammarAccess grammar = (EMFPatternLanguageGrammarAccess) getGrammarAccess();
EMFPatternModelElements patternModelAccess = grammar.getEMFPatternModelAccess();
c.setLinewrap(2).after(patternModelAccess.getPackageNameAssignment_1_1());
c.setLinewrap(1).after(patternModelAccess.getImportPackagesAssignment_2());
c.setLinewrap().before(patternModelAccess.getPatternsAssignment_3());
c.setLinewrap(2).before(patternModelAccess.getPatternsAssignment_3());
c.setLinewrap(2).between(patternModelAccess.getPatternsAssignment_3(), patternModelAccess.getPatternsAssignment_3());
PatternElements patternAccess = grammar.getPatternAccess();
c.setLinewrap(1).after(patternAccess.getAnnotationsAssignment_0());
c.setSpace(" ").around(patternAccess.getOrKeyword_9_0());
AnnotationElements annotationAccess = grammar.getAnnotationAccess();
c.setLinewrap().after(annotationAccess.getRule());
// Preserve newlines around comments
c.setLinewrap(0, 1, 2).before(grammar.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(grammar.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(grammar.getML_COMMENTRule());
for (Keyword keyword : grammar.findKeywords("=")) {
c.setSpace(" ").around(keyword);
}
for (Keyword keyword : grammar.findKeywords(".")) {
c.setNoSpace().before(keyword);
c.setNoSpace().after(keyword);
}
for (Keyword keyword : grammar.findKeywords(":")) {
c.setSpace(" ").before(keyword);
c.setSpace(" ").after(keyword);
}
for (Keyword keyword : grammar.findKeywords("::")) {
c.setNoSpace().before(keyword);
c.setNoSpace().after(keyword);
}
for (Keyword keyword : grammar.findKeywords(",")) {
c.setNoSpace().before(keyword);
c.setSpace(" ").after(keyword);
}
for (Keyword keyword : grammar.findKeywords("(")) {
c.setNoSpace().before(keyword);
c.setNoSpace().after(keyword);
}
for (Keyword keyword : grammar.findKeywords(";")) {
c.setNoSpace().before(keyword);
c.setLinewrap(1, 1, 2).after(keyword);
}
for (Keyword keyword : grammar.findKeywords(")")) {
c.setNoSpace().before(keyword);
c.setLinewrap(1).after(keyword);
}
for (Keyword keyword : grammar.findKeywords("@")) {
c.setNoSpace().after(keyword);
}
for (Keyword keyword : grammar.findKeywords("{")) {
c.setSpace(" ").before(keyword);
c.setLinewrap(1, 1, 2).after(keyword);
c.setIndentationIncrement().after(keyword);
}
for (Keyword keyword : grammar.findKeywords("}")) {
c.setLinewrap(2).after(keyword);
c.setIndentationDecrement().before(keyword);
}
}Example 25
| Project: gef-master File: DotColorFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
/**
* Configure the dot color formatter not set an extra white space after
* the '#' symbol and after the hex digits. It should produce '#abcdef'
* instead of '# ab cd ef'.
*/
c.setNoSpace().around(grammarAccess.getHexRule());
/**
* Configure the dot color formatter not set an extra white space before
* and after the '/' symbol. It should produce '/svg/white' instead of
* '/ svg / white'.
*/
for (Keyword keyWord : grammarAccess.findKeywords("/")) {
c.setNoSpace().around(keyWord);
}
}Example 26
| Project: ISTIC_M2GL-master File: TopanlFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
fr.istic.m2.idm.xtext.services.TopanlGrammarAccess f = (fr.istic.m2.idm.xtext.services.TopanlGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 27
| Project: Jnario-master File: SuiteFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 28
| Project: k3-master File: InitFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
org.kermeta.language.sample.cellularautomata.rules.services.InitGrammarAccess f = (org.kermeta.language.sample.cellularautomata.rules.services.InitGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 29
| Project: melange-master File: MiniFSMFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
fr.inria.diverse.services.MiniFSMGrammarAccess f = (fr.inria.diverse.services.MiniFSMGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 30
| Project: ocl-master File: OCLinEcoreFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
c.setAutoLinewrap(120);
OCLinEcoreGrammarAccess f = getGrammarAccess();
configureCollectionLiteralExpCS(c, f.getCollectionLiteralExpCSAccess());
configureCollectionTypeCS(c, f.getCollectionTypeCSAccess());
configureCurlyBracketedClauseCS(c, f.getCurlyBracketedClauseCSAccess());
configureElseIfThenExpCS(c, f.getElseIfThenExpCSAccess());
configureEssentialOCLNavigationOperatorCS(c, f.getEssentialOCLNavigationOperatorNameAccess());
configureExpCS(c, f.getExpCSAccess());
configureIfExpCS(c, f.getIfExpCSAccess());
configureLetExpCS(c, f.getLetExpCSAccess());
configureMultiplicityBoundsCS(c, f.getMultiplicityBoundsCSAccess());
configureMultiplicityCS(c, f.getMultiplicityCSAccess());
configureMultiplicityStringCS(c, f.getMultiplicityStringCSAccess());
configureNameExpCS(c, f.getNameExpCSAccess());
configureNavigatingCommaArgCS(c, f.getNavigatingCommaArgCSAccess());
configureNavigatingSemiArgCS(c, f.getNavigatingSemiArgCSAccess());
configureNestedExpCS(c, f.getNestedExpCSAccess());
configurePathNameCS(c, f.getPathNameCSAccess());
configurePrimaryExpCS(c, f.getPrimaryExpCSAccess());
configureRoundBracketedClauseCS(c, f.getRoundBracketedClauseCSAccess());
configureSquareBracketedClauseCS(c, f.getSquareBracketedClauseCSAccess());
configureTupleLiteralExpCS(c, f.getTupleLiteralExpCSAccess());
configureTupleTypeCS(c, f.getTupleTypeCSAccess());
configureURIPathNameCS(c, f.getURIPathNameCSAccess());
c.setLinewrap(2).before(f.getML_COMMENTRule());
c.setLinewrap(1).after(f.getML_COMMENTRule());
// c.setLinewrap(1).after(f.getTopLevelCSAccess().getNameAssignment_0_1());
c.setLinewrap(2).between(f.getImportCSRule(), f.getPackageCSRule());
c.setLinewrap(2).between(f.getPackageCSRule(), f.getPackageCSRule());
c.setLinewrap(2).between(f.getStructuredClassCSRule(), f.getStructuredClassCSRule());
c.setLinewrap(2).between(f.getStructuredClassCSRule(), f.getDataTypeCSRule());
c.setLinewrap(2).between(f.getStructuredClassCSRule(), f.getEnumerationCSRule());
c.setLinewrap(2).between(f.getDataTypeCSRule(), f.getStructuredClassCSRule());
c.setLinewrap(2).between(f.getDataTypeCSRule(), f.getDataTypeCSRule());
c.setLinewrap(2).between(f.getDataTypeCSRule(), f.getEnumerationCSRule());
c.setLinewrap(2).between(f.getEnumerationCSRule(), f.getStructuredClassCSRule());
c.setLinewrap(2).between(f.getEnumerationCSRule(), f.getDataTypeCSRule());
c.setLinewrap(2).between(f.getEnumerationCSRule(), f.getEnumerationCSRule());
{
// AnnotationCS
AnnotationCSElements a = f.getAnnotationCSAccess();
setBraces(c, a.getLeftParenthesisKeyword_3_0(), a.getRightParenthesisKeyword_3_3());
// setNoSpaceLineWrap(c, a.getLeftParenthesisKeyword_2_0());
setNoSpaceLineWrap(c, a.getCommaKeyword_3_2_0());
// c.setNoSpace().before(a.getRightParenthesisKeyword_2_3());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_4_1());
setBraces(c, a.getLeftCurlyBracketKeyword_4_0_0(), a.getRightCurlyBracketKeyword_4_0_2());
// c.setIndentation(a.getLeftParenthesisKeyword_2_0(), a.getRightParenthesisKeyword_2_3());
}
{
// AttributeCS
AttributeCSElements a = f.getAttributeCSAccess();
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_5_0(), a.getRightCurlyBracketKeyword_5_2());
c.setNoSpace().around(a.getCommaKeyword_5_1_1());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_6_1());
setBraces(c, a.getLeftCurlyBracketKeyword_6_0_0(), a.getRightCurlyBracketKeyword_6_0_2());
//
c.setNoSpace().before(a.getColonKeyword_6_0_1_1_2());
c.setSpace(" ").after(a.getColonKeyword_6_0_1_1_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_6_0_1_1_4());
c.setIndentation(a.getColonKeyword_6_0_1_1_2(), a.getSemicolonKeyword_6_0_1_1_4());
//
c.setNoSpace().before(a.getColonKeyword_6_0_1_1_2());
c.setSpace(" ").after(a.getColonKeyword_6_0_1_1_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_6_0_1_2_4());
c.setIndentation(a.getColonKeyword_6_0_1_1_2(), a.getSemicolonKeyword_6_0_1_2_4());
}
{
DataTypeCSElements a = f.getDataTypeCSAccess();
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_5_0(), a.getRightCurlyBracketKeyword_5_2());
setBraces(c, a.getLeftCurlyBracketKeyword_6_0_0(), a.getRightCurlyBracketKeyword_6_0_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_6_1());
}
{
DocumentationCSElements a = f.getDocumentationCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_3_0());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_4());
c.setNoSpace().before(a.getRightParenthesisKeyword_3_3());
c.setIndentation(a.getLeftParenthesisKeyword_3_0(), a.getRightParenthesisKeyword_3_3());
}
{
EnumerationCSElements a = f.getEnumerationCSAccess();
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4_0(), a.getRightCurlyBracketKeyword_4_2());
// setBraces(c, a.getLeftCurlyBracketKeyword_4_0(), a.getRightCurlyBracketKeyword_4_2());
setBraces(c, a.getLeftCurlyBracketKeyword_5_0_0(), a.getRightCurlyBracketKeyword_5_0_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_5_1());
}
{
EnumerationLiteralCSElements a = f.getEnumerationLiteralCSAccess();
setNoSpaceLineWrap(c, a.getSemicolonKeyword_2_1());
}
{
ImportCSElements a = f.getImportCSAccess();
c.setNoSpace().around(a.getIsAllColonColonAsteriskKeyword_3_0());
}
{
InvariantConstraintCSElements a = f.getInvariantConstraintCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_2_1_0());
c.setNoSpace().around(a.getRightParenthesisKeyword_2_1_2());
c.setNoSpace().around(a.getColonKeyword_3_0_0());
c.setSpace(" ").before(a.getOwnedSpecificationSpecificationCSParserRuleCall_3_0_1_0());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_3_0_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_3_1());
c.setIndentation(a.getLeftParenthesisKeyword_2_1_0(), a.getRightParenthesisKeyword_2_1_2());
c.setIndentation(a.getColonKeyword_3_0_0(), a.getSemicolonKeyword_3_0_2());
}
{
ModelElementRefCSElements a = f.getModelElementRefCSAccess();
setNoSpaceLineWrap(c, a.getSemicolonKeyword_2());
}
{
OperationCSElements a = f.getOperationCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_4());
c.setNoSpace().before(a.getCommaKeyword_5_1_0());
c.setNoSpace().before(a.getRightParenthesisKeyword_6());
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_9_0(), a.getRightCurlyBracketKeyword_9_2());
c.setNoSpace().around(a.getCommaKeyword_9_1_1());
setBraces(c, a.getLeftCurlyBracketKeyword_10_0_0(), a.getRightCurlyBracketKeyword_10_0_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_10_1());
c.setIndentation(a.getLeftParenthesisKeyword_4(), a.getRightParenthesisKeyword_6());
//
c.setNoSpace().before(a.getColonKeyword_10_0_1_2_2());
c.setSpace(" ").after(a.getColonKeyword_10_0_1_2_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_10_0_1_2_4());
c.setIndentation(a.getColonKeyword_10_0_1_2_2(), a.getSemicolonKeyword_10_0_1_2_4());
}
{
PackageCSElements a = f.getPackageCSAccess();
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4_0_0(), a.getRightCurlyBracketKeyword_4_0_2());
setBraces(c, a.getLeftCurlyBracketKeyword_4_0_0(), a.getRightCurlyBracketKeyword_4_0_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_4_1());
}
{
ParameterCSElements a = f.getParameterCSAccess();
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
c.setNoSpace().around(a.getCommaKeyword_2_1_1());
setBraces(c, a.getLeftCurlyBracketKeyword_3_0(), a.getRightCurlyBracketKeyword_3_2());
}
{
PostconditionConstraintCSElements a = f.getPostconditionConstraintCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_1_1_0());
c.setNoSpace().around(a.getRightParenthesisKeyword_1_1_2());
c.setNoSpace().around(a.getColonKeyword_2());
c.setSpace(" ").before(a.getOwnedSpecificationSpecificationCSParserRuleCall_3_0());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_4());
c.setIndentation(a.getColonKeyword_2(), a.getSemicolonKeyword_4());
}
{
PreconditionConstraintCSElements a = f.getPreconditionConstraintCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_1_1_0());
c.setNoSpace().around(a.getRightParenthesisKeyword_1_1_2());
c.setNoSpace().around(a.getColonKeyword_2());
c.setSpace(" ").before(a.getOwnedSpecificationSpecificationCSParserRuleCall_3_0());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_4());
c.setIndentation(a.getColonKeyword_2(), a.getSemicolonKeyword_4());
}
{
ReferenceCSElements a = f.getReferenceCSAccess();
c.setNoSpace().around(a.getNumberSignKeyword_3_0());
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_6_0(), a.getRightCurlyBracketKeyword_6_2());
c.setNoSpace().around(a.getCommaKeyword_6_1_1());
setBraces(c, a.getLeftCurlyBracketKeyword_7_0_0(), a.getRightCurlyBracketKeyword_7_0_2());
c.setNoSpace().before(a.getCommaKeyword_7_0_1_1_2_0());
//
setNoSpaceLineWrap(c, a.getSemicolonKeyword_7_0_1_1_3());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_7_1());
//
c.setNoSpace().before(a.getColonKeyword_7_0_1_2_2());
c.setSpace(" ").after(a.getColonKeyword_7_0_1_2_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_7_0_1_2_4());
c.setIndentation(a.getColonKeyword_7_0_1_2_2(), a.getSemicolonKeyword_7_0_1_2_4());
//
c.setNoSpace().before(a.getColonKeyword_7_0_1_3_2());
c.setSpace(" ").after(a.getColonKeyword_7_0_1_3_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_7_0_1_3_4());
c.setIndentation(a.getColonKeyword_7_0_1_3_2(), a.getSemicolonKeyword_7_0_1_3_4());
}
{
StructuredClassCSElements a = f.getStructuredClassCSAccess();
c.setNoSpace().around(a.getCommaKeyword_4_2_0());
c.setNoSpace().between(a.getLeftCurlyBracketKeyword_6_0(), a.getRightCurlyBracketKeyword_6_2());
setBraces(c, a.getLeftCurlyBracketKeyword_7_0_0(), a.getRightCurlyBracketKeyword_7_0_2());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_7_1());
}
{
// AnnotationCS
SysMLCSElements a = f.getSysMLCSAccess();
setNoSpaceLineWrap(c, a.getSemicolonKeyword_2_0_1());
setNoSpaceLineWrap(c, a.getSemicolonKeyword_2_1_1_1());
setBraces(c, a.getLeftCurlyBracketKeyword_2_1_0(), a.getRightCurlyBracketKeyword_2_1_2());
}
{
TemplateBindingCSElements a = f.getTemplateBindingCSAccess();
// c.setNoSpace().around(a.getLeftParenthesisKeyword_0_0());
c.setNoSpace().before(a.getCommaKeyword_1_0());
// c.setNoSpace().before(a.getRightParenthesisKeyword_0_3());
// c.setIndentation(a.getLeftParenthesisKeyword_0_0(), a.getRightParenthesisKeyword_0_3());
// c.setNoSpace().around(a.getLessThanSignKeyword_1_0());
// c.setNoSpace().before(a.getCommaKeyword_1_2_0());
// c.setNoSpace().before(a.getGreaterThanSignKeyword_1_3());
// c.setIndentation(a.getLessThanSignKeyword_1_0(), a.getGreaterThanSignKeyword_1_3());
}
{
TemplateSignatureCSElements a = f.getTemplateSignatureCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_0_0());
c.setNoSpace().before(a.getCommaKeyword_0_2_0());
c.setNoSpace().before(a.getRightParenthesisKeyword_0_3());
c.setIndentation(a.getLeftParenthesisKeyword_0_0(), a.getRightParenthesisKeyword_0_3());
c.setNoSpace().around(a.getLessThanSignKeyword_1_0());
c.setNoSpace().before(a.getCommaKeyword_1_2_0());
c.setNoSpace().before(a.getGreaterThanSignKeyword_1_3());
c.setIndentation(a.getLessThanSignKeyword_1_0(), a.getGreaterThanSignKeyword_1_3());
}
{
TypedTypeRefCSElements a = f.getTypedTypeRefCSAccess();
c.setNoSpace().around(a.getLeftParenthesisKeyword_1_0_0());
// c.setNoSpace().before(a.getCommaKeyword_1_0());
c.setNoSpace().before(a.getRightParenthesisKeyword_1_0_2());
c.setIndentation(a.getLeftParenthesisKeyword_1_0_0(), a.getRightParenthesisKeyword_1_0_2());
c.setNoSpace().around(a.getLessThanSignKeyword_1_1_0());
// c.setNoSpace().before(a.getCommaKeyword_1_2_0());
c.setNoSpace().before(a.getGreaterThanSignKeyword_1_1_2());
c.setIndentation(a.getLessThanSignKeyword_1_1_0(), a.getGreaterThanSignKeyword_1_1_2());
}
{
// comments
c.setNoLinewrap().before(f.getSL_COMMENTRule());
}
}Example 31
| Project: org.eclipse.xtext.example.domainmodel-master File: DomainmodelFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
DomainmodelGrammarAccess f = (DomainmodelGrammarAccess) getGrammarAccess();
c.setAutoLinewrap(120);
c.setLinewrap(1, 2, 3).around(f.getAbstractElementRule());
c.setLinewrap(1, 2, 3).around(f.getPackageDeclarationRule());
c.setLinewrap(1, 1, 2).around(f.getFeatureRule());
List<Pair<Keyword, Keyword>> pairs = f.findKeywordPairs("{", "}");
for (Pair<Keyword, Keyword> pair : pairs) {
c.setIndentation(pair.getFirst(), pair.getSecond());
}
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 32
| Project: playtrd-master File: ScxmlxtFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
no.hal.scxml.services.ScxmlxtGrammarAccess f = (no.hal.scxml.services.ScxmlxtGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
}Example 33
| Project: qvto-master File: ImperativeOCLFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(grammarAccess.getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(grammarAccess.getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(grammarAccess.getML_COMMENTRule());
}Example 34
| Project: statecharts-master File: SGenFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
SGenGrammarAccess g = (SGenGrammarAccess) getGrammarAccess();
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
c.setLinewrap(0, 1, 2).before(g.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(g.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(g.getML_COMMENTRule());
// - Line wrap before opening and after closing element
for (Pair<Keyword, Keyword> pair : grammar.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap().after(pair.getFirst());
c.setLinewrap().around(pair.getSecond());
Keyword openingBrace = pair.getFirst();
Group containingGroup = (Group) openingBrace.eContainer();
c.setLinewrap(1, 2, 2).before(containingGroup);
c.setLinewrap(1, 1, 2).after(containingGroup);
}
c.setLinewrap().around(g.getFeatureConfigurationRule());
c.setLinewrap().around(g.getFeatureParameterValueRule());
c.setNoLinewrap().after(g.getGeneratorEntryAccess().getContentTypeAssignment_0());
c.setNoLinewrap().after(g.getFeatureConfigurationAccess().getFeatureKeyword_1());
c.setNoLinewrap().before(g.getGeneratorModelAccess().getGeneratorModelKeyword_0());
}Example 35
| Project: xgherkin-master File: GherkinFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 36
| Project: Xpect-master File: XpectFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1,
// 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1,
// 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 37
| Project: xrepl-master File: XscriptFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}Example 38
| Project: iris-master File: RIMDslFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
RIMDslGrammarAccess f = (RIMDslGrammarAccess) getGrammarAccess();
setPreservingLinewraps(c, 2).after(f.getDomainDeclarationRule());
setPreservingLinewraps(c, 1).around(f.getUseRule());
setPreservingLinewraps(c, 2).after(f.getResourceInteractionModelRule());
setPreservingLinewraps(c, 2).around(f.getStateRule());
setPreservingLinewraps(c, 1).around(f.getEventRule());
setPreservingLinewraps(c, 1).around(f.getCommandRule());
setPreservingLinewraps(c, 1).around(f.getCommandSpecRule());
setPreservingLinewraps(c, 1).around(f.getBasePathRule());
setPreservingLinewraps(c, 1).around(f.getResourceTypeRule());
setPreservingLinewraps(c, 1).around(f.getEntityRule());
setPreservingLinewraps(c, 1).around(f.getImplRefRule());
setPreservingLinewraps(c, 1).around(f.getPathRule());
setPreservingLinewraps(c, 1).around(f.getTransitionRule());
setPreservingLinewraps(c, 1).around(f.getTransitionForEachRule());
setPreservingLinewraps(c, 1).around(f.getTransitionAutoRule());
setPreservingLinewraps(c, 1).around(f.getTransitionEmbeddedRule());
setPreservingLinewraps(c, 1).around(f.getTransitionRefRule());
setPreservingLinewraps(c, 1).around(f.getTitleRule());
setPreservingLinewraps(c, 1).after(f.getTransitionSpecAccess().getRightSquareBracketKeyword_2_1_3());
setPreservingLinewraps(c, 1).after(f.getResourceCommandAccess().getRightSquareBracketKeyword_1_4());
// indent the domain {} block
setIndentationIncrementAndDecrementAndLinewrapAfter(c, f.getDomainDeclarationAccess().getLeftCurlyBracketKeyword_3(), f.getDomainDeclarationAccess().getRightCurlyBracketKeyword_5());
// indent the rim {} block
setIndentationIncrementAndDecrementAndLinewrapAfter(c, f.getResourceInteractionModelAccess().getLeftCurlyBracketKeyword_3(), f.getResourceInteractionModelAccess().getRightCurlyBracketKeyword_5());
// indent the resource {} block
setIndentationIncrementAndDecrementAndLinewrapAfter(c, f.getStateAccess().getLeftCurlyBracketKeyword_4(), f.getStateAccess().getRightCurlyBracketKeyword_6());
// indent the transition {} block
setIndentationIncrementAndDecrementAndLinewrapAfter(c, f.getTransitionSpecAccess().getLeftCurlyBracketKeyword_0(), f.getTransitionSpecAccess().getRightCurlyBracketKeyword_3());
// indent the resource command {} block
setIndentationIncrementAndDecrementAndLinewrapAfter(c, f.getResourceCommandAccess().getLeftCurlyBracketKeyword_1_0(), f.getResourceCommandAccess().getRightCurlyBracketKeyword_1_5());
// formatting comments
setPreservingLinewrap(c).before(f.getML_COMMENTRule());
}Example 39
| Project: packtpub-xtext-book-examples-master File: EntitiesFormatter.java View source code |
@Override protected void configureFormatting(final FormattingConfig c) { final EntitiesGrammarAccess.EntityElements e = this.g.getEntityAccess(); Keyword _leftCurlyBracketKeyword_3 = e.getLeftCurlyBracketKeyword_3(); Keyword _rightCurlyBracketKeyword_5 = e.getRightCurlyBracketKeyword_5(); c.setIndentation(_leftCurlyBracketKeyword_3, _rightCurlyBracketKeyword_5); FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(); Keyword _leftCurlyBracketKeyword_3_1 = e.getLeftCurlyBracketKeyword_3(); _setLinewrap.after(_leftCurlyBracketKeyword_3_1); FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(2); Keyword _rightCurlyBracketKeyword_5_1 = e.getRightCurlyBracketKeyword_5(); _setLinewrap_1.after(_rightCurlyBracketKeyword_5_1); final EntitiesGrammarAccess.AttributeElements a = this.g.getAttributeAccess(); FormattingConfig.LinewrapLocator _setLinewrap_2 = c.setLinewrap(1); Keyword _semicolonKeyword_2 = a.getSemicolonKeyword_2(); _setLinewrap_2.after(_semicolonKeyword_2); FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace(); Keyword _semicolonKeyword_2_1 = a.getSemicolonKeyword_2(); _setNoSpace.before(_semicolonKeyword_2_1); FormattingConfig.LinewrapLocator _setLinewrap_3 = c.setLinewrap(0, 1, 2); TerminalRule _sL_COMMENTRule = this.g.getSL_COMMENTRule(); _setLinewrap_3.before(_sL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_4 = c.setLinewrap(0, 1, 2); TerminalRule _mL_COMMENTRule = this.g.getML_COMMENTRule(); _setLinewrap_4.before(_mL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_5 = c.setLinewrap(0, 1, 1); TerminalRule _mL_COMMENTRule_1 = this.g.getML_COMMENTRule(); _setLinewrap_5.after(_mL_COMMENTRule_1); }
Example 40
| Project: mwe-master File: Mwe2Formatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
Mwe2GrammarAccess f = (Mwe2GrammarAccess) getGrammarAccess();
c.setAutoLinewrap(120);
RuleCall moduleName = f.getModuleAccess().getCanonicalNameFQNParserRuleCall_2_0();
c.setLinewrap(2).between(moduleName, f.getImportRule());
c.setLinewrap(2).between(moduleName, f.getDeclaredPropertyRule());
c.setLinewrap(2).between(moduleName, f.getRootComponentRule());
c.setLinewrap(2).between(f.getImportRule(), f.getDeclaredPropertyRule());
c.setLinewrap(2).between(f.getImportRule(), f.getRootComponentRule());
c.setLinewrap(1, 1, 2).after(f.getImportRule());
c.setLinewrap(2).between(f.getDeclaredPropertyRule(), f.getRootComponentRule());
c.setLinewrap().after(f.getDeclaredPropertyRule());
c.setLinewrap().after(f.getAssignmentRule());
// Parenthesis
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setLinewrap(1, 1, 2).after(pair.getFirst());
c.setLinewrap(1, 1, 2).after(pair.getSecond());
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setNoSpace().between(pair.getFirst(), pair.getSecond());
}
// No space in property refs.
c.setNoSpace().around(f.getPropertyReferenceImplAccess().getReferableAssignment());
// Keep some linewraps before/after comments.
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 41
| Project: Permet-master File: StatemachineFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
c.setLinewrap(0, 1, 2).before(grammar.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(grammar.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(grammar.getML_COMMENTRule());
c.setAutoLinewrap(120);
handleBlocks(c, "events", "end");
handleBlocks(c, "resetEvents", "end");
handleBlocks(c, "commands", "end");
handleBlocks(c, "state", "end");
for (Keyword kw : grammar.findKeywords("=")) {
c.setSpace(" ").around(kw);
}
// no space before comma, one space after
for (Keyword kw : grammar.findKeywords(",")) {
c.setNoSpace().before(kw);
c.setSpace(" ").after(kw);
}
c.setLinewrap().around(grammar.getStatemachineAccess().getEventsAssignment_1_1());
c.setLinewrap().around(grammar.getStatemachineAccess().getResetEventsAssignment_2_1());
c.setLinewrap().around(grammar.getStatemachineAccess().getCommandsAssignment_3_1());
c.setLinewrap().around(grammar.getStatemachineAccess().getStatesAssignment_4());
c.setLinewrap().around(grammar.getStateAccess().getTransitionsAssignment_3());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_1_2(), grammar.getStatemachineAccess().getResetEventsKeyword_2_0());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_1_2(), grammar.getStatemachineAccess().getCommandsKeyword_3_0());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_2_2(), grammar.getStatemachineAccess().getCommandsKeyword_3_0());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_1_2(), grammar.getStatemachineAccess().getStatesAssignment_4());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_1_2(), grammar.getStatemachineAccess().getStatesAssignment_4());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_2_2(), grammar.getStatemachineAccess().getStatesAssignment_4());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getEndKeyword_3_2(), grammar.getStatemachineAccess().getStatesAssignment_4());
c.setLinewrap().between(grammar.getStateAccess().getRightCurlyBracketKeyword_2_3(), grammar.getStateAccess().getTransitionsAssignment_3());
c.setLinewrap(2).between(grammar.getStatemachineAccess().getStatesAssignment_4(), grammar.getStatemachineAccess().getStatesAssignment_4());
}Example 42
| Project: erlide_xtext-master File: ErlangFormatter.java View source code |
@Override
protected void configureFormatting(final FormattingConfig c) {
final ErlangGrammarAccess g = getGrammarAccess();
c.setAutoLinewrap(80);
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
c.setLinewrap(0, 1, 2).before(g.getSL_COMMENTRule());
for (final Pair<Keyword, Keyword> pair : g.findKeywordPairs("(", ")")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (final Pair<Keyword, Keyword> pair : g.findKeywordPairs("[", "]")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (final Pair<Keyword, Keyword> pair : g.findKeywordPairs("{", "}")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (final Pair<Keyword, Keyword> pair : g.findKeywordPairs("<<", ">>")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (final Keyword sep : g.findKeywords(",", ";", ".")) {
c.setNoSpace().before(sep);
}
for (final Keyword sep : g.findKeywords(":")) {
c.setNoSpace().around(sep);
}
c.setNoSpace().after(g.getAttributeAccess().getHyphenMinusKeyword_0());
c.setNoSpace().after(g.getFunctionAccess().getNameAssignment_0());
c.setNoSpace().after(g.getFunctionClauseAccess().getRefAssignment_0());
c.setNoSpace().before(g.getFunctionAccess().getFullStopKeyword_3());
c.setNoSpace().around(g.getFunRefAccess().getSolidusKeyword_2());
c.setNoSpace().around(g.getFunRefAccess().getColonKeyword_0_1());
c.setLinewrap(0, 1, 2).before(g.getAttributeAccess().getHyphenMinusKeyword_0());
c.setLinewrap(2).after(g.getFunctionAccess().getFullStopKeyword_3());
c.setIndentationDecrement().after(g.getFunctionAccess().getFullStopKeyword_3());
c.setLinewrap().after(g.getFunctionAccess().getSemicolonKeyword_2_0());
c.setIndentationDecrement().after(g.getFunctionAccess().getSemicolonKeyword_2_0());
c.setLinewrap().after(g.getFunctionClauseAccess().getHyphenMinusGreaterThanSignKeyword_5());
c.setIndentationIncrement().after(g.getFunctionClauseAccess().getHyphenMinusGreaterThanSignKeyword_5());
c.setLinewrap().after(g.getListOrComprehensionAccess().getCommaKeyword_1_1_1_0());
c.setLinewrap().after(g.getExpressionsAccess().getCommaKeyword_1_0());
c.setNoLinewrap().after(g.getLExpressionAccess().getExprAssignment_0_1());
c.setLinewrap().after(g.getListOrComprehensionAccess().getVerticalLineVerticalLineKeyword_1_1_2_1_1());
c.setLinewrap().after(g.getBinaryOrComprehensionAccess().getVerticalLineVerticalLineKeyword_1_1_2_1());
}Example 43
| Project: lunifera-dsl-master File: EntityGrammarFormatter.java View source code |
public void configure(FormattingConfig c, EntityGrammarGrammarAccess ga) {
EntityGrammarGrammarAccess f = (EntityGrammarGrammarAccess) getGrammarAccess();
super.configure(c, ga.getCommonGrammarGrammarAccess());
configureClassDef(c, f.getClassAccess());
configureEntityDef(c, f.getEntityFeatureAccess());
configureBeanDef(c, f.getBeanFeatureAccess());
configureMultiplicityDef(c, f.getMultiplicityAccess());
configureEnumDef(c, f.getEnumAccess());
configureEnumLiteralDef(c, f.getEnumLiteralAccess());
configureIndex(c, f.getIndexAccess());
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).after(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(1, 1, 1).after(f.getML_COMMENTRule());
for (Keyword kw : ga.findKeywords("@")) {
c.setNoSpace().after(kw);
}
for (Keyword kw : ga.findKeywords("(")) {
c.setNoSpace().after(kw);
}
for (Keyword kw : ga.findKeywords("(")) {
c.setNoSpace().before(kw);
}
for (Keyword kw : ga.findKeywords(")")) {
c.setNoSpace().before(kw);
}
for (Keyword kw : ga.findKeywords(";")) {
c.setNoSpace().before(kw);
}
for (Keyword kw : ga.findKeywords(",")) {
c.setNoSpace().before(kw);
}
}Example 44
| Project: protobuf-dt-master File: ProtobufFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
ProtobufGrammarAccess g = (ProtobufGrammarAccess) getGrammarAccess();
c.setLinewrap(0, 1, 2).before(g.getSL_COMMENTRule());
c.setLinewrap(2).after(g.getSyntaxRule());
c.setLinewrap(2).after(g.getPackageRule());
c.setLinewrap(1).after(g.getNormalImportRule());
c.setLinewrap(1).after(g.getPublicImportRule());
c.setLinewrap(1).after(g.getWeakImportRule());
c.setLinewrap(1).after(g.getNativeOptionRule());
c.setLinewrap(1).after(g.getCustomOptionRule());
c.setLinewrap(2).after(g.getMessageRule());
c.setLinewrap(1).after(g.getMessageFieldRule());
c.setLinewrap(1).after(g.getGroupRule());
c.setLinewrap(2).after(g.getEnumRule());
c.setLinewrap(1).after(g.getEnumElementRule());
c.setLinewrap(1).after(g.getExtensionsRule());
c.setLinewrap(1).after(g.getRpcRule());
c.setLinewrap(2).after(g.getServiceRule());
c.setLinewrap(1).after(g.getStreamRule());
c.setLinewrap(1).between(g.getCHUNKRule(), g.getCHUNKRule());
c.setLinewrap(1).between(g.getML_COMMENTRule(), g.getCHUNKRule());
c.setIndentationIncrement().before(g.getStringLiteralRule());
c.setIndentationDecrement().after(g.getStringLiteralRule());
for (Keyword k : g.findKeywords(EQUAL.toString())) {
c.setSpace(space()).around(k);
}
for (Keyword k : g.findKeywords(SEMICOLON.toString())) {
c.setNoSpace().before(k);
}
for (Keyword k : g.findKeywords(",")) {
c.setNoSpace().before(k);
c.setSpace(space()).after(k);
}
for (Keyword k : g.findKeywords(OPENING_CURLY_BRACKET.toString())) {
c.setIndentationIncrement().after(k);
c.setLinewrap(1).after(k);
}
for (Keyword k : g.findKeywords(CLOSING_CURLY_BRACKET.toString())) {
c.setIndentationDecrement().before(k);
c.setLinewrap(1).after(k);
}
for (Keyword k : g.findKeywords(OPENING_BRACKET.toString(), "(")) {
c.setNoSpace().after(k);
}
for (Keyword k : g.findKeywords(CLOSING_BRACKET.toString(), ")")) {
c.setNoSpace().before(k);
}
}Example 45
| Project: Xcore-master File: XcoreFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
// configure(c, xbaseGrammarAccess);
c.setAutoLinewrap(140);
org.eclipse.emf.ecore.xcore.services.XcoreGrammarAccess f = (org.eclipse.emf.ecore.xcore.services.XcoreGrammarAccess) getGrammarAccess();
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).before(pair.getFirst());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
for (Keyword dot : f.findKeywords(".")) {
c.setNoSpace().around(dot);
}
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("<", ">")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("(", ")")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
c.setLinewrap(1).after(f.getXImportDirectiveRule());
c.setLinewrap(2).after(f.getXPackageAccess().getImportDirectivesXImportDirectiveParserRuleCall_4_0());
c.setNoSpace().before(f.getXGenericTypeAccess().getLessThanSignKeyword_1_0());
c.setNoSpace().after(f.getXAnnotationAccess().getCommercialAtKeyword_0());
c.setNoSpace().before(f.getXAnnotationAccess().getLeftParenthesisKeyword_2_0());
c.setLinewrap(1).before(f.getXAnnotationRule());
c.setLinewrap(1).after(f.getXAnnotationRule());
c.setNoSpace().before(f.getXStringToStringMapEntryAccess().getEqualsSignKeyword_1());
c.setNoSpace().after(f.getXStringToStringMapEntryAccess().getEqualsSignKeyword_1());
c.setLinewrap(1).after(f.getXAnnotationDirectiveRule());
c.setLinewrap(2).after(f.getXPackageAccess().getAnnotationDirectivesXAnnotationDirectiveParserRuleCall_5_0());
c.setNoSpace().before(f.getXOperationAccess().getLeftParenthesisKeyword_7());
c.setLinewrap(2).after(f.getXPackageAccess().getNameAssignment_3());
c.setLinewrap(2).after(f.getXClassRule());
c.setLinewrap(2).after(f.getXDataTypeRule());
c.setLinewrap(2).after(f.getXEnumRule());
c.setLinewrap(1).before(f.getXOperationRule());
c.setLinewrap(1).after(f.getXOperationRule());
c.setLinewrap(1).after(f.getXAttributeRule());
c.setLinewrap(1).after(f.getXReferenceRule());
c.setLinewrap(1).after(f.getXEnumLiteralRule());
c.setNoSpace().before(f.getXClassAccess().getLessThanSignKeyword_4_0());
c.setNoSpace().before(f.getXDataTypeAccess().getLessThanSignKeyword_3_0());
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 46
| Project: DialogScriptDSL-master File: DialogScriptFormatter.java View source code |
protected void configureFormatting(final FormattingConfig c) { FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(0, 1, 2); TerminalRule _sL_COMMENTRule = this._dialogScriptGrammarAccess.getSL_COMMENTRule(); _setLinewrap.before(_sL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(0, 1, 2); TerminalRule _mL_COMMENTRule = this._dialogScriptGrammarAccess.getML_COMMENTRule(); _setLinewrap_1.before(_mL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_2 = c.setLinewrap(0, 1, 1); TerminalRule _mL_COMMENTRule_1 = this._dialogScriptGrammarAccess.getML_COMMENTRule(); _setLinewrap_2.after(_mL_COMMENTRule_1); List<Keyword> _findKeywords = this._dialogScriptGrammarAccess.findKeywords(",", ":", "-", ")"); for (final Keyword keyword : _findKeywords) { FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace(); _setNoSpace.before(keyword); } List<Keyword> _findKeywords_1 = this._dialogScriptGrammarAccess.findKeywords("("); for (final Keyword keyword_1 : _findKeywords_1) { FormattingConfig.NoSpaceLocator _setNoSpace_1 = c.setNoSpace(); _setNoSpace_1.after(keyword_1); } FormattingConfig.LinewrapLocator _setLinewrap_3 = c.setLinewrap(2); DialogScriptGrammarAccess.SwitchesDefinitionElements _switchesDefinitionAccess = this._dialogScriptGrammarAccess.getSwitchesDefinitionAccess(); Keyword _switchesKeyword_0 = _switchesDefinitionAccess.getSwitchesKeyword_0(); _setLinewrap_3.before(_switchesKeyword_0); FormattingConfig.LinewrapLocator _setLinewrap_4 = c.setLinewrap(2); DialogScriptGrammarAccess.ConditionsDefinitionElements _conditionsDefinitionAccess = this._dialogScriptGrammarAccess.getConditionsDefinitionAccess(); Keyword _conditionsKeyword_0 = _conditionsDefinitionAccess.getConditionsKeyword_0(); _setLinewrap_4.before(_conditionsKeyword_0); FormattingConfig.LinewrapLocator _setLinewrap_5 = c.setLinewrap(); DialogScriptGrammarAccess.ConditionDefinitionElements _conditionDefinitionAccess = this._dialogScriptGrammarAccess.getConditionDefinitionAccess(); Keyword _setKeyword_0 = _conditionDefinitionAccess.getSetKeyword_0(); _setLinewrap_5.before(_setKeyword_0); FormattingConfig.LinewrapLocator _setLinewrap_6 = c.setLinewrap(2); DialogScriptGrammarAccess.SceneElements _sceneAccess = this._dialogScriptGrammarAccess.getSceneAccess(); Keyword _sceneKeyword_1 = _sceneAccess.getSceneKeyword_1(); _setLinewrap_6.before(_sceneKeyword_1); FormattingConfig.LinewrapLocator _setLinewrap_7 = c.setLinewrap(2); DialogScriptGrammarAccess.DefaultsElements _defaultsAccess = this._dialogScriptGrammarAccess.getDefaultsAccess(); Keyword _defaultsKeyword_1 = _defaultsAccess.getDefaultsKeyword_1(); _setLinewrap_7.before(_defaultsKeyword_1); FormattingConfig.LinewrapLocator _setLinewrap_8 = c.setLinewrap(2); DialogScriptGrammarAccess.FirstTimeElements _firstTimeAccess = this._dialogScriptGrammarAccess.getFirstTimeAccess(); Keyword _firstKeyword_1 = _firstTimeAccess.getFirstKeyword_1(); _setLinewrap_8.before(_firstKeyword_1); FormattingConfig.LinewrapLocator _setLinewrap_9 = c.setLinewrap(); DialogScriptGrammarAccess.OtherTimesElements _otherTimesAccess = this._dialogScriptGrammarAccess.getOtherTimesAccess(); Keyword _elseKeyword_1 = _otherTimesAccess.getElseKeyword_1(); _setLinewrap_9.before(_elseKeyword_1); FormattingConfig.LinewrapLocator _setLinewrap_10 = c.setLinewrap(2); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess = this._dialogScriptGrammarAccess.getConditionalAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0 = _conditionalAccess.getModifiersModifierEnumRuleCall_0_0(); _setLinewrap_10.before(_modifiersModifierEnumRuleCall_0_0); FormattingConfig.LinewrapLocator _setLinewrap_11 = c.setLinewrap(2); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_1 = this._dialogScriptGrammarAccess.getConditionalAccess(); Keyword _ifKeyword_1 = _conditionalAccess_1.getIfKeyword_1(); _setLinewrap_11.before(_ifKeyword_1); FormattingConfig.NoSpaceLocator _setNoSpace_2 = c.setNoSpace(); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_2 = this._dialogScriptGrammarAccess.getConditionalAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_1 = _conditionalAccess_2.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_3 = this._dialogScriptGrammarAccess.getConditionalAccess(); Keyword _ifKeyword_1_1 = _conditionalAccess_3.getIfKeyword_1(); _setNoSpace_2.between(_modifiersModifierEnumRuleCall_0_0_1, _ifKeyword_1_1); FormattingConfig.SpaceLocator _setSpace = c.setSpace(" "); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_4 = this._dialogScriptGrammarAccess.getConditionalAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_2 = _conditionalAccess_4.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_5 = this._dialogScriptGrammarAccess.getConditionalAccess(); Keyword _ifKeyword_1_2 = _conditionalAccess_5.getIfKeyword_1(); _setSpace.between(_modifiersModifierEnumRuleCall_0_0_2, _ifKeyword_1_2); FormattingConfig.LinewrapLocator _setLinewrap_12 = c.setLinewrap(2); DialogScriptGrammarAccess.PartingLinesElements _partingLinesAccess = this._dialogScriptGrammarAccess.getPartingLinesAccess(); Keyword _partingKeyword_1 = _partingLinesAccess.getPartingKeyword_1(); _setLinewrap_12.before(_partingKeyword_1); FormattingConfig.LinewrapLocator _setLinewrap_13 = c.setLinewrap(2); DialogScriptGrammarAccess.HubElements _hubAccess = this._dialogScriptGrammarAccess.getHubAccess(); Assignment _isHiddenAssignment_0 = _hubAccess.getIsHiddenAssignment_0(); _setLinewrap_13.before(_isHiddenAssignment_0); FormattingConfig.LinewrapLocator _setLinewrap_14 = c.setLinewrap(2); DialogScriptGrammarAccess.HubElements _hubAccess_1 = this._dialogScriptGrammarAccess.getHubAccess(); Keyword _hubKeyword_1 = _hubAccess_1.getHubKeyword_1(); _setLinewrap_14.before(_hubKeyword_1); FormattingConfig.NoSpaceLocator _setNoSpace_3 = c.setNoSpace(); DialogScriptGrammarAccess.HubElements _hubAccess_2 = this._dialogScriptGrammarAccess.getHubAccess(); Assignment _isHiddenAssignment_0_1 = _hubAccess_2.getIsHiddenAssignment_0(); DialogScriptGrammarAccess.HubElements _hubAccess_3 = this._dialogScriptGrammarAccess.getHubAccess(); Keyword _hubKeyword_1_1 = _hubAccess_3.getHubKeyword_1(); _setNoSpace_3.between(_isHiddenAssignment_0_1, _hubKeyword_1_1); FormattingConfig.SpaceLocator _setSpace_1 = c.setSpace(" "); DialogScriptGrammarAccess.HubElements _hubAccess_4 = this._dialogScriptGrammarAccess.getHubAccess(); Assignment _isHiddenAssignment_0_2 = _hubAccess_4.getIsHiddenAssignment_0(); DialogScriptGrammarAccess.HubElements _hubAccess_5 = this._dialogScriptGrammarAccess.getHubAccess(); Keyword _hubKeyword_1_2 = _hubAccess_5.getHubKeyword_1(); _setSpace_1.between(_isHiddenAssignment_0_2, _hubKeyword_1_2); FormattingConfig.LinewrapLocator _setLinewrap_15 = c.setLinewrap(2); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); RuleCall _modifiersModifierEnumRuleCall_1_0 = _choiceDialogAccess.getModifiersModifierEnumRuleCall_1_0(); _setLinewrap_15.before(_modifiersModifierEnumRuleCall_1_0); FormattingConfig.LinewrapLocator _setLinewrap_16 = c.setLinewrap(2); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_1 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); Keyword _choiceKeyword_2 = _choiceDialogAccess_1.getChoiceKeyword_2(); _setLinewrap_16.before(_choiceKeyword_2); FormattingConfig.NoSpaceLocator _setNoSpace_4 = c.setNoSpace(); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_2 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); RuleCall _modifiersModifierEnumRuleCall_1_0_1 = _choiceDialogAccess_2.getModifiersModifierEnumRuleCall_1_0(); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_3 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); Keyword _choiceKeyword_2_1 = _choiceDialogAccess_3.getChoiceKeyword_2(); _setNoSpace_4.between(_modifiersModifierEnumRuleCall_1_0_1, _choiceKeyword_2_1); FormattingConfig.SpaceLocator _setSpace_2 = c.setSpace(" "); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_4 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); RuleCall _modifiersModifierEnumRuleCall_1_0_2 = _choiceDialogAccess_4.getModifiersModifierEnumRuleCall_1_0(); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_5 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); Keyword _choiceKeyword_2_2 = _choiceDialogAccess_5.getChoiceKeyword_2(); _setSpace_2.between(_modifiersModifierEnumRuleCall_1_0_2, _choiceKeyword_2_2); FormattingConfig.LinewrapLocator _setLinewrap_17 = c.setLinewrap(2); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_3 = _conditionalChoiceDialogAccess.getModifiersModifierEnumRuleCall_0_0(); _setLinewrap_17.before(_modifiersModifierEnumRuleCall_0_0_3); FormattingConfig.LinewrapLocator _setLinewrap_18 = c.setLinewrap(2); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_1 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); Keyword _choicesKeyword_1 = _conditionalChoiceDialogAccess_1.getChoicesKeyword_1(); _setLinewrap_18.before(_choicesKeyword_1); FormattingConfig.NoSpaceLocator _setNoSpace_5 = c.setNoSpace(); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_2 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_4 = _conditionalChoiceDialogAccess_2.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_3 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); Keyword _choicesKeyword_1_1 = _conditionalChoiceDialogAccess_3.getChoicesKeyword_1(); _setNoSpace_5.between(_modifiersModifierEnumRuleCall_0_0_4, _choicesKeyword_1_1); FormattingConfig.SpaceLocator _setSpace_3 = c.setSpace(" "); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_4 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_5 = _conditionalChoiceDialogAccess_4.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_5 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); Keyword _choicesKeyword_1_2 = _conditionalChoiceDialogAccess_5.getChoicesKeyword_1(); _setSpace_3.between(_modifiersModifierEnumRuleCall_0_0_5, _choicesKeyword_1_2); FormattingConfig.LinewrapLocator _setLinewrap_19 = c.setLinewrap(); DialogScriptGrammarAccess.DefaultsElements _defaultsAccess_1 = this._dialogScriptGrammarAccess.getDefaultsAccess(); Keyword _endKeyword_4 = _defaultsAccess_1.getEndKeyword_4(); _setLinewrap_19.before(_endKeyword_4); FormattingConfig.LinewrapLocator _setLinewrap_20 = c.setLinewrap(); DialogScriptGrammarAccess.DialogLineElements _dialogLineAccess = this._dialogScriptGrammarAccess.getDialogLineAccess(); CrossReference _characterCharacterDefinitionCrossReference_0_0 = _dialogLineAccess.getCharacterCharacterDefinitionCrossReference_0_0(); _setLinewrap_20.before(_characterCharacterDefinitionCrossReference_0_0); FormattingConfig.LinewrapLocator _setLinewrap_21 = c.setLinewrap(); DialogScriptGrammarAccess.FirstTimeElements _firstTimeAccess_1 = this._dialogScriptGrammarAccess.getFirstTimeAccess(); Keyword _endKeyword_6 = _firstTimeAccess_1.getEndKeyword_6(); _setLinewrap_21.before(_endKeyword_6); FormattingConfig.LinewrapLocator _setLinewrap_22 = c.setLinewrap(); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_6 = this._dialogScriptGrammarAccess.getConditionalAccess(); Keyword _endKeyword_8 = _conditionalAccess_6.getEndKeyword_8(); _setLinewrap_22.before(_endKeyword_8); FormattingConfig.LinewrapLocator _setLinewrap_23 = c.setLinewrap(); DialogScriptGrammarAccess.PartingLinesElements _partingLinesAccess_1 = this._dialogScriptGrammarAccess.getPartingLinesAccess(); Keyword _endKeyword_4_1 = _partingLinesAccess_1.getEndKeyword_4(); _setLinewrap_23.before(_endKeyword_4_1); FormattingConfig.LinewrapLocator _setLinewrap_24 = c.setLinewrap(); DialogScriptGrammarAccess.SwitchOnElements _switchOnAccess = this._dialogScriptGrammarAccess.getSwitchOnAccess(); Keyword _switchKeyword_0 = _switchOnAccess.getSwitchKeyword_0(); _setLinewrap_24.before(_switchKeyword_0); FormattingConfig.LinewrapLocator _setLinewrap_25 = c.setLinewrap(); DialogScriptGrammarAccess.SwitchOffElements _switchOffAccess = this._dialogScriptGrammarAccess.getSwitchOffAccess(); Keyword _switchKeyword_0_1 = _switchOffAccess.getSwitchKeyword_0(); _setLinewrap_25.before(_switchKeyword_0_1); FormattingConfig.LinewrapLocator _setLinewrap_26 = c.setLinewrap(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess = this._dialogScriptGrammarAccess.getOtherwiseAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_6 = _otherwiseAccess.getModifiersModifierEnumRuleCall_0_0(); _setLinewrap_26.before(_modifiersModifierEnumRuleCall_0_0_6); FormattingConfig.LinewrapLocator _setLinewrap_27 = c.setLinewrap(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_1 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); Keyword _elseKeyword_1_1 = _otherwiseAccess_1.getElseKeyword_1(); _setLinewrap_27.before(_elseKeyword_1_1); FormattingConfig.NoSpaceLocator _setNoSpace_6 = c.setNoSpace(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_2 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_7 = _otherwiseAccess_2.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_3 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); Keyword _elseKeyword_1_2 = _otherwiseAccess_3.getElseKeyword_1(); _setNoSpace_6.between(_modifiersModifierEnumRuleCall_0_0_7, _elseKeyword_1_2); FormattingConfig.SpaceLocator _setSpace_4 = c.setSpace(" "); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_4 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_8 = _otherwiseAccess_4.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_5 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); Keyword _elseKeyword_1_3 = _otherwiseAccess_5.getElseKeyword_1(); _setSpace_4.between(_modifiersModifierEnumRuleCall_0_0_8, _elseKeyword_1_3); FormattingConfig.LinewrapLocator _setLinewrap_28 = c.setLinewrap(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_9 = _otherwiseChoiceAccess.getModifiersModifierEnumRuleCall_0_0(); _setLinewrap_28.before(_modifiersModifierEnumRuleCall_0_0_9); FormattingConfig.LinewrapLocator _setLinewrap_29 = c.setLinewrap(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_1 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); Keyword _choicesKeyword_1_3 = _otherwiseChoiceAccess_1.getChoicesKeyword_1(); _setLinewrap_29.before(_choicesKeyword_1_3); FormattingConfig.NoSpaceLocator _setNoSpace_7 = c.setNoSpace(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_2 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_10 = _otherwiseChoiceAccess_2.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_3 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); Keyword _choicesKeyword_1_4 = _otherwiseChoiceAccess_3.getChoicesKeyword_1(); _setNoSpace_7.between(_modifiersModifierEnumRuleCall_0_0_10, _choicesKeyword_1_4); FormattingConfig.SpaceLocator _setSpace_5 = c.setSpace(" "); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_4 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_11 = _otherwiseChoiceAccess_4.getModifiersModifierEnumRuleCall_0_0(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_5 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); Keyword _choicesKeyword_1_5 = _otherwiseChoiceAccess_5.getChoicesKeyword_1(); _setSpace_5.between(_modifiersModifierEnumRuleCall_0_0_11, _choicesKeyword_1_5); FormattingConfig.LinewrapLocator _setLinewrap_30 = c.setLinewrap(); DialogScriptGrammarAccess.ExitElements _exitAccess = this._dialogScriptGrammarAccess.getExitAccess(); Keyword _exitKeyword_1 = _exitAccess.getExitKeyword_1(); _setLinewrap_30.before(_exitKeyword_1); FormattingConfig.LinewrapLocator _setLinewrap_31 = c.setLinewrap(); DialogScriptGrammarAccess.InvokeHubElements _invokeHubAccess = this._dialogScriptGrammarAccess.getInvokeHubAccess(); Keyword _enterKeyword_0 = _invokeHubAccess.getEnterKeyword_0(); _setLinewrap_31.before(_enterKeyword_0); FormattingConfig.LinewrapLocator _setLinewrap_32 = c.setLinewrap(); DialogScriptGrammarAccess.InvokeSceneElements _invokeSceneAccess = this._dialogScriptGrammarAccess.getInvokeSceneAccess(); Keyword _enterKeyword_0_1 = _invokeSceneAccess.getEnterKeyword_0(); _setLinewrap_32.before(_enterKeyword_0_1); FormattingConfig.LinewrapLocator _setLinewrap_33 = c.setLinewrap(); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_6 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); Keyword _endKeyword_6_1 = _choiceDialogAccess_6.getEndKeyword_6(); _setLinewrap_33.before(_endKeyword_6_1); FormattingConfig.LinewrapLocator _setLinewrap_34 = c.setLinewrap(); DialogScriptGrammarAccess.HubElements _hubAccess_6 = this._dialogScriptGrammarAccess.getHubAccess(); Keyword _endKeyword_5 = _hubAccess_6.getEndKeyword_5(); _setLinewrap_34.before(_endKeyword_5); FormattingConfig.LinewrapLocator _setLinewrap_35 = c.setLinewrap(); DialogScriptGrammarAccess.ConditionsDefinitionElements _conditionsDefinitionAccess_1 = this._dialogScriptGrammarAccess.getConditionsDefinitionAccess(); Keyword _endKeyword_3 = _conditionsDefinitionAccess_1.getEndKeyword_3(); _setLinewrap_35.before(_endKeyword_3); FormattingConfig.LinewrapLocator _setLinewrap_36 = c.setLinewrap(); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_6 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); Keyword _endKeyword_9 = _conditionalChoiceDialogAccess_6.getEndKeyword_9(); _setLinewrap_36.before(_endKeyword_9); FormattingConfig.NoSpaceLocator _setNoSpace_8 = c.setNoSpace(); DialogScriptGrammarAccess.DialogLineElements _dialogLineAccess_1 = this._dialogScriptGrammarAccess.getDialogLineAccess(); Keyword _colonKeyword_1 = _dialogLineAccess_1.getColonKeyword_1(); DialogScriptGrammarAccess.DialogLineElements _dialogLineAccess_2 = this._dialogScriptGrammarAccess.getDialogLineAccess(); Assignment _linesAssignment_2 = _dialogLineAccess_2.getLinesAssignment_2(); _setNoSpace_8.between(_colonKeyword_1, _linesAssignment_2); FormattingConfig.SpaceLocator _setSpace_6 = c.setSpace(" "); DialogScriptGrammarAccess.DialogLineElements _dialogLineAccess_3 = this._dialogScriptGrammarAccess.getDialogLineAccess(); Keyword _colonKeyword_1_1 = _dialogLineAccess_3.getColonKeyword_1(); DialogScriptGrammarAccess.DialogLineElements _dialogLineAccess_4 = this._dialogScriptGrammarAccess.getDialogLineAccess(); Assignment _linesAssignment_2_1 = _dialogLineAccess_4.getLinesAssignment_2(); _setSpace_6.between(_colonKeyword_1_1, _linesAssignment_2_1); DialogScriptGrammarAccess.DefaultsElements _defaultsAccess_2 = this._dialogScriptGrammarAccess.getDefaultsAccess(); Keyword _defaultsKeyword_1_1 = _defaultsAccess_2.getDefaultsKeyword_1(); DialogScriptGrammarAccess.DefaultsElements _defaultsAccess_3 = this._dialogScriptGrammarAccess.getDefaultsAccess(); Keyword _endKeyword_4_2 = _defaultsAccess_3.getEndKeyword_4(); c.setIndentation(_defaultsKeyword_1_1, _endKeyword_4_2); DialogScriptGrammarAccess.ConditionsDefinitionElements _conditionsDefinitionAccess_2 = this._dialogScriptGrammarAccess.getConditionsDefinitionAccess(); Keyword _conditionsKeyword_0_1 = _conditionsDefinitionAccess_2.getConditionsKeyword_0(); DialogScriptGrammarAccess.ConditionsDefinitionElements _conditionsDefinitionAccess_3 = this._dialogScriptGrammarAccess.getConditionsDefinitionAccess(); Keyword _endKeyword_3_1 = _conditionsDefinitionAccess_3.getEndKeyword_3(); c.setIndentation(_conditionsKeyword_0_1, _endKeyword_3_1); DialogScriptGrammarAccess.SceneElements _sceneAccess_1 = this._dialogScriptGrammarAccess.getSceneAccess(); RuleCall _nameStringIDParserRuleCall_2_0 = _sceneAccess_1.getNameStringIDParserRuleCall_2_0(); DialogScriptGrammarAccess.SceneElements _sceneAccess_2 = this._dialogScriptGrammarAccess.getSceneAccess(); Keyword _endKeyword_4_3 = _sceneAccess_2.getEndKeyword_4(); c.setIndentation(_nameStringIDParserRuleCall_2_0, _endKeyword_4_3); DialogScriptGrammarAccess.FirstTimeElements _firstTimeAccess_2 = this._dialogScriptGrammarAccess.getFirstTimeAccess(); Keyword _timeKeyword_2 = _firstTimeAccess_2.getTimeKeyword_2(); DialogScriptGrammarAccess.FirstTimeElements _firstTimeAccess_3 = this._dialogScriptGrammarAccess.getFirstTimeAccess(); Keyword _endKeyword_6_2 = _firstTimeAccess_3.getEndKeyword_6(); c.setIndentation(_timeKeyword_2, _endKeyword_6_2); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_7 = this._dialogScriptGrammarAccess.getConditionalAccess(); Keyword _ifKeyword_1_3 = _conditionalAccess_7.getIfKeyword_1(); DialogScriptGrammarAccess.ConditionalElements _conditionalAccess_8 = this._dialogScriptGrammarAccess.getConditionalAccess(); Keyword _endKeyword_8_1 = _conditionalAccess_8.getEndKeyword_8(); c.setIndentation(_ifKeyword_1_3, _endKeyword_8_1); DialogScriptGrammarAccess.HubElements _hubAccess_7 = this._dialogScriptGrammarAccess.getHubAccess(); Assignment _nameAssignment_2 = _hubAccess_7.getNameAssignment_2(); DialogScriptGrammarAccess.HubElements _hubAccess_8 = this._dialogScriptGrammarAccess.getHubAccess(); Keyword _endKeyword_5_1 = _hubAccess_8.getEndKeyword_5(); c.setIndentation(_nameAssignment_2, _endKeyword_5_1); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_7 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); Keyword _choiceKeyword_2_3 = _choiceDialogAccess_7.getChoiceKeyword_2(); DialogScriptGrammarAccess.ChoiceDialogElements _choiceDialogAccess_8 = this._dialogScriptGrammarAccess.getChoiceDialogAccess(); Keyword _endKeyword_6_3 = _choiceDialogAccess_8.getEndKeyword_6(); c.setIndentation(_choiceKeyword_2_3, _endKeyword_6_3); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_7 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); Keyword _choicesKeyword_1_6 = _conditionalChoiceDialogAccess_7.getChoicesKeyword_1(); DialogScriptGrammarAccess.ConditionalChoiceDialogElements _conditionalChoiceDialogAccess_8 = this._dialogScriptGrammarAccess.getConditionalChoiceDialogAccess(); Keyword _endKeyword_9_1 = _conditionalChoiceDialogAccess_8.getEndKeyword_9(); c.setIndentation(_choicesKeyword_1_6, _endKeyword_9_1); FormattingConfig.IndentationLocatorEnd _setIndentationDecrement = c.setIndentationDecrement(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_6 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_12 = _otherwiseChoiceAccess_6.getModifiersModifierEnumRuleCall_0_0(); _setIndentationDecrement.before(_modifiersModifierEnumRuleCall_0_0_12); FormattingConfig.IndentationLocatorEnd _setIndentationDecrement_1 = c.setIndentationDecrement(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_7 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); Keyword _choicesKeyword_1_7 = _otherwiseChoiceAccess_7.getChoicesKeyword_1(); _setIndentationDecrement_1.before(_choicesKeyword_1_7); FormattingConfig.IndentationLocatorStart _setIndentationIncrement = c.setIndentationIncrement(); DialogScriptGrammarAccess.OtherwiseChoiceElements _otherwiseChoiceAccess_8 = this._dialogScriptGrammarAccess.getOtherwiseChoiceAccess(); Keyword _elseKeyword_2 = _otherwiseChoiceAccess_8.getElseKeyword_2(); _setIndentationIncrement.after(_elseKeyword_2); FormattingConfig.IndentationLocatorEnd _setIndentationDecrement_2 = c.setIndentationDecrement(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_6 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); RuleCall _modifiersModifierEnumRuleCall_0_0_13 = _otherwiseAccess_6.getModifiersModifierEnumRuleCall_0_0(); _setIndentationDecrement_2.before(_modifiersModifierEnumRuleCall_0_0_13); FormattingConfig.IndentationLocatorEnd _setIndentationDecrement_3 = c.setIndentationDecrement(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_7 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); Keyword _elseKeyword_1_4 = _otherwiseAccess_7.getElseKeyword_1(); _setIndentationDecrement_3.before(_elseKeyword_1_4); FormattingConfig.IndentationLocatorStart _setIndentationIncrement_1 = c.setIndentationIncrement(); DialogScriptGrammarAccess.OtherwiseElements _otherwiseAccess_8 = this._dialogScriptGrammarAccess.getOtherwiseAccess(); Keyword _elseKeyword_1_5 = _otherwiseAccess_8.getElseKeyword_1(); _setIndentationIncrement_1.after(_elseKeyword_1_5); FormattingConfig.IndentationLocatorEnd _setIndentationDecrement_4 = c.setIndentationDecrement(); DialogScriptGrammarAccess.OtherTimesElements _otherTimesAccess_1 = this._dialogScriptGrammarAccess.getOtherTimesAccess(); Keyword _elseKeyword_1_6 = _otherTimesAccess_1.getElseKeyword_1(); _setIndentationDecrement_4.before(_elseKeyword_1_6); FormattingConfig.IndentationLocatorStart _setIndentationIncrement_2 = c.setIndentationIncrement(); DialogScriptGrammarAccess.OtherTimesElements _otherTimesAccess_2 = this._dialogScriptGrammarAccess.getOtherTimesAccess(); Keyword _elseKeyword_1_7 = _otherTimesAccess_2.getElseKeyword_1(); _setIndentationIncrement_2.after(_elseKeyword_1_7); DialogScriptGrammarAccess.PartingLinesElements _partingLinesAccess_2 = this._dialogScriptGrammarAccess.getPartingLinesAccess(); Keyword _partingKeyword_1_1 = _partingLinesAccess_2.getPartingKeyword_1(); DialogScriptGrammarAccess.PartingLinesElements _partingLinesAccess_3 = this._dialogScriptGrammarAccess.getPartingLinesAccess(); Keyword _endKeyword_4_4 = _partingLinesAccess_3.getEndKeyword_4(); c.setIndentation(_partingKeyword_1_1, _endKeyword_4_4); FormattingConfig.LinewrapLocator _setLinewrap_37 = c.setLinewrap(2); DialogScriptGrammarAccess.SceneElements _sceneAccess_3 = this._dialogScriptGrammarAccess.getSceneAccess(); Keyword _endKeyword_4_5 = _sceneAccess_3.getEndKeyword_4(); _setLinewrap_37.before(_endKeyword_4_5); }
Example 47
| Project: ecore-master File: OCCIFormatter.java View source code |
@Override protected void configureFormatting(final FormattingConfig c) { FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(1); ParserRule _kindDeclRule = this._oCCIGrammarAccess.getKindDeclRule(); _setLinewrap.before(_kindDeclRule); List<Keyword> _findKeywords = this._oCCIGrammarAccess.findKeywords("import"); for (final Keyword import_ : _findKeywords) { { FormattingConfig.NoLinewrapLocator _setNoLinewrap = c.setNoLinewrap(); _setNoLinewrap.after(import_); FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(); _setLinewrap_1.before(import_); } } List<Keyword> _findKeywords_1 = this._oCCIGrammarAccess.findKeywords("use"); for (final Keyword use : _findKeywords_1) { { FormattingConfig.NoLinewrapLocator _setNoLinewrap = c.setNoLinewrap(); _setNoLinewrap.after(use); FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(); _setLinewrap_1.before(use); } } FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(1); ParserRule _attributeDeclRule = this._oCCIGrammarAccess.getAttributeDeclRule(); _setLinewrap_1.before(_attributeDeclRule); FormattingConfig.LinewrapLocator _setLinewrap_2 = c.setLinewrap(1); ParserRule _actionDeclRule = this._oCCIGrammarAccess.getActionDeclRule(); _setLinewrap_2.before(_actionDeclRule); FormattingConfig.LinewrapLocator _setLinewrap_3 = c.setLinewrap(1); ParserRule _dataTypeDeclRule = this._oCCIGrammarAccess.getDataTypeDeclRule(); _setLinewrap_3.before(_dataTypeDeclRule); FormattingConfig.LinewrapLocator _setLinewrap_4 = c.setLinewrap(1); ParserRule _enumTypeDeclRule = this._oCCIGrammarAccess.getEnumTypeDeclRule(); _setLinewrap_4.before(_enumTypeDeclRule); FormattingConfig.LinewrapLocator _setLinewrap_5 = c.setLinewrap(1); ParserRule _dataTypeAnnotationRule = this._oCCIGrammarAccess.getDataTypeAnnotationRule(); _setLinewrap_5.before(_dataTypeAnnotationRule); FormattingConfig.LinewrapLocator _setLinewrap_6 = c.setLinewrap(1); ParserRule _resourceDeclRule = this._oCCIGrammarAccess.getResourceDeclRule(); _setLinewrap_6.before(_resourceDeclRule); FormattingConfig.LinewrapLocator _setLinewrap_7 = c.setLinewrap(1); ParserRule _linkDeclRule = this._oCCIGrammarAccess.getLinkDeclRule(); _setLinewrap_7.before(_linkDeclRule); FormattingConfig.LinewrapLocator _setLinewrap_8 = c.setLinewrap(1); ParserRule _stateDeclRule = this._oCCIGrammarAccess.getStateDeclRule(); _setLinewrap_8.before(_stateDeclRule); List<Pair<Keyword, Keyword>> _findKeywordPairs = this._oCCIGrammarAccess.findKeywordPairs("(", ")"); for (final Pair<Keyword, Keyword> pair : _findKeywordPairs) { { FormattingConfig.NoLinewrapLocator _setNoLinewrap = c.setNoLinewrap(); Keyword _first = pair.getFirst(); _setNoLinewrap.before(_first); FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace(); Keyword _first_1 = pair.getFirst(); _setNoSpace.after(_first_1); FormattingConfig.NoLinewrapLocator _setNoLinewrap_1 = c.setNoLinewrap(); Keyword _second = pair.getSecond(); _setNoLinewrap_1.before(_second); FormattingConfig.NoSpaceLocator _setNoSpace_1 = c.setNoSpace(); Keyword _second_1 = pair.getSecond(); _setNoSpace_1.before(_second_1); } } List<Pair<Keyword, Keyword>> _findKeywordPairs_1 = this._oCCIGrammarAccess.findKeywordPairs("{", "}"); for (final Pair<Keyword, Keyword> pair_1 : _findKeywordPairs_1) { { Keyword _first = pair_1.getFirst(); Keyword _second = pair_1.getSecond(); c.setIndentation(_first, _second); FormattingConfig.LinewrapLocator _setLinewrap_9 = c.setLinewrap(1); Keyword _first_1 = pair_1.getFirst(); _setLinewrap_9.after(_first_1); FormattingConfig.LinewrapLocator _setLinewrap_10 = c.setLinewrap(1); Keyword _second_1 = pair_1.getSecond(); _setLinewrap_10.before(_second_1); FormattingConfig.LinewrapLocator _setLinewrap_11 = c.setLinewrap(1); Keyword _second_2 = pair_1.getSecond(); _setLinewrap_11.after(_second_2); } } List<Keyword> _findKeywords_2 = this._oCCIGrammarAccess.findKeywords(","); for (final Keyword comma : _findKeywords_2) { { FormattingConfig.NoLinewrapLocator _setNoLinewrap = c.setNoLinewrap(); _setNoLinewrap.before(comma); FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace(); _setNoSpace.before(comma); FormattingConfig.LinewrapLocator _setLinewrap_9 = c.setLinewrap(); _setLinewrap_9.after(comma); } } FormattingConfig.LinewrapLocator _setLinewrap_9 = c.setLinewrap(0, 1, 2); TerminalRule _sL_COMMENTRule = this._oCCIGrammarAccess.getSL_COMMENTRule(); _setLinewrap_9.before(_sL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_10 = c.setLinewrap(0, 1, 2); TerminalRule _mL_COMMENTRule = this._oCCIGrammarAccess.getML_COMMENTRule(); _setLinewrap_10.before(_mL_COMMENTRule); FormattingConfig.LinewrapLocator _setLinewrap_11 = c.setLinewrap(0, 1, 1); TerminalRule _mL_COMMENTRule_1 = this._oCCIGrammarAccess.getML_COMMENTRule(); _setLinewrap_11.after(_mL_COMMENTRule_1); }
Example 48
| Project: terminology-master File: TerminologyFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
c.setAutoLinewrap(120);
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
c.setLinewrap(0, 1, 2).before(ga.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(ga.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(ga.getML_COMMENTRule());
c.setNoSpace().before(ga.getSubjectEntriesRule());
//Entry
c.setLinewrap(2).before(ga.getEntryRule());
c.setNoSpace().around(ga.getEntryAccess().getLeftParenthesisKeyword_0_1());
c.setNoSpace().before(ga.getEntryAccess().getRightParenthesisKeyword_0_4());
c.setNoSpace().before(ga.getEntryAccess().getCommaKeyword_0_3_0());
c.setLinewrap(1).after(ga.getEntryAccess().getRightParenthesisKeyword_0_4());
c.setLinewrap(1).before(ga.getFeedbackAccess().getFeedbackKeyword_0());
//Metadata
c.setLinewrap(1).before(ga.getMetaDataRule());
c.setIndentationIncrement().after(ga.getEntryAccess().getLeftCurlyBracketKeyword_3());
c.setIndentationDecrement().before(ga.getEntryAccess().getRightCurlyBracketKeyword_11());
c.setIndentationIncrement().before(ga.getMetaDataAccess().getStatusKeyword_2());
c.setLinewrap(1).before(ga.getMetaDataAccess().getStatusKeyword_2());
c.setLinewrap(1).before(ga.getMetaDataAccess().getCreatedKeyword_4());
c.setLinewrap(1).before(ga.getMetaDataAccess().getModifiedKeyword_7_0());
c.setLinewrap(1).before(ga.getMetaDataAccess().getRightCurlyBracketKeyword_8());
c.setIndentationDecrement().before(ga.getMetaDataAccess().getRightCurlyBracketKeyword_8());
//Entry continued Definition
c.setLinewrap(1).before(ga.getEntryAccess().getDefinitionKeyword_6());
c.setLinewrap(1).before(ga.getEntryAccess().getSourceKeyword_8_0());
c.setLinewrap(1).before(ga.getEntryAccess().getRelatedEntriesKeyword_9_0());
c.setLinewrap(1).before(ga.getEntryAccess().getRelatedEntriesKeyword_9_0());
c.setNoSpace().before(ga.getEntryAccess().getCommaKeyword_9_2_0());
//Term
c.setLinewrap(1).before(ga.getTermAccess().getAllowDuplicateDuplicateOKKeyword_0_0());
c.setLinewrap(1).before(ga.getTermAccess().getTermKeyword_1());
c.setLinewrap(1).after(ga.getTermAccess().getNameAssignment_2());
c.setIndentationIncrement().after(ga.getTermAccess().getNameAssignment_2());
//TODO this seems to cause problems wrt. the unordered group
// c.setIndentationDecrement().after(ga.getTermAccess().getUnorderedGroup_9());
c.setIndentationDecrement().after(ga.getTermRule());
c.setLinewrap(1).after(ga.getTermRule());
c.setLinewrap(1).before(ga.getTermAccess().getStatusKeyword_3());
c.setLinewrap(1).before(ga.getTermAccess().getLanguageKeyword_5());
c.setLinewrap(1).before(ga.getTermAccess().getGrKeyword_7());
c.setLinewrap(1).before(ga.getTermAccess().getUsageKeyword_9_0());
c.setLinewrap(1).before(ga.getTermAccess().getCustomersKeyword_11_0());
c.setLinewrap(1).before(ga.getTermAccess().getProductsKeyword_10_0());
c.setNoSpace().before(ga.getTermAccess().getCommaKeyword_10_2_0());
c.setNoSpace().before(ga.getTermAccess().getCommaKeyword_11_2_0());
//Terminology
c.setNoSpace().before(ga.getTerminologyRule());
c.setLinewrap(1).before(ga.getTerminologyAccess().getDefinitionsKeyword_3());
c.setIndentationIncrement().after(ga.getTerminologyAccess().getDefinitionsKeyword_3());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_4_2_0());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_5_2_0());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_6_2_0());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_7_2_0());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_8_2_0());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_9_2_0());
c.setNoSpace().before(ga.getTerminologyAccess().getCommaKeyword_10_2_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getSubjectsKeyword_4_0());
c.setLinewrap(1).before(ga.getSubjectRule());
c.setIndentationIncrement().before(ga.getTerminologyAccess().getSubjectsAssignment_4_1());
c.setIndentationDecrement().before(ga.getTerminologyAccess().getStatusKeyword_5_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getStatusKeyword_5_0());
c.setLinewrap(1).before(ga.getStatusRule());
c.setIndentationIncrement().before(ga.getTerminologyAccess().getStatusAssignment_5_1());
c.setIndentationDecrement().before(ga.getTerminologyAccess().getLanguagesKeyword_6_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getLanguagesKeyword_6_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getGrKeyword_7_0());
c.setIndentationIncrement().before(ga.getTerminologyAccess().getGrsAssignment_7_1());
c.setLinewrap(1).before(ga.getGrRule());
c.setIndentationDecrement().before(ga.getTerminologyAccess().getAuthorsKeyword_8_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getAuthorsKeyword_8_0());
c.setIndentationIncrement().before(ga.getTerminologyAccess().getAuthorsAssignment_8_1());
c.setLinewrap(1).before(ga.getAuthorRule());
c.setIndentationDecrement().before(ga.getTerminologyAccess().getProductsKeyword_9_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getProductsKeyword_9_0());
c.setIndentationIncrement().before(ga.getTerminologyAccess().getProductsAssignment_9_1());
c.setLinewrap(1).before(ga.getProductRule());
c.setIndentationDecrement().before(ga.getTerminologyAccess().getCustomersKeyword_10_0());
c.setLinewrap(1).before(ga.getTerminologyAccess().getCustomersKeyword_10_0());
c.setIndentationIncrement().before(ga.getTerminologyAccess().getCustomersAssignment_10_1());
c.setLinewrap(1).before(ga.getCustomerRule());
// c.setIndentationDecrement().before(ga.getTerminologyAccess().getCustomersKeyword_9_0());
}Example 49
| Project: xDoc-master File: XdocFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
XdocGrammarAccess grammarAccess = (XdocGrammarAccess) getGrammarAccess();
c.setAutoLinewrap(120);
c.setLinewrap(2, 2, 3).between(grammarAccess.getTextOrMarkupRule(), grammarAccess.getTextOrMarkupRule());
c.setNoSpace().around(grammarAccess.getWSRule());
c.setNoSpace().around(grammarAccess.getANY_WSRule());
c.setNoSpace().around(grammarAccess.getMULTI_NLRule());
configureChapter(c, grammarAccess);
configureSection(c, grammarAccess);
configureSection2(c, grammarAccess);
configureSection3(c, grammarAccess);
configureSection4(c, grammarAccess);
configureCodeBlock(c, grammarAccess);
configureCodeRef(c, grammarAccess);
configureRef(c, grammarAccess);
configureEm(c, grammarAccess);
configureTextPart(c, grammarAccess);
configureTables(c, grammarAccess);
configureLists(c, grammarAccess);
}Example 50
| Project: Xturtle-master File: XturtleFormatter.java View source code |
//formatting is extremely problematic as white spaces are significant as separators...
//use completely separate formatter? try rewriting the grammar? I woudn't like to
//use my own lexer
@Override
protected void configureFormatting(FormattingConfig c) {
c.setAutoLinewrap(200);
c.setLinewrap(0, 1, 2).before(grammarAccess.getSL_COMMENTRule());
//line wrap between direcives
c.setLinewrap(1).between(grammarAccess.getDirectiveAccess().getTRIPELENDTerminalRuleCall_1(), grammarAccess.getPrefixIdAccess().getPrefixKeyword_0());
c.setLinewrap(1).between(grammarAccess.getDirectiveAccess().getTRIPELENDTerminalRuleCall_1(), grammarAccess.getBaseAccess().getBaseKeyword_0());
//spaces in prefix definition
c.setNoSpace().around(grammarAccess.getPrefixIdAccess().getColonKeyword_1_1());
// c.setSpace(" ").after(grammarAccess.getPrefixKeywordRule());
//line wraps between directive and triple
c.setLinewrap(2).between(grammarAccess.getDirectiveAccess().getTRIPELENDTerminalRuleCall_1(), grammarAccess.getUriDefRule());
c.setLinewrap(2).between(grammarAccess.getDirectiveAccess().getTRIPELENDTerminalRuleCall_1(), grammarAccess.getQNameDefRule());
//linw wraps between triple and directive
c.setLinewrap(2).between(grammarAccess.getTriplesAccess().getTRIPELENDTerminalRuleCall_2(), grammarAccess.getPrefixIdAccess().getPrefixKeyword_0());
c.setLinewrap(2).between(grammarAccess.getTriplesAccess().getTRIPELENDTerminalRuleCall_2(), grammarAccess.getBaseAccess().getBaseKeyword_0());
//line wraps between triples
c.setLinewrap(1, 2, 2).between(grammarAccess.getTriplesAccess().getTRIPELENDTerminalRuleCall_2(), grammarAccess.getUriDefRule());
c.setLinewrap(1, 2, 2).between(grammarAccess.getTriplesAccess().getTRIPELENDTerminalRuleCall_2(), grammarAccess.getQNameDefRule());
//line wraps in predicate object list of triple
c.setLinewrap(0, 0, 1).after(grammarAccess.getQNameDefRule());
c.setLinewrap(0, 0, 1).after(grammarAccess.getUriDefRule());
c.setIndentationIncrement().after(grammarAccess.getQNameDefRule());
c.setIndentationIncrement().after(grammarAccess.getUriDefRule());
c.setIndentationDecrement().after(grammarAccess.getTriplesAccess().getTRIPELENDTerminalRuleCall_2());
c.setLinewrap(1).before(grammarAccess.getTriplesAccess().getPredObjsAssignment_1_1_1());
//no space before , and ;
c.setNoSpace().before(grammarAccess.getTriplesAccess().getSemicolonKeyword_1_1_0_0());
c.setNoSpace().before(grammarAccess.getTriplesAccess().getSemicolonKeyword_1_2());
c.setNoSpace().before(grammarAccess.getBlankObjectsAccess().getSemicolonKeyword_2_1_0());
c.setNoSpace().before(grammarAccess.getBlankObjectsAccess().getSemicolonKeyword_2_2());
c.setNoSpace().before(grammarAccess.getPredicateObjectListAccess().getCommaKeyword_2_0());
//WS in QName
c.setNoSpace().between(grammarAccess.getQNameRefAccess().getPrefixAssignment_1(), grammarAccess.getQNameRefAccess().getRefAssignment_2());
c.setNoSpace().between(grammarAccess.getQNameDefAccess().getPrefixAssignment_1(), grammarAccess.getQNameDefAccess().getIdAssignment_2());
//WS in String literals
c.setNoSpace().around(grammarAccess.getStringLiteralAccess().getCircumflexAccentCircumflexAccentKeyword_1_0_0());
c.setNoSpace().before(grammarAccess.getStringLiteralAccess().getLanguageAssignment_1_1());
//blank objects
c.setNoSpace().between(grammarAccess.getBlankObjectsAccess().getLeftSquareBracketKeyword_0(), grammarAccess.getBlankObjectsAccess().getRightSquareBracketKeyword_3());
c.setIndentationIncrement().after(grammarAccess.getBlankObjectsAccess().getLeftSquareBracketKeyword_0());
c.setIndentationDecrement().before(grammarAccess.getBlankObjectsAccess().getRightSquareBracketKeyword_3());
c.setLinewrap(0, 0, 1).after(grammarAccess.getBlankObjectsAccess().getLeftSquareBracketKeyword_0());
c.setLinewrap(0, 0, 1).before(grammarAccess.getBlankObjectsAccess().getRightSquareBracketKeyword_3());
c.setLinewrap(0, 1, 1).after(grammarAccess.getBlankObjectsAccess().getSemicolonKeyword_2_1_0());
c.setLinewrap(0, 1, 1).after(grammarAccess.getBlankObjectsAccess().getSemicolonKeyword_2_2());
//blank objects
c.setNoSpace().between(grammarAccess.getBlankCollectionAccess().getLeftParenthesisKeyword_0(), grammarAccess.getBlankCollectionAccess().getRightParenthesisKeyword_3());
c.setIndentationIncrement().after(grammarAccess.getBlankCollectionAccess().getLeftParenthesisKeyword_0());
c.setIndentationDecrement().before(grammarAccess.getBlankCollectionAccess().getRightParenthesisKeyword_3());
c.setLinewrap(0, 0, 1).before(grammarAccess.getBlankCollectionAccess().getObjectsAssignment_2_0());
c.setLinewrap(0, 0, 1).before(grammarAccess.getBlankCollectionAccess().getObjectsAssignment_2_1());
c.setLinewrap(0, 0, 1).before(grammarAccess.getBlankCollectionAccess().getRightParenthesisKeyword_3());
}Example 51
| Project: axdt-master File: As3Formatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
IndentStyle indentStyle = formattingConfig.getIndentStyle(null);
int autoLineWrap = formattingConfig.getInt(null, IFormattingConfig.MAX_LINE_WIDTH);
int minMemberWrap = 1;
As3GrammarAccess f = getGrammarAccess();
c.setAutoLinewrap(autoLineWrap);
c.setLinewrap(1, 1, 2).after(f.getVirtualSemiRule());
c.setNoSpace().before(f.getVirtualSemiRule());
// colon
c.setNoSpace().around(f.getResultTypeAccess().getColonKeyword_0_1());
c.setNoSpace().around(f.getVarTypeAssignAccess().getColonKeyword_1());
c.setNoSpace().around(f.getVarTypeAccess().getColonKeyword_0());
c.setNoSpace().around(f.getAs3LiteralFieldAccess().getColonKeyword_2());
// dot
for (Keyword comma : f.findKeywords(".")) {
c.setNoSpace().around(comma);
}
// comma
for (Keyword comma : f.findKeywords(",")) {
c.setNoSpace().before(comma);
}
// arithmetic
c.setNoSpace().before(f.getIPostfixExpressionAccess().getPlusSignPlusSignKeyword_1_0_0_1());
c.setNoSpace().before(f.getIPostfixExpressionAccess().getHyphenMinusHyphenMinusKeyword_1_1_0_1());
// pairs
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("(", ")")) {
c.setNoSpace().bounds(pair.getFirst(), pair.getSecond());
}
c.setNoSpace().before(f.getAs3ArgumentsAccess().getLeftParenthesisKeyword_1());
c.setNoSpace().bounds(f.getAs3PropertyOperatorAccess().getLeftSquareBracketKeyword_1_0(), f.getAs3PropertyOperatorAccess().getRightSquareBracketKeyword_1_4());
// initializers
As3ArrayInitializerElements arrayInitializer = f.getAs3ArrayInitializerAccess();
As3ArrayElementHeadElements arrayHead = f.getAs3ArrayElementHeadAccess();
As3ArrayElementTailElements arrayTail = f.getAs3ArrayElementTailAccess();
configureInitializers(c, arrayHead.getLeftSquareBracketKeyword_1(), arrayInitializer.getRightSquareBracketKeyword_3(), arrayTail.getCommaKeyword_1());
ObjectInitialiserElements objectInitialiser = f.getObjectInitialiserAccess();
configureInitializers(c, objectInitialiser.getLeftCurlyBracketKeyword_1(), objectInitialiser.getRightCurlyBracketKeyword_4(), objectInitialiser.getCommaKeyword_3_2_0());
c.setLinewrap(0, 0, 1).after(objectInitialiser.getCommaKeyword_3_3_0());
// metadata
As3MetadataTagElements metadataTag = f.getAs3MetadataTagAccess();
c.setNoSpace().bounds(metadataTag.getLeftSquareBracketKeyword_0(), metadataTag.getRightSquareBracketKeyword_3());
c.setNoSpace().around(metadataTag.getLeftParenthesisKeyword_2_0());
c.setNoSpace().around(metadataTag.getRightParenthesisKeyword_2_3());
c.setLinewrap(1, 1, 1).after(metadataTag.getRightSquareBracketKeyword_3());
// indentations
c.setIndentation(f.getAs3BlockAccess().getLeftCurlyBracketKeyword_1(), f.getAs3BlockAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap(1, 1, 2).after(f.getAs3BlockAccess().getLeftCurlyBracketKeyword_1());
c.setLinewrap(1, 1, 2).after(f.getAs3BlockAccess().getRightCurlyBracketKeyword_4());
indentStyle.breakBefore(c, f.getAs3BlockAccess().getLeftCurlyBracketKeyword_1());
c.setIndentation(f.getAs3ClassAccess().getLeftCurlyBracketKeyword_7(), f.getAs3ClassAccess().getRightCurlyBracketKeyword_10());
c.setLinewrap(minMemberWrap, 2, 2).after(f.getAs3ClassAccess().getLeftCurlyBracketKeyword_7());
indentStyle.breakBefore(c, f.getAs3ClassAccess().getLeftCurlyBracketKeyword_7());
c.setLinewrap().after(f.getAs3ClassAccess().getRightCurlyBracketKeyword_10());
c.setIndentation(f.getAs3InterfaceAccess().getLeftCurlyBracketKeyword_6(), f.getAs3InterfaceAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap(minMemberWrap, 2, 2).after(f.getAs3InterfaceAccess().getLeftCurlyBracketKeyword_6());
indentStyle.breakBefore(c, f.getAs3InterfaceAccess().getLeftCurlyBracketKeyword_6());
c.setLinewrap().after(f.getAs3InterfaceAccess().getRightCurlyBracketKeyword_9());
c.setIndentation(f.getAs3PackageAccess().getLeftCurlyBracketKeyword_4(), f.getAs3PackageAccess().getRightCurlyBracketKeyword_7());
c.setLinewrap(minMemberWrap, 2, 2).after(f.getAs3PackageAccess().getLeftCurlyBracketKeyword_4());
indentStyle.breakBefore(c, f.getAs3PackageAccess().getLeftCurlyBracketKeyword_4());
c.setLinewrap().after(f.getAs3PackageAccess().getRightCurlyBracketKeyword_7());
// indentations for auto line wrap
c.setIndentation(f.getAs3OperationAccess().getLeftParenthesisKeyword_6(), f.getAs3OperationAccess().getRightParenthesisKeyword_9());
c.setIndentation(f.getAs3OperationAccess().getFunctionKeyword_1(), f.getAs3OperationAccess().getBodyAssignment_12());
c.setIndentation(f.getAs3FunctionExpressionAccess().getLeftParenthesisKeyword_3(), f.getAs3FunctionExpressionAccess().getRightParenthesisKeyword_6());
c.setIndentation(f.getAs3FunctionExpressionAccess().getFunctionKeyword_0(), f.getAs3FunctionExpressionAccess().getBodyAssignment_10());
// comments
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(1, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(1, 1, 2).before(f.getDOC_COMMENTRule());
c.setLinewrap(1, 1, 2).after(f.getML_COMMENTRule());
c.setLinewrap(1, 1, 1).after(f.getDOC_COMMENTRule());
// misc
c.setNoSpace().before(f.getAs3PropertyOperatorAccess().getLeftSquareBracketKeyword_1_0());
c.setNoSpace().before(f.getAs3FunctionExpressionAccess().getLeftParenthesisKeyword_3());
c.setNoSpace().before(f.getAs3OperationAccess().getLeftParenthesisKeyword_6());
c.setNoSpace().before(f.getAs3OperationSignatureAccess().getLeftParenthesisKeyword_6());
c.setNoSpace().around(f.getAs3QueryOperatorAccess().getFullStopFullStopKeyword_0_0());
c.setNoLinewrap().before(f.getAs3DoStatementAccess().getWhileKeyword_4());
c.setLinewrap(minMemberWrap, Math.max(1, minMemberWrap), 2).after(f.getAs3ImportListRule());
c.setNoLinewrap().between(f.getAs3BlockAccess().getRightCurlyBracketKeyword_4(), f.getAs3IfStatementAccess().getElseKeyword_5_0_0_1());
}Example 52
| Project: Facttype-master File: DiagramFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
DiagramGrammarAccess f = (DiagramGrammarAccess) getGrammarAccess();
// Allow a width of 120.
c.setAutoLinewrap(120);
// Find common keywords and specify formatting for them.
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("(", ")")) {
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (Keyword comma : f.findKeywords(",")) {
c.setNoSpace().before(comma);
c.setNoSpace().after(comma);
}
/*
* Formatting for grammar rule types:
* types {
* String (10)
* Number (2, 1)
* }
*/
c.setIndentationIncrement().before(f.getTypeAccess().getNameAssignment_0());
c.setIndentationDecrement().after(f.getTypeAccess().getRightParenthesisKeyword_4());
c.setLinewrap().before(f.getTypeAccess().getNameAssignment_0());
c.setLinewrap().after(f.getTypeAccess().getRightParenthesisKeyword_4());
c.setLinewrap().after(f.getTypeAccess().getRightParenthesisKeyword_4());
c.setLinewrap(2).after(f.getDiagramAccess().getRightCurlyBracketKeyword_2());
/*
* Formatting for factTypeDiagram.
*/
c.setLinewrap().after(f.getFactTypeDiagramAccess().getDescriptionAssignment_3());
c.setIndentationIncrement().after(f.getFactTypeDiagramAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getFactTypeDiagramAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap().after(f.getFactTypeDiagramAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().before(f.getFactTypeDiagramAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap().after(f.getFactTypeDiagramAccess().getRightCurlyBracketKeyword_9());
/*
* Formatting for sentence.
*/
c.setIndentationIncrement().after(f.getSentenceTemplateAccess().getSentenceTemplateKeyword_0());
c.setIndentationDecrement().before(f.getSentenceTemplateAccess().getRightCurlyBracketKeyword_3());
c.setLinewrap().after(f.getSentenceTemplateAccess().getSentenceTemplateKeyword_0());
c.setLinewrap().before(f.getSentenceTemplateAccess().getRightCurlyBracketKeyword_3());
c.setLinewrap().after(f.getSentenceTemplateAccess().getRightCurlyBracketKeyword_3());
/*
* Formatting for column.
*/
c.setIndentationIncrement().after(f.getColumnAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getColumnAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().after(f.getColumnAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().before(f.getColumnAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().after(f.getColumnAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().before(f.getColumnAccess().getTypeKeyword_5());
c.setLinewrap().before(f.getColumnAccess().getDerivedDerivedEnumRuleCall_7_0());
c.setLinewrap().before(f.getColumnAccess().getNotEmptyNotEmptyKeyword_8_0());
c.setLinewrap().before(f.getColumnAccess().getValuesKeyword_9());
/*
* Formatting for primary key.
*/
c.setIndentationIncrement().after(f.getPrimaryKeyAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getPrimaryKeyAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap().after(f.getPrimaryKeyAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().before(f.getPrimaryKeyAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap().after(f.getPrimaryKeyAccess().getRightCurlyBracketKeyword_4());
/*
* Formatting for alternative key.
*/
c.setIndentationIncrement().after(f.getAlternativeKeyAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getAlternativeKeyAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap().after(f.getAlternativeKeyAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().before(f.getAlternativeKeyAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap().after(f.getAlternativeKeyAccess().getRightCurlyBracketKeyword_4());
/*
* Formatting for SubsetRule.
*/
c.setIndentationIncrement().after(f.getSubsetRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getSubsetRuleAccess().getRightCurlyBracketKeyword_11());
c.setLinewrap().after(f.getSubsetRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getSubsetRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().after(f.getSubsetRuleAccess().getSuperAssignment_4());
c.setLinewrap().before(f.getSubsetRuleAccess().getColumnsKeyword_8());
c.setLinewrap().before(f.getSubsetRuleAccess().getRightCurlyBracketKeyword_11());
c.setLinewrap().after(f.getSubsetRuleAccess().getRightCurlyBracketKeyword_11());
/*
* Formatting for EqualityRule.
*/
c.setIndentationIncrement().after(f.getEqualityRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getEqualityRuleAccess().getRightCurlyBracketKeyword_11());
c.setLinewrap().after(f.getEqualityRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getEqualityRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().after(f.getEqualityRuleAccess().getSuperAssignment_4());
c.setLinewrap().before(f.getEqualityRuleAccess().getColumnsKeyword_8());
c.setLinewrap().before(f.getEqualityRuleAccess().getRightCurlyBracketKeyword_11());
c.setLinewrap().after(f.getEqualityRuleAccess().getRightCurlyBracketKeyword_11());
/*
* Formatting for PartialEqualityRule.
*/
c.setIndentationIncrement().after(f.getPartialEqualityRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getPartialEqualityRuleAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().after(f.getPartialEqualityRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getPartialEqualityRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().after(f.getPartialEqualityRuleAccess().getSuperAssignment_4());
c.setLinewrap().after(f.getPartialEqualityRuleAccess().getExcludingAssignment_5());
c.setLinewrap().before(f.getPartialEqualityRuleAccess().getColumnsKeyword_9());
c.setLinewrap().before(f.getPartialEqualityRuleAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().after(f.getPartialEqualityRuleAccess().getRightCurlyBracketKeyword_12());
/*
* Formatting for OccurrenceFrequencyRule.
*/
c.setIndentationIncrement().after(f.getOccurrenceFrequencyRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getOccurrenceFrequencyRuleAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap().after(f.getOccurrenceFrequencyRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getOccurrenceFrequencyRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().after(f.getOccurrenceFrequencyRuleAccess().getMinimumAssignment_4());
c.setLinewrap().after(f.getOccurrenceFrequencyRuleAccess().getMaximumAssignment_5());
c.setLinewrap().before(f.getOccurrenceFrequencyRuleAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap().after(f.getOccurrenceFrequencyRuleAccess().getRightCurlyBracketKeyword_9());
/*
* Formatting for NoOverlappingRule.
*/
c.setIndentationIncrement().after(f.getNoOverlappingRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getNoOverlappingRuleAccess().getRightCurlyBracketKeyword_7());
c.setLinewrap().after(f.getNoOverlappingRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getNoOverlappingRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().before(f.getNoOverlappingRuleAccess().getRightCurlyBracketKeyword_7());
c.setLinewrap().after(f.getNoOverlappingRuleAccess().getRightCurlyBracketKeyword_7());
/*
* Formatting for ExclusionRule.
*/
c.setIndentationIncrement().after(f.getExclusionRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getExclusionRuleAccess().getRightCurlyBracketKeyword_10());
c.setLinewrap().after(f.getExclusionRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getExclusionRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().before(f.getExclusionRuleAccess().getColumnsKeyword_7());
c.setLinewrap().before(f.getExclusionRuleAccess().getRightCurlyBracketKeyword_10());
c.setLinewrap().after(f.getExclusionRuleAccess().getRightCurlyBracketKeyword_10());
/*
* Formatting for GeneralConstraint.
*/
c.setIndentationIncrement().after(f.getGeneralConstraintAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getGeneralConstraintAccess().getRightCurlyBracketKeyword_7());
c.setLinewrap().after(f.getGeneralConstraintAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getGeneralConstraintAccess().getDescriptionAssignment_3());
c.setLinewrap().before(f.getGeneralConstraintAccess().getRightCurlyBracketKeyword_7());
c.setLinewrap().after(f.getGeneralConstraintAccess().getRightCurlyBracketKeyword_7());
/*
* Formatting for EventRule.
*/
c.setIndentationIncrement().after(f.getEventRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getEventRuleAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().after(f.getEventRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getEventRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().after(f.getEventRuleAccess().getAfterBeforeAssignment_4());
c.setLinewrap().after(f.getEventRuleAccess().getCrudCrudEnumRuleCall_5_0());
c.setLinewrap().before(f.getEventRuleAccess().getColumnsKeyword_9());
c.setLinewrap().before(f.getEventRuleAccess().getRightCurlyBracketKeyword_12());
c.setLinewrap().after(f.getEventRuleAccess().getRightCurlyBracketKeyword_12());
/*
* Formatting for DerivationRule.
*/
c.setIndentationIncrement().after(f.getDerivationRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getDerivationRuleAccess().getRightCurlyBracketKeyword_10());
c.setLinewrap().after(f.getDerivationRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getDerivationRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().before(f.getDerivationRuleAccess().getColumnsKeyword_7());
c.setLinewrap().before(f.getDerivationRuleAccess().getRightCurlyBracketKeyword_10());
c.setLinewrap().after(f.getDerivationRuleAccess().getRightCurlyBracketKeyword_10());
/*
* Formatting for ValueRule.
*/
c.setIndentationIncrement().after(f.getValueRuleAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getValueRuleAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap().after(f.getValueRuleAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getValueRuleAccess().getDescriptionAssignment_3());
c.setLinewrap().before(f.getValueRuleAccess().getColumnsKeyword_6());
c.setLinewrap().before(f.getValueRuleAccess().getRightCurlyBracketKeyword_9());
c.setLinewrap().after(f.getValueRuleAccess().getRightCurlyBracketKeyword_9());
/*
* Formatting for Comments.
* It's usually a good idea to activate the following three statements.
* They will add and preserve newlines around comments.
*/
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
}Example 53
| Project: org.eclipse.emf-master File: XcoreFormatter.java View source code |
public void configureFormatting(FormattingConfig config, XcoreGrammarAccess grammarAccess) {
configureXPackage(config, grammarAccess.getXPackageAccess());
configureXAnnotation(config, grammarAccess.getXAnnotationAccess());
configureXStringToStringMapEntry(config, grammarAccess.getXStringToStringMapEntryAccess());
configureXImportDirective(config, grammarAccess.getXImportDirectiveAccess());
configureQualifiedNameWithWildcard(config, grammarAccess.getQualifiedNameWithWildcardAccess());
configureXAnnotationDirective(config, grammarAccess.getXAnnotationDirectiveAccess());
configureXClassifier(config, grammarAccess.getXClassifierAccess());
configureXDataType(config, grammarAccess.getXDataTypeAccess());
configureXEnum(config, grammarAccess.getXEnumAccess());
configureXEnumLiteral(config, grammarAccess.getXEnumLiteralAccess());
configureXClass(config, grammarAccess.getXClassAccess());
configureXMember(config, grammarAccess.getXMemberAccess());
configureXAttribute(config, grammarAccess.getXAttributeAccess());
configureXReference(config, grammarAccess.getXReferenceAccess());
configureXOperation(config, grammarAccess.getXOperationAccess());
configureXParameter(config, grammarAccess.getXParameterAccess());
configureXTypeParameter(config, grammarAccess.getXTypeParameterAccess());
configureXMultiplicity(config, grammarAccess.getXMultiplicityAccess());
configureXBlockExpression(config, grammarAccess.getXBlockExpressionAccess());
configureXGenericType(config, grammarAccess.getXGenericTypeAccess());
configureXGenericTypeArgument(config, grammarAccess.getXGenericTypeArgumentAccess());
configureXGenericWildcardTypeArgument(config, grammarAccess.getXGenericWildcardTypeArgumentAccess());
configureXQualifiedName(config, grammarAccess.getXQualifiedNameAccess());
configureXID(config, grammarAccess.getXIDAccess());
configureValidID(config, grammarAccess.getValidIDAccess());
/*
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}"))
{
c.setIndentation(pair.getFirst(), pair.getSecond());
c.setLinewrap(1).before(pair.getFirst());
c.setLinewrap(1).after(pair.getFirst());
c.setLinewrap(1).before(pair.getSecond());
c.setLinewrap(1).after(pair.getSecond());
}
for (Keyword comma : f.findKeywords(","))
{
c.setNoLinewrap().before(comma);
c.setNoSpace().before(comma);
c.setLinewrap().after(comma);
}
for (Keyword dot : f.findKeywords("."))
{
c.setNoSpace().around(dot);
}
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("<", ">"))
{
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("(", ")"))
{
c.setNoSpace().after(pair.getFirst());
c.setNoSpace().before(pair.getSecond());
}
c.setLinewrap(1).after(f.getXImportDirectiveRule());
c.setLinewrap(2).after(f.getXPackageAccess().getImportDirectivesXImportDirectiveParserRuleCall_4_0());
c.setNoSpace().before(f.getXGenericTypeAccess().getLessThanSignKeyword_1_0());
c.setNoSpace().after(f.getXAnnotationAccess().getCommercialAtKeyword_0());
c.setNoSpace().before(f.getXAnnotationAccess().getLeftParenthesisKeyword_2_0());
c.setLinewrap(1).before(f.getXAnnotationRule());
c.setLinewrap(1).after(f.getXAnnotationRule());
c.setNoSpace().before(f.getXStringToStringMapEntryAccess().getEqualsSignKeyword_1());
c.setNoSpace().after(f.getXStringToStringMapEntryAccess().getEqualsSignKeyword_1());
c.setLinewrap(1).after(f.getXAnnotationDirectiveRule());
c.setLinewrap(2).after(f.getXPackageAccess().getAnnotationDirectivesXAnnotationDirectiveParserRuleCall_5_0());
c.setNoSpace().before(f.getXOperationAccess().getLeftParenthesisKeyword_8());
c.setLinewrap(2).after(f.getXPackageAccess().getNameAssignment_3());
c.setLinewrap(2).after(f.getXClassRule());
c.setLinewrap(2).after(f.getXDataTypeRule());
c.setLinewrap(2).after(f.getXEnumRule());
c.setLinewrap(1).before(f.getXOperationRule());
c.setLinewrap(1).after(f.getXOperationRule());
c.setLinewrap(1).after(f.getXAttributeRule());
c.setLinewrap(1).after(f.getXReferenceRule());
c.setLinewrap(1).after(f.getXEnumLiteralRule());
c.setNoSpace().before(f.getXClassAccess().getLessThanSignKeyword_4_0());
c.setNoSpace().before(f.getXDataTypeAccess().getLessThanSignKeyword_3_0());
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
*/
}Example 54
| Project: integrity-master File: DSLFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig aConfig) {
DSLGrammarAccess tempGrammar = (DSLGrammarAccess) getGrammarAccess();
// No line wrapping
aConfig.setAutoLinewrap(9999);
// No spaces after opening bracket or before closing bracket of custom operations...
aConfig.setNoSpace().after(tempGrammar.getCustomOperationAccess().getLeftSquareBracketKeyword_0());
aConfig.setNoSpace().before(tempGrammar.getCustomOperationAccess().getPrefixOperandValueOrEnumValueOrOperationCollectionParserRuleCall_2_0_0());
aConfig.setNoSpace().after(tempGrammar.getCustomOperationAccess().getPostfixOperandValueOrEnumValueOrOperationCollectionParserRuleCall_4_2_0());
aConfig.setNoSpace().before(tempGrammar.getCustomOperationAccess().getRightSquareBracketKeyword_6());
// ...and the same with standard operations
aConfig.setNoSpace().after(tempGrammar.getStandardOperationAccess().getLeftParenthesisKeyword_0());
aConfig.setNoSpace().before(tempGrammar.getStandardOperationAccess().getFirstOperandValueOrEnumValueOrOperationParserRuleCall_2_0());
aConfig.setNoSpace().after(tempGrammar.getStandardOperationAccess().getMoreOperandsValueOrEnumValueOrOperationParserRuleCall_4_2_0());
aConfig.setNoSpace().before(tempGrammar.getStandardOperationAccess().getRightParenthesisKeyword_5());
// No spaces at the end of lines and before whitespace between tokens
aConfig.setNoSpace().before(tempGrammar.getNLRule());
aConfig.setNoSpace().before(tempGrammar.getNLFORCEDRule());
aConfig.setNoSpace().before(tempGrammar.getNEWLINERule());
aConfig.setNoSpace().around(tempGrammar.getModelAccess().getNLParserRuleCall_1());
// No spaces before colons, commas, after pluses or before/after hashes
aConfig.setNoSpace().before(tempGrammar.getValueOrEnumValueOrOperationCollectionAccess().getCommaKeyword_1_1());
aConfig.setNoSpace().before(tempGrammar.getForkParameterAccess().getColonKeyword_2());
aConfig.setNoSpace().before(tempGrammar.getParameterAccess().getColonKeyword_2());
aConfig.setNoSpace().before(tempGrammar.getSuiteParameterAccess().getColonKeyword_2());
aConfig.setNoSpace().before(tempGrammar.getVariantValueAccess().getColonKeyword_3());
aConfig.setNoSpace().after(tempGrammar.getArbitraryParameterOrResultNameAccess().getPlusSignKeyword_0());
aConfig.setNoSpace().around(tempGrammar.getMethodReferenceAccess().getNumberSignKeyword_1());
aConfig.setNoSpace().around(tempGrammar.getJavaConstantReferenceAccess().getNumberSignKeyword_1());
aConfig.setNoSpace().before(tempGrammar.getKeyValuePairAccess().getColonKeyword_2());
aConfig.setNoSpace().around(tempGrammar.getVariableAccess().getNumberSignKeyword_1_0());
// No spaces before/after encapsulating <>
aConfig.setNoSpace().after(tempGrammar.getJavaConstantValueAccess().getLessThanSignKeyword_0());
aConfig.setNoSpace().before(tempGrammar.getJavaConstantValueAccess().getGreaterThanSignKeyword_2());
aConfig.setNoSpace().after(tempGrammar.getTypedNestedObjectAccess().getLessThanSignKeyword_0());
aConfig.setNoSpace().before(tempGrammar.getTypedNestedObjectAccess().getGreaterThanSignKeyword_2());
// No spaces at the end of table lines
aConfig.setNoSpace().after(tempGrammar.getTableTestAccess().getVerticalLineKeyword_8_1());
aConfig.setNoSpace().after(tempGrammar.getParameterTableHeaderAccess().getVerticalLineKeyword_2());
aConfig.setNoSpace().after(tempGrammar.getResultTableHeaderAccess().getVerticalLineKeyword_3());
aConfig.setNoSpace().after(tempGrammar.getParameterTableValueAccess().getVerticalLineKeyword_2());
// No spaces before the 'T' divider in ISO date/time strings
aConfig.setNoSpace().after(tempGrammar.getIsoDateAndTimeValueAccess().getDateValueISODATETerminalRuleCall_0_0());
// Indentations
// Suites and Packages
aConfig.setIndentation(tempGrammar.getPackageDefinitionAccess().getPackagedefKeyword_0(), tempGrammar.getPackageDefinitionAccess().getPackageendKeyword_6());
aConfig.setIndentation(tempGrammar.getSuiteDefinitionAccess().getSuitedefKeyword_1(), tempGrammar.getSuiteDefinitionAccess().getSuiteendKeyword_12());
// Objects
aConfig.setIndentation(tempGrammar.getNestedObjectAccess().getLeftCurlyBracketKeyword_0(), tempGrammar.getNestedObjectAccess().getRightCurlyBracketKeyword_3());
// Constant Variants
aConfig.setIndentation(tempGrammar.getVariantValueAccess().getNLParserRuleCall_1(), tempGrammar.getVariantValueAccess().getValueAssignment_5());
// Tests and Calls
aConfig.setIndentation(tempGrammar.getTestAccess().getNLParserRuleCall_2(), tempGrammar.getTestAccess().getNLParserRuleCall_7());
aConfig.setIndentation(tempGrammar.getCallAccess().getNLParserRuleCall_1(), tempGrammar.getCallAccess().getNLParserRuleCall_7());
aConfig.setIndentation(tempGrammar.getTableTestAccess().getNLParserRuleCall_1(), tempGrammar.getTableTestAccess().getNLFORCEDParserRuleCall_10());
}Example 55
| Project: geppetto-master File: PPFormatter.java View source code |
protected void atExpressionConfiguration(FormattingConfig c) {
PPGrammarAccess ga = (PPGrammarAccess) getGrammarAccess();
// At expression
// -- no space between EXPR and [
// -- no space after opening [
// -- no space before closing ]
c.setNoSpace().before(ga.getAtExpressionAccess().getLeftSquareBracketKeyword_1_1());
c.setNoSpace().after(ga.getAtExpressionAccess().getLeftSquareBracketKeyword_1_1());
c.setNoSpace().before(ga.getAtExpressionAccess().getRightSquareBracketKeyword_1_3());
}Example 56
| Project: orcc-master File: CalFormatter.java View source code |
private void body(FormattingConfig c, Keyword kwdDo, Keyword kwdEnd) {
// "do" unindents and indents
c.setIndentation(kwdDo, kwdDo);
// "end" unindents
c.setIndentation(null, kwdEnd);
// add some spaces around do and end
c.setLinewrap().before(kwdDo);
c.setLinewrap().after(kwdDo);
c.setLinewrap().before(kwdEnd);
c.setLinewrap(2).after(kwdEnd);
}Example 57
| Project: eef-master File: ExpressionTextFormatter.java View source code |
@Override
protected void configureFormatting(final FormattingConfig c) {
}Example 58
| Project: eLang-master File: ELFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
}Example 59
| Project: emfviews-master File: ExtensionFormatter.java View source code |
protected void configureFormatting(final FormattingConfig c) {
}Example 60
| Project: Henshin-Editor-master File: TggInterpreterConfigFormatter.java View source code |
protected void configureFormatting(final FormattingConfig c) {
}Example 61
| Project: mm-dsl-master File: MMDSLFormatter.java View source code |
protected void configureFormatting(final FormattingConfig c) {
}Example 62
| Project: org.eclipse.etrice-master File: RoomFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
//org.eclipse.etrice.core.services.RoomGrammarAccess f = (org.eclipse.etrice.core.services.RoomGrammarAccess) getGrammarAccess();
//...
}Example 63
| Project: acs-master File: TmcdbTablesFormatter.java View source code |
@Override
protected void configureFormatting(FormattingConfig c) {
/*alma.acs.tmcdb.grammardef.services.TmcdbTablesGrammarAccess f = (alma.acs.tmcdb.grammardef.services.TmcdbTablesGrammarAccess)*/
getGrammarAccess();
//...
}